2024-09-15 14:51:01 -05:00
|
|
|
---
|
2026-11-18 23:38:52 -06:00
|
|
|
import { alias } from "@blitzkit/core";
|
2026-11-17 23:48:31 -06:00
|
|
|
import { GearIcon } from "@radix-ui/react-icons";
|
|
|
|
|
import { api } from "../api/dynamic";
|
2026-11-18 23:26:24 -06:00
|
|
|
import { tools, type Tool } from "../constants/tools";
|
2026-11-17 23:48:31 -06:00
|
|
|
import type { LocaleAcceptorProps } from "../hooks/useLocale";
|
|
|
|
|
import { Logo } from "../icons/Logo";
|
|
|
|
|
import { LinkI18nWrapper } from "./LinkI18nWrapper";
|
|
|
|
|
import { Text } from "./Text";
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-18 23:26:24 -06:00
|
|
|
export type Props = LocaleAcceptorProps & {
|
|
|
|
|
tool: Tool;
|
|
|
|
|
};
|
2025-05-06 21:30:35 -05:00
|
|
|
|
2025-10-22 17:52:01 -05:00
|
|
|
const { locale } = Astro.props;
|
2026-11-17 23:48:31 -06:00
|
|
|
|
|
|
|
|
const strings = await api.strings(locale);
|
|
|
|
|
|
2026-11-18 23:26:24 -06:00
|
|
|
export const filtered = Object.values(tools).filter(
|
2026-11-19 11:11:20 -06:00
|
|
|
(tool) => !tool.href && (tool.navbar ?? true) && !tool.disabled,
|
2026-11-17 23:48:31 -06:00
|
|
|
);
|
2024-09-15 14:51:01 -05:00
|
|
|
---
|
|
|
|
|
|
|
|
|
|
<style>
|
2026-11-18 22:31:10 -06:00
|
|
|
#navbar-desktop {
|
2026-11-17 23:48:31 -06:00
|
|
|
--icon-size: 1.5rem;
|
|
|
|
|
--padding: var(--space-4);
|
|
|
|
|
--min-content-width: calc(var(--icon-size) + 2 * var(--padding));
|
2025-05-06 13:29:40 -05:00
|
|
|
|
2026-11-18 22:31:10 -06:00
|
|
|
@media screen and (max-width: 80rem) {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
width: var(--min-content-width);
|
2026-11-18 22:31:10 -06:00
|
|
|
height: 100dvh;
|
|
|
|
|
|
|
|
|
|
position: sticky;
|
|
|
|
|
top: 0;
|
|
|
|
|
|
|
|
|
|
z-index: 1;
|
2025-05-06 13:29:40 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
.expander {
|
|
|
|
|
background-color: var(--gray-1);
|
2025-05-06 13:29:40 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
z-index: 1;
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
position: relative;
|
|
|
|
|
left: 0;
|
2025-04-03 13:00:23 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
2025-10-20 22:13:14 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
box-sizing: border-box;
|
2025-10-20 22:13:14 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
transition-duration: var(--duration-brief);
|
2025-10-20 22:13:14 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
height: 100%;
|
|
|
|
|
width: var(--min-content-width);
|
|
|
|
|
overflow: hidden;
|
2025-04-24 20:07:17 -05:00
|
|
|
|
2026-11-19 10:24:43 -06:00
|
|
|
padding: calc(var(--padding) + 2 * var(--space-2)) var(--padding);
|
|
|
|
|
|
|
|
|
|
border-right: 0 solid var(--gray-4);
|
|
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
&:hover {
|
|
|
|
|
width: fit-content;
|
2026-11-19 10:24:43 -06:00
|
|
|
padding: calc(var(--padding) + 2 * var(--space-2))
|
|
|
|
|
calc(4 * var(--padding));
|
|
|
|
|
|
|
|
|
|
border-right: var(--space-0) solid var(--gray-4);
|
2026-11-17 23:48:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
|
width: var(--icon-size);
|
|
|
|
|
height: var(--icon-size);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.named-link {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: var(--space-3);
|
|
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
|
|
|
width: var(--icon-size);
|
|
|
|
|
height: var(--icon-size);
|
|
|
|
|
|
|
|
|
|
color: var(--gray-11);
|
|
|
|
|
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
|
|
|
|
|
.expander:hover & {
|
|
|
|
|
color: var(--gray-12);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.name {
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
|
|
|
|
.expander:not(:hover) & {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tools {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
gap: var(--space-3);
|
|
|
|
|
|
|
|
|
|
.tool {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: var(--space-3);
|
|
|
|
|
|
|
|
|
|
.logo {
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
|
|
|
|
|
width: var(--icon-size);
|
|
|
|
|
height: var(--icon-size);
|
|
|
|
|
|
2026-11-19 10:24:43 -06:00
|
|
|
filter: opacity(0.75);
|
2026-11-17 23:48:31 -06:00
|
|
|
background-size: cover;
|
|
|
|
|
background-position: center;
|
|
|
|
|
|
|
|
|
|
border-radius: var(--radius-max);
|
|
|
|
|
|
|
|
|
|
.expander:hover & {
|
|
|
|
|
width: calc(2 * var(--icon-size));
|
|
|
|
|
|
2026-11-19 10:24:43 -06:00
|
|
|
filter: opacity(1);
|
2026-11-17 23:48:31 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.overlay {
|
|
|
|
|
position: fixed;
|
|
|
|
|
inset: 0;
|
|
|
|
|
|
|
|
|
|
z-index: 1;
|
|
|
|
|
pointer-events: none;
|
|
|
|
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
|
|
|
|
transition-duration: var(--duration-brief);
|
|
|
|
|
|
2026-11-18 22:31:10 -06:00
|
|
|
#navbar-desktop:hover & {
|
2026-11-17 23:48:31 -06:00
|
|
|
background-color: var(--black-a8);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-15 14:51:01 -05:00
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|
2026-11-18 22:31:10 -06:00
|
|
|
<nav id="navbar-desktop">
|
2026-11-17 23:48:31 -06:00
|
|
|
<div class="overlay" />
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<div class="expander">
|
2026-11-18 23:43:07 -06:00
|
|
|
<LinkI18nWrapper {locale} href="/">
|
2026-11-17 23:48:31 -06:00
|
|
|
<div class="named-link">
|
|
|
|
|
<Logo className="icon" />
|
2026-11-19 10:24:43 -06:00
|
|
|
<Text className="name">{strings.navbar.home}</Text>
|
2026-11-17 23:48:31 -06:00
|
|
|
</div>
|
|
|
|
|
</LinkI18nWrapper>
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<div class="tools">
|
|
|
|
|
{filtered.map((tool) => (
|
|
|
|
|
<>
|
|
|
|
|
<LinkI18nWrapper {locale} href={`/${tool.slug ?? tool.id}`}>
|
|
|
|
|
<div class="tool">
|
|
|
|
|
<div
|
2026-11-18 23:38:52 -06:00
|
|
|
style={`background-image: url(${alias(
|
|
|
|
|
"api",
|
|
|
|
|
`/tools/${tool.id}/banners/thumbnail.webp`,
|
|
|
|
|
)})`}
|
2026-11-17 23:48:31 -06:00
|
|
|
class="logo"
|
|
|
|
|
/>
|
2024-09-15 14:51:01 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<Text className="name">
|
|
|
|
|
{strings.tools[tool.id as keyof typeof strings.tools].name}
|
|
|
|
|
</Text>
|
|
|
|
|
</div>
|
|
|
|
|
</LinkI18nWrapper>
|
|
|
|
|
</>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
2025-04-03 12:45:33 -05:00
|
|
|
|
2026-11-17 23:48:31 -06:00
|
|
|
<LinkI18nWrapper {locale} href="/settings">
|
|
|
|
|
<div class="named-link">
|
|
|
|
|
<GearIcon className="icon" />
|
|
|
|
|
<Text className="name">{strings.navbar.settings}</Text>
|
|
|
|
|
</div>
|
|
|
|
|
</LinkI18nWrapper>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|