2025-05-25 14:48:53 +00:00
|
|
|
import { OptionalApp, User } from '/lib/types.ts';
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
import { capitalizeWord } from '/public/ts/utils/misc.ts';
|
2024-03-16 08:40:24 +00:00
|
|
|
|
|
|
|
|
interface Data {
|
|
|
|
|
route: string;
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
user?: User | null;
|
2025-05-25 14:48:53 +00:00
|
|
|
enabledApps: OptionalApp[];
|
2024-03-16 08:40:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface MenuItem {
|
|
|
|
|
url: string;
|
|
|
|
|
label: string;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-25 14:48:53 +00:00
|
|
|
export default function Header({ route, user, enabledApps }: Data) {
|
2024-03-16 08:40:24 +00:00
|
|
|
const activeClass = 'bg-slate-800 text-white rounded-md px-3 py-2 text-sm font-medium';
|
|
|
|
|
const defaultClass = 'text-slate-300 hover:bg-slate-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium';
|
|
|
|
|
|
|
|
|
|
const mobileActiveClass = 'bg-slate-800 text-white block rounded-md px-3 py-2 text-base font-medium';
|
|
|
|
|
const mobileDefaultClass =
|
|
|
|
|
'text-slate-300 hover:bg-slate-700 hover:text-white block rounded-md px-3 py-2 text-base font-medium';
|
|
|
|
|
|
|
|
|
|
const iconWidthAndHeightInPixels = 20;
|
|
|
|
|
|
2025-12-01 12:25:21 +00:00
|
|
|
const potentialMenuItems: (MenuItem | null)[] = enabledApps.map((app) => ({
|
|
|
|
|
url: `/${app}`,
|
|
|
|
|
label: capitalizeWord(app),
|
|
|
|
|
}));
|
2024-03-16 08:40:24 +00:00
|
|
|
|
2024-05-01 08:21:30 +00:00
|
|
|
const menuItems = potentialMenuItems.filter(Boolean) as MenuItem[];
|
|
|
|
|
|
2025-12-08 09:17:42 +00:00
|
|
|
if (user && !route.startsWith('/file-share')) {
|
2024-03-16 08:40:24 +00:00
|
|
|
const activeMenu = menuItems.find((menu) => route.startsWith(menu.url));
|
|
|
|
|
|
|
|
|
|
let pageLabel = activeMenu?.label || '404 - Page not found';
|
|
|
|
|
|
|
|
|
|
if (route.startsWith('/news/feeds')) {
|
|
|
|
|
pageLabel = 'News feeds';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (route.startsWith('/settings')) {
|
|
|
|
|
pageLabel = 'Settings';
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-26 17:43:53 +00:00
|
|
|
if (route.startsWith('/expenses')) {
|
|
|
|
|
pageLabel = 'Budgets & Expenses';
|
|
|
|
|
}
|
|
|
|
|
|
Basic CardDav UI (Contacts)
This implements a basic CardDav UI, titled "Contacts". It allows creating new contacts with a first name + last name, and editing their first and last names, main email, main phone, and notes.
You can also import and export VCF (VCARD) files.
It also allows editing the VCARD directly, for power users.
Additionally, you can choose, create, or delete address books, and if there's no address book created yet in your CardDav server (first-time setup), it'll automatically create one, titled "Contacts".
Finally, there are some dependency updates and a fix for the config not allowing disabling the `cardDav` or the `calDav` server.
Related to #56
2025-08-10 06:48:16 +00:00
|
|
|
if (route.startsWith('/contacts')) {
|
|
|
|
|
pageLabel = 'Contacts';
|
|
|
|
|
}
|
|
|
|
|
|
Basic CalDav UI (Calendar)
This implements a basic CalDav UI, titled "Calendar". It allows creating new calendars and events with a start and end date, URL, location, and description.
You can also import and export ICS (VCALENDAR + VEVENT) files.
It allows editing the ICS directly, for power users.
Additionally, you can hide/display events from certain calendars, change their names and their colors. If there's no calendar created yet in your CalDav server (first-time setup), it'll automatically create one, titled "Calendar".
You can also change the display timezone for the calendar from the settings.
Finally, there's some minor documentation fixes and some other minor tweaks.
Closes #56
Closes #89
2025-09-06 11:46:13 +00:00
|
|
|
if (route.startsWith('/calendar')) {
|
|
|
|
|
pageLabel = 'Calendar';
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-16 08:40:24 +00:00
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<nav class='bg-slate-950'>
|
|
|
|
|
<div class='mx-auto max-w-7xl px-4 sm:px-6 lg:px-8'>
|
|
|
|
|
<div class='flex h-16 items-center justify-between'>
|
|
|
|
|
<div class='flex items-center'>
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
<div class='shrink-0'>
|
2024-03-16 08:40:24 +00:00
|
|
|
<a href='/'>
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
<img
|
|
|
|
|
class='h-12 w-12 drop-shadow-md'
|
|
|
|
|
src='/public/images/logomark.svg'
|
|
|
|
|
alt='a stylized blue cloud'
|
|
|
|
|
/>
|
2024-03-16 08:40:24 +00:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<div class='hidden md:block'>
|
|
|
|
|
<div class='ml-10 flex items-center space-x-4'>
|
|
|
|
|
{menuItems.map((menu) => (
|
|
|
|
|
<a href={menu.url} class={route.startsWith(menu.url) ? activeClass : defaultClass}>
|
|
|
|
|
<img
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
src={`/public/images${menu.url}${'.svg'}`}
|
2024-03-16 08:40:24 +00:00
|
|
|
alt={menu.label}
|
|
|
|
|
title={menu.label}
|
|
|
|
|
width={iconWidthAndHeightInPixels}
|
|
|
|
|
height={iconWidthAndHeightInPixels}
|
|
|
|
|
class='white'
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class='ml-4 flex items-center md:ml-6'>
|
|
|
|
|
<div class='ml-10 flex items-center space-x-4'>
|
|
|
|
|
<span class='mx-2 text-white text-sm'>{user.email}</span>
|
|
|
|
|
<a
|
|
|
|
|
href='/settings'
|
|
|
|
|
class={route.startsWith('/settings') ? activeClass : defaultClass}
|
|
|
|
|
>
|
|
|
|
|
<img
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
src='/public/images/settings.svg'
|
2024-03-16 08:40:24 +00:00
|
|
|
alt='Settings'
|
|
|
|
|
title='Settings'
|
|
|
|
|
width={iconWidthAndHeightInPixels}
|
|
|
|
|
height={iconWidthAndHeightInPixels}
|
|
|
|
|
class='white'
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
<a
|
|
|
|
|
href='/logout'
|
|
|
|
|
class={defaultClass}
|
|
|
|
|
>
|
|
|
|
|
<img
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
src='/public/images/logout.svg'
|
2024-03-16 08:40:24 +00:00
|
|
|
alt='Logout'
|
|
|
|
|
title='Logout'
|
|
|
|
|
width={iconWidthAndHeightInPixels}
|
|
|
|
|
height={iconWidthAndHeightInPixels}
|
|
|
|
|
class='white'
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class='md:hidden' id='mobile-menu'>
|
|
|
|
|
<div class='space-y-1 px-2 pb-3 pt-2 sm:px-3'>
|
|
|
|
|
{menuItems.map((menu) => (
|
|
|
|
|
<a href={menu.url} class={route.startsWith(menu.url) ? mobileActiveClass : mobileDefaultClass}>
|
|
|
|
|
{menu.label}
|
|
|
|
|
</a>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<header class='bg-gray-900 shadow-md'>
|
|
|
|
|
<div class='mx-auto max-w-7xl px-4 py-6 sm:px-6 lg:px-8'>
|
|
|
|
|
<h1 class='text-3xl font-bold tracking-tight text-white'>
|
|
|
|
|
{pageLabel}
|
|
|
|
|
</h1>
|
|
|
|
|
</div>
|
|
|
|
|
</header>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
<header class='px-4 pt-8 pb-2 max-w-3xl mx-auto flex flex-col items-center justify-center'>
|
2024-03-16 08:40:24 +00:00
|
|
|
<a href='/'>
|
|
|
|
|
<img
|
|
|
|
|
class='mt-6 mb-2 drop-shadow-md'
|
Remove fresh
This implements a huge change, where Fresh is removed as a framework and serving files, allowing more control over importing, bundling, and serving files and components.
The biggest challenge was to continue making sure that there weren't too many places to look into for import versions, and `PasswordlessPasskeyLogin.tsx` became a prototype in migrating a component to fully SSR, no need for frontend parsing (via Babel) or bundling (via a custom-script, downloading frontend dependencies from esm.sh). Still, there are too many components to migrate like that, and it's all working, so I likely won't even attempt it unless there's some bug, new feature, or security vulnerability to address that warrants a rewrite of those.
This also updates all dependencies (except `@libs/xml` because that still causes some breaking in DAV endpoints), including Deno!
All other advantages can be seen in the related issues, and the breaking change this (v4.0.0) introduces is related simply to `config.email.tlsMode` (which had a deprecation warning throughout v3), and because, while I tested many things exhaustively, it's not impossible something broke that I didn't see.
Closes #141
Closes #132
2026-02-20 10:54:31 +00:00
|
|
|
src='/public/images/logo-white.svg'
|
2024-03-16 08:40:24 +00:00
|
|
|
width='250'
|
|
|
|
|
height='50'
|
|
|
|
|
alt='the bewCloud logo: a stylized logo'
|
|
|
|
|
/>
|
|
|
|
|
</a>
|
|
|
|
|
</header>
|
|
|
|
|
);
|
|
|
|
|
}
|