A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

Add appBarNav helper for the shared top bar

+40
+20
src/lib/auth/nav.test.ts
··· 1 + import { describe, expect, it } from 'vitest'; 2 + import { appBarNav } from './nav'; 3 + 4 + describe( 'appBarNav', () => { 5 + it( 'links the editor bar back to the dashboard (Publications)', () => { 6 + expect( appBarNav( 'editor' ) ).toEqual( { 7 + href: '/dashboard', 8 + label: 'Publications', 9 + icon: 'publications', 10 + } ); 11 + } ); 12 + 13 + it( 'links the dashboard bar into the editor (Write, feather)', () => { 14 + expect( appBarNav( 'dashboard' ) ).toEqual( { 15 + href: '/editor', 16 + label: 'Write', 17 + icon: 'feather', 18 + } ); 19 + } ); 20 + } );
+20
src/lib/auth/nav.ts
··· 1 + /** The page an AppBar renders on; selects its contextual nav action. */ 2 + export type AppBarContext = 'editor' | 'dashboard'; 3 + 4 + export interface AppBarNav { 5 + href: string; 6 + label: string; 7 + icon: 'feather' | 'publications'; 8 + } 9 + 10 + /** 11 + * The AppBar's single contextual nav action, by the page it renders on: 12 + * editor → back to your publications (the dashboard) 13 + * dashboard → into the editor (a feather "Write") 14 + */ 15 + export function appBarNav( current: AppBarContext ): AppBarNav { 16 + if ( current === 'dashboard' ) { 17 + return { href: '/editor', label: 'Write', icon: 'feather' }; 18 + } 19 + return { href: '/dashboard', label: 'Publications', icon: 'publications' }; 20 + }