From 40cc56db9b83f99f4c92dfff402dc4867c885f74 Mon Sep 17 00:00:00 2001 From: Pavel Laptev Date: Wed, 28 Feb 2024 13:07:48 +0100 Subject: [PATCH] Added project avatar --- .../src/lib/components/Navigation.svelte | 85 ++++++++++--------- .../src/lib/components/ProjectAvatar.svelte | 69 +++++++++++++++ .../src/lib/components/ProjectSelector.svelte | 53 ++++++------ 3 files changed, 145 insertions(+), 62 deletions(-) create mode 100644 gitbutler-ui/src/lib/components/ProjectAvatar.svelte diff --git a/gitbutler-ui/src/lib/components/Navigation.svelte b/gitbutler-ui/src/lib/components/Navigation.svelte index d59eb042d..8d836c074 100644 --- a/gitbutler-ui/src/lib/components/Navigation.svelte +++ b/gitbutler-ui/src/lib/components/Navigation.svelte @@ -8,7 +8,7 @@ import { navCollapsed } from '$lib/config/config'; import { persisted } from '$lib/persisted/persisted'; import { SETTINGS_CONTEXT, type SettingsStore } from '$lib/settings/userSettings'; - import { platform } from '@tauri-apps/api/os'; + import { type Platform, platform } from '@tauri-apps/api/os'; import { getContext } from 'svelte'; import type { User } from '$lib/backend/cloud'; import type { Project, ProjectService } from '$lib/backend/projects'; @@ -41,11 +41,12 @@ $: isNavCollapsedPersist = navCollapsed(); let isNavCollapsed = $isNavCollapsedPersist; - // Detect is the platform is Mac - let isMacos = false; + // Detect is the platform + let platformName: Platform | undefined; platform().then((name) => { - isMacos = name === 'darwin'; + platformName = name; + console.log('platformName:', platformName); }); // check if resizing @@ -96,24 +97,29 @@ {#if isNavCollapsed}
-
-
-

- {project?.title} -

- - + {#if platformName} + {#if platformName === 'darwin'} +
+ {/if} +
+
+

+ {project?.title} +

+ + +
+
- -
+ {/if}
{:else}
- {#if isMacos} -
- {/if} -