-
Notifications
You must be signed in to change notification settings - Fork 0
(feat) sidebar #77
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
Merged
Merged
(feat) sidebar #77
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cd96015
added sidebar
benjaminstrasser f3b2461
Sidebar is collapsable
benjaminstrasser e3cb4ea
Sidebar state is now synced with localstorage
benjaminstrasser d4a5884
Changed sidebar communciation to use load functions
benjaminstrasser 66564af
Moved Sidebar into component
benjaminstrasser 8ed583e
Added profile page
benjaminstrasser d9e4ba0
redirect signed in users to /projects + after sign in
benjaminstrasser 58fa35e
added lang postcss to style stags using @apply
benjaminstrasser b1cf740
added localStorageWritable to sidebar
benjaminstrasser c1fc0c6
fixed bug where themeselector navigated to profile page
benjaminstrasser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import Sidebar from './sidebar.svelte' | ||
|
|
||
| export type NavigationElement = { | ||
| name: string | ||
| icon: ConstructorOfATypedSvelteComponent | ||
| route: string | ||
| } | ||
|
|
||
| export { Sidebar } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| <script lang="ts"> | ||
| import type { NavigationElement } from '.' | ||
| import { page } from '$app/stores' | ||
| import { ThemeSelector } from '$components/ui/theme-selector' | ||
|
|
||
| import ChevronLeft from 'lucide-svelte/icons/chevron-left' | ||
| import ChevronRight from 'lucide-svelte/icons/chevron-right' | ||
| import { localStorageWritable } from '$lib/utils/localstorage-writable' | ||
|
|
||
| export let sidebarElements: NavigationElement[] = [] | ||
|
|
||
| const collapsedSidebar = localStorageWritable('collapsedSidebar', false) | ||
| </script> | ||
|
|
||
| <div | ||
| class:collapsedSidebar={$collapsedSidebar} | ||
| class="duration-400 flex h-full w-80 flex-none flex-col bg-secondary text-secondary-foreground transition-all ease-in-out" | ||
| > | ||
| <!-- Top Section --> | ||
| <div class="m-8 mb-6 mr-0 flex items-center text-2xl"> | ||
| <div>⌘</div> | ||
| <div class="ml-2 overflow-hidden whitespace-nowrap" class:collapsedElement={$collapsedSidebar}> | ||
| Tiny-TMS | ||
| </div> | ||
| <button | ||
| on:click={() => ($collapsedSidebar = !$collapsedSidebar)} | ||
| class="ml-auto mr-2 cursor-pointer rounded-full hover:bg-primary-foreground" | ||
| > | ||
| {#if $collapsedSidebar} | ||
| <ChevronRight /> | ||
| {:else} | ||
| <ChevronLeft /> | ||
| {/if} | ||
| </button> | ||
| </div> | ||
|
|
||
| <div class="mx-4 flex-grow"> | ||
| {#each sidebarElements as element} | ||
| <a | ||
| href={element.route} | ||
| class="flex cursor-pointer rounded-lg border border-transparent p-4 hover:border-primary" | ||
| class:selected={$page.url.pathname.endsWith(element.route)} | ||
| > | ||
| <svelte:component this={element.icon} class="min-h-6 min-w-6"></svelte:component> | ||
| <div | ||
| class="ml-2 overflow-hidden whitespace-nowrap" | ||
| class:collapsedElement={$collapsedSidebar} | ||
| > | ||
| {element.name} | ||
| </div> | ||
| </a> | ||
| {/each} | ||
| </div> | ||
|
|
||
| <div class="m-4 mt-auto flex items-center justify-between"> | ||
| <a class="flex items-center" href="/profile"> | ||
| <div class="ml-4 mr-2.5 min-h-8 min-w-8 rounded-full bg-yellow-300"></div> | ||
| <div class:collapsedElement={$collapsedSidebar} class="overflow-hidden whitespace-nowrap"> | ||
| My Account | ||
| </div> | ||
| </a> | ||
| <div class:collapsedElement={$collapsedSidebar} class="overflow-hidden"> | ||
| <ThemeSelector /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <style lang="postcss"> | ||
| .collapsedElement { | ||
| display: none; | ||
| } | ||
|
|
||
| .collapsedSidebar { | ||
| @apply w-[90px]; | ||
| } | ||
| .selected { | ||
| @apply bg-primary-foreground; | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,5 +48,7 @@ | |
| </div> | ||
| </div> | ||
|
|
||
| <div class="my-auto w-1/2"><slot></slot></div> | ||
| <div class="my-auto w-1/2"> | ||
| <slot /> | ||
| </div> | ||
| </div> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <script lang="ts"> | ||
| import { Sidebar } from '$components/sidebar' | ||
| import { page } from '$app/stores' | ||
| </script> | ||
|
|
||
| <div class="flex h-full"> | ||
| <Sidebar sidebarElements={$page.data.sidebarElements} /> | ||
| <slot /> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import List from 'lucide-svelte/icons/list' | ||
| import type { LayoutLoad } from './$types' | ||
|
|
||
| export const load: LayoutLoad = () => { | ||
| const sidebarElements = [ | ||
| { | ||
| name: 'My Projects', | ||
| route: '/projects', | ||
| icon: List | ||
| } | ||
| ] | ||
|
|
||
| return { | ||
| sidebarElements | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Projects | ||
benjaminstrasser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import ArrowBigLeft from 'lucide-svelte/icons/arrow-big-left' | ||
| import ClipboardType from 'lucide-svelte/icons/clipboard-type' | ||
| import FileKey from 'lucide-svelte/icons/file-key' | ||
| import Languages from 'lucide-svelte/icons/languages' | ||
| import Settings from 'lucide-svelte/icons/settings' | ||
| import type { LayoutLoad } from './$types' | ||
|
|
||
| export const load: LayoutLoad = () => { | ||
| const sidebarElements = [ | ||
benjaminstrasser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| name: 'My Projects', | ||
| route: '/projects', | ||
| icon: ArrowBigLeft | ||
| }, | ||
| { | ||
| name: 'Translations', | ||
| route: 'translations', | ||
| icon: ClipboardType | ||
| }, | ||
| { | ||
| name: 'Keys', | ||
| route: 'keys', | ||
| icon: FileKey | ||
| }, | ||
| { | ||
| name: 'Languages', | ||
| route: 'languages', | ||
| icon: Languages | ||
| }, | ||
| { | ||
| name: 'Settings', | ||
| route: 'settings', | ||
| icon: Settings | ||
| } | ||
| ] | ||
|
|
||
| return { | ||
| sidebarElements | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| keys |
1 change: 1 addition & 0 deletions
1
src/routes/(authenticated)/projects/[id]/languages/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| languages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| settings |
1 change: 1 addition & 0 deletions
1
src/routes/(authenticated)/projects/[id]/translations/+page.svelte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Translation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| </script> | ||
|
|
||
| <main class="h-screen w-screen"> | ||
| <slot></slot> | ||
| <slot /> | ||
|
|
||
| <Toaster /> | ||
| </main> | ||
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.