Skip to content

Commit

Permalink
some ui fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alpetric committed Jan 10, 2025
1 parent 7974f55 commit 60523fa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
24 changes: 18 additions & 6 deletions frontend/src/lib/components/settings/ChangeWorkspaceColor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,21 @@
import Toggle from '$lib/components/Toggle.svelte'
let colorEnabled = false
let workspaceColor = $usersWorkspaceStore?.workspaces.find(w => w.id === $workspaceStore)?.color
let workspaceColor: string | undefined = undefined
let savedWorkspaceColor: string | undefined = undefined
let lastWorkspace: string | undefined = undefined
export let open = false
$: if ($usersWorkspaceStore && $workspaceStore !== lastWorkspace) {
lastWorkspace = $workspaceStore
savedWorkspaceColor = $usersWorkspaceStore.workspaces.find(
(w) => w.id === $workspaceStore
)?.color
workspaceColor = savedWorkspaceColor
}
$: colorEnabled = !!workspaceColor
$: if (colorEnabled && !workspaceColor) generateRandomColor()
function generateRandomColor() {
Expand All @@ -34,19 +45,18 @@
})
usersWorkspaceStore.set(await WorkspaceService.listUserWorkspaces())
workspaceColor = colorToSave
savedWorkspaceColor = colorToSave
sendUserToast(`Workspace color updated.`)
}
</script>

<div>
<p class="font-semibold text-sm">Workspace Color</p>
<div class="flex flex-row gap-0.5 items-center">
{#if workspaceColor}
{#if savedWorkspaceColor}
<div
class="w-5 h-5 rounded-full border border-gray-300 dark:border-gray-600"
style="background-color: {workspaceColor}"
style="background-color: {savedWorkspaceColor}"
/>
{:else}
<span class="text-xs text-secondary">No color set</span>
Expand All @@ -72,7 +82,9 @@
<span class="text-secondary text-sm">Workspace color</span>
<div class="flex items-center gap-2">
<Toggle bind:checked={colorEnabled} options={{ right: 'Enable' }} />
<input class="w-10" type="color" bind:value={workspaceColor} disabled={!colorEnabled} />
{#if colorEnabled}
<input class="w-10" type="color" bind:value={workspaceColor} disabled={!colorEnabled} />
{/if}
<input
type="text"
class="w-24 text-sm"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/components/sidebar/WorkspaceMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
await toggleSwitchWorkspace(workspace.id)
}}
>
<div class="flex items-center justify-between">
<div class="flex items-center justify-between min-w-0 w-full">
<div>
<div class="text-primary pl-4 truncate text-left text-[1.2em]">{workspace.name}</div>
<div class="text-tertiary font-mono pl-4 text-2xs whitespace-nowrap truncate text-left">
Expand Down

0 comments on commit 60523fa

Please sign in to comment.