Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use icons in nav bar #2722

Merged
merged 2 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions src/subcommand/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2741,13 +2741,7 @@ mod tests {
StatusCode::OK,
format!(
r".*<title>Ordinals</title>.*
<nav class=tabs>
<a href=/inscriptions>Inscriptions</a>
<span>\|</span>
<a href=/blocks>Blocks</a>
<span>\|</span>
<a href=/collections>Collections</a>
</nav>
<h1>Latest Inscriptions</h1>
<div class=thumbnails>
<a href=/inscription/{}>.*</a>
(<a href=/inscription/[[:xdigit:]]{{64}}i0>.*</a>\s*){{99}}
Expand Down Expand Up @@ -2789,7 +2783,7 @@ mod tests {
TestServer::new_with_regtest().assert_response_regex(
"/",
StatusCode::OK,
".*<a href=/>Ordinals<sup>regtest</sup></a>.*",
".*<a href=/ title=home>Ordinals<sup>regtest</sup></a>.*",
);
}

Expand Down Expand Up @@ -2962,9 +2956,8 @@ mod tests {
"/",
StatusCode::OK,
".*
<a href=/clock>Clock</a>
<a href=/rare.txt>rare.txt</a>
<form action=/search method=get>.*",
<a href=/clock title=clock>.*</a>
<a href=/rare.txt title=rare>.*</a>.*",
);
}

Expand All @@ -2983,8 +2976,8 @@ mod tests {
"/",
StatusCode::OK,
".*
<a href=/clock>Clock</a>
<form action=/search method=get>.*",
<a href=/clock title=clock>.*</a>
<a href=https://docs.ordinals.com/.*",
);
}

Expand Down
17 changes: 9 additions & 8 deletions src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,15 @@ mod tests {
</head>
<body>
<header>
<nav class=links>
<a href=/>Ordinals<sup>alpha</sup></a>
<nav>
<a href=/ title=home>Ordinals<sup>alpha</sup></a>
.*
<a href=/clock title=clock>.*</a>
<a href=/rare.txt title=rare>.*</a>
.*
<a href=/clock>Clock</a>
<a href=/rare.txt>rare.txt</a>
<form action=/search method=get>
<input type=text .*>
<input type=submit value=Search>
<input class=icon type=image .*>
</form>
</nav>
</header>
Expand All @@ -167,7 +168,7 @@ mod tests {
domain: None,
index_sats: true,
})),
r".*<nav class=links>\s*<a href=/>Ordinals<sup>alpha</sup></a>.*"
r".*<nav>\s*<a href=/ title=home>Ordinals<sup>alpha</sup></a>.*"
);
}

Expand All @@ -180,7 +181,7 @@ mod tests {
domain: None,
index_sats: false,
})),
r".*<nav class=links>\s*<a href=/>Ordinals<sup>alpha</sup></a>.*<a href=/clock>Clock</a>\s*<form action=/search.*",
r".*<nav>\s*<a href=/ title=home>Ordinals<sup>alpha</sup></a>.*<a href=/clock title=clock>.*</a>\s*<form action=/search.*",
);
}

Expand All @@ -193,7 +194,7 @@ mod tests {
domain: None,
index_sats: true,
})),
r".*<nav class=links>\s*<a href=/>Ordinals<sup>signet</sup></a>.*"
r".*<nav>\s*<a href=/ title=home>Ordinals<sup>signet</sup></a>.*"
);
}
}
10 changes: 3 additions & 7 deletions src/templates/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ mod tests {
}
.to_string()
.unindent(),
"<nav class=tabs>
<a href=/inscriptions>Inscriptions</a>
<span>|</span>
<a href=/blocks>Blocks</a>
</nav>
"<h1>Latest Inscriptions</h1>
<div class=thumbnails>
<a href=/inscription/1{64}i1><iframe .* src=/preview/1{64}i1></iframe></a>
<a href=/inscription/2{64}i2><iframe .* src=/preview/2{64}i2></iframe></a>
<a href=/inscription/1{64}i1><iframe .* src=/preview/1{64}i1></iframe></a>
<a href=/inscription/2{64}i2><iframe .* src=/preview/2{64}i2></iframe></a>
</div>
"
.unindent(),
Expand Down
4 changes: 2 additions & 2 deletions src/templates/inscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod tests {
next: None,
},
"
<h1>Inscriptions</h1>
<h1>All Inscriptions</h1>
<div class=thumbnails>
<a href=/inscription/1{64}i1><iframe .* src=/preview/1{64}i1></iframe></a>
<a href=/inscription/2{64}i2><iframe .* src=/preview/2{64}i2></iframe></a>
Expand All @@ -56,7 +56,7 @@ mod tests {
next: Some(2),
},
"
<h1>Inscriptions</h1>
<h1>All Inscriptions</h1>
<div class=thumbnails>
<a href=/inscription/1{64}i1><iframe .* src=/preview/1{64}i1></iframe></a>
<a href=/inscription/2{64}i2><iframe .* src=/preview/2{64}i2></iframe></a>
Expand Down
1 change: 1 addition & 0 deletions static/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/cubes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/diagram-project.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/discord.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/gem.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/images.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 18 additions & 8 deletions static/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ html {

main {
margin: 0 auto;
padding: 0 1rem 1rem;
max-width: 100%;
padding: 0 1rem 1rem;
width: 50rem;
}

Expand Down Expand Up @@ -65,15 +65,15 @@ dt {
margin-top: 0.5rem;
}

.links {
nav {
align-items: center;
background-color: var(--light-bg);
display: flex;
gap: 1rem;
padding: 1rem;
}

.links > :first-child {
nav > :first-child {
color: var(--light-fg);
font-weight: bold;
}
Expand All @@ -83,6 +83,7 @@ form {
flex-grow: 1;
gap: 1rem;
margin-left: auto;
padding-bottom: 0.25rem;
width: 100%;
}

Expand All @@ -95,6 +96,10 @@ input[type=text] {
min-width: 0;
}

input[type=image] {
margin-top: 0.2rem;
}

dl {
overflow-wrap: break-word;
}
Expand All @@ -104,8 +109,8 @@ ol, ul {
}

@media (max-width: 38rem) {
.links {
flex-direction: column;
nav {
flex-wrap: wrap;
}
}

Expand Down Expand Up @@ -218,13 +223,13 @@ a.mythic {
}

.inscription > *:nth-child(1), .inscription > *:nth-child(3) {
align-items: center;
color: var(--dark-bg);
display: flex;
flex: 1;
font-size: 200%;
text-decoration: none;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
}

.inscription > a:nth-child(1):hover, .inscription > a:nth-child(3):hover {
Expand Down Expand Up @@ -258,3 +263,8 @@ a.mythic {
flex: 1;
text-align: left;
}

.icon {
height: 1rem;
width: 1rem;
}
1 change: 1 addition & 0 deletions static/magnifying-glass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 1 addition & 7 deletions templates/home.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
<nav class=tabs>
<a href=/inscriptions>Inscriptions</a>
<span>|</span>
<a href=/blocks>Blocks</a>
<span>|</span>
<a href=/collections>Collections</a>
</nav>
<h1>Latest Inscriptions</h1>
<div class=thumbnails>
%% for inscription in &self.inscriptions {
{{ Iframe::thumbnail(*inscription) }}
Expand Down
2 changes: 1 addition & 1 deletion templates/inscriptions.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h1>Inscriptions</h1>
<h1>All Inscriptions</h1>
<div class=thumbnails>
%% for id in &self.inscriptions {
{{Iframe::thumbnail(*id)}}
Expand Down
19 changes: 11 additions & 8 deletions templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@
</head>
<body>
<header>
<nav class=links>
<a href=/>Ordinals<sup>{{ self.superscript() }}</sup></a>
<a href=https://docs.ordinals.com/>Handbook</a>
<a href=https://github.com/ordinals/ord>Wallet</a>
<a href=https://discord.com/invite/ordinals>Discord</a>
<a href=/clock>Clock</a>
<nav>
<a href=/ title=home>Ordinals<sup>{{ self.superscript() }}</sup></a>
<a href=/inscriptions title=inscriptions><img class=icon src=/static/images.svg></a>
<a href=/collections title=collections><img class=icon src=/static/diagram-project.svg></a>
<a href=/blocks title=blocks><img class=icon src=/static/cubes.svg></a>
<a href=/clock title=clock><img class=icon src=/static/clock.svg></a>
%% if self.config.index_sats {
<a href=/rare.txt>rare.txt</a>
<a href=/rare.txt title=rare><img class=icon src=/static/gem.svg></a>
%% }
<a href=https://docs.ordinals.com/ title=handbook><img class=icon src=/static/book.svg></a>
<a href=https://github.com/ordinals/ord title=github><img class=icon src=/static/github.svg></a>
<a href=https://discord.com/invite/ordinals title=discord><img class=icon src=/static/discord.svg></a>
<form action=/search method=get>
<input type=text autocapitalize=off autocomplete=off autocorrect=off name=query spellcheck=false>
<input type=submit value=Search>
<input class=icon type=image src=/static/magnifying-glass.svg alt=Search>
</form>
</nav>
</header>
Expand Down
2 changes: 1 addition & 1 deletion tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ fn inscriptions_page() {
TestServer::spawn_with_args(&rpc_server, &[]).assert_response_regex(
"/inscriptions",
format!(
".*<h1>Inscriptions</h1>
".*<h1>All Inscriptions</h1>
<div class=thumbnails>
<a href=/inscription/{inscription}>.*</a>
</div>
Expand Down
Loading