Skip to content

Commit fca72fe

Browse files
Leonardo lig-7844 Make navbar more user friendly (#15)
1 parent eb4f190 commit fca72fe

File tree

8 files changed

+37
-16
lines changed

8 files changed

+37
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
### Changed
1414
- Updated button text to "View sample" in annotation details panel for better clarity.
1515
- Pressing Escape while adding an annotation now cancels add-annotation mode.
16-
16+
- Improved the navbar to display button titles on hover and removed button text on small screens.
1717
### Deprecated
1818

1919
### Removed

lightly_studio_view/e2e/export-annotations.e2e-test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ test.describe('Export Annotations', () => {
66
test('Download annotations export JSON', async ({ page }) => {
77
await gotoFirstPage(page);
88

9-
// Open the Export & Download side panel from the header
10-
await page.getByRole('button', { name: 'Export & Download' }).click();
9+
// Open the Export side panel from the header
10+
await page.getByRole('button', { name: 'Export' }).click();
1111
await expect(page.getByRole('heading', { name: 'Export' })).toBeVisible();
1212

1313
// Switch to the "Samples & Annotations" tab and wait until the anchor has the href

lightly_studio_view/src/lib/components/ExportSamples/ExportSamples.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,14 @@
7979
);
8080
</script>
8181

82-
<Button variant="ghost" class="flex items-center space-x-2" onclick={() => (isOpened = true)}>
82+
<Button
83+
variant="ghost"
84+
class="nav-button flex items-center space-x-2"
85+
onclick={() => (isOpened = true)}
86+
title={'Export'}
87+
>
8388
<Download class="size-4" />
84-
Export & Download
89+
<span>Export</span>
8590
</Button>
8691

8792
<SidePanel

lightly_studio_view/src/lib/components/FewShotClassifier/ClassifiersMenu.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@
120120
<PopoverTrigger>
121121
<Button
122122
variant="ghost"
123-
class="flex items-center space-x-2 {$isDropdownOpen || $selectedSampleIds.size > 0
123+
class="nav-button flex items-center space-x-2 {$isDropdownOpen ||
124+
$selectedSampleIds.size > 0
124125
? 'ring-2 ring-ring'
125126
: ''}"
126127
disabled={$isCreateClassifiersPanelOpen || $isRefineClassifiersPanelOpen}
128+
title={'Classifiers'}
127129
>
128130
<NetworkIcon class="size-4" />
129131
<span>Classifiers</span>

lightly_studio_view/src/lib/components/Header/Header.svelte

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<Button
4848
data-testid="header-reverse-action-button"
4949
variant="outline"
50-
class="flex items-center space-x-2"
50+
class="nav-button flex items-center space-x-2"
5151
title={$reversibleActions[0]
5252
? $reversibleActions[0].description
5353
: 'No action to undo'}
@@ -60,28 +60,40 @@
6060
}}
6161
>
6262
<Undo2 class="size-4" />
63-
Undo
63+
<span>Undo</span>
6464
</Button>
6565
<Button
6666
data-testid="header-editing-mode-button"
67-
class="flex items-center space-x-2"
67+
class="nav-button flex items-center space-x-2"
6868
onclick={() => setIsEditingMode(false)}
69+
title="Finish Editing"
6970
>
7071
<Check class="size-4" />
71-
Finish Editing
72+
<span>Finish Editing</span>
7273
</Button>
7374
{:else}
7475
<Button
7576
data-testid="header-editing-mode-button"
7677
variant="outline"
77-
class="flex items-center space-x-2"
78+
class="nav-button flex items-center space-x-2"
7879
onclick={() => setIsEditingMode(true)}
80+
title="Edit Annotations"
7981
>
8082
<Pencil class="size-4" />
81-
Edit Annotations
83+
<span>Edit Annotations</span>
8284
</Button>
8385
{/if}
8486
</div>
8587
</div>
8688
</div>
8789
</header>
90+
91+
<style>
92+
:global {
93+
@media screen and (max-width: 1300px) {
94+
.nav-button > span {
95+
display: none;
96+
}
97+
}
98+
}
99+
</style>

lightly_studio_view/src/lib/components/NavigationMenu/NavigationMenu.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@
4646
{#each menuItems as { title, href, isSelected, icon: Icon, id } (id)}
4747
<Button
4848
variant="ghost"
49-
class={cn('flex items-center space-x-2', isSelected && 'bg-accent')}
49+
class={cn('nav-button flex items-center space-x-2', isSelected && 'bg-accent')}
5050
data-testid={`navigation-menu-${title.toLowerCase()}`}
5151
{href}
52+
{title}
5253
>
5354
{#if Icon}
5455
<Icon class="size-4" />
5556
{/if}
56-
{title}
57+
<span>{title}</span>
5758
</Button>
5859
{/each}
5960
</div>

lightly_studio_view/src/lib/components/Selection/CreateSelectionDialog.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@
131131

132132
<Button
133133
variant="ghost"
134-
class="flex items-center space-x-2"
134+
class="nav-button flex items-center space-x-2"
135135
onclick={() => (isOpen = true)}
136136
data-testid="selection-dialog-button"
137+
title="Create Selection"
137138
>
138139
<WandSparklesIcon class="size-4" />
139140
<span>Create Selection</span>

lightly_studio_view/src/lib/components/Settings/SettingsDialog.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121

122122
<Dialog.Root bind:open={isOpen}>
123123
<Dialog.Trigger>
124-
<Button variant="outline" class="gap-2">
124+
<Button title="Settings" variant="outline" class="nav-button gap-2">
125125
<SettingsIcon class="h-4 w-4" />
126126
<span>Settings</span>
127127
</Button>

0 commit comments

Comments
 (0)