Skip to content

Commit 31d5570

Browse files
authored
Rethink use of text accent color in browse toolbar
1 parent 82731f0 commit 31d5570

File tree

13 files changed

+101
-120
lines changed

13 files changed

+101
-120
lines changed

Tekst-API/openapi.json

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14750,12 +14750,6 @@
1475014750
"description": "Show location aliases in browse view",
1475114751
"default": true
1475214752
},
14753-
"browseBarUsesTextColor": {
14754-
"type": "boolean",
14755-
"title": "Browsebarusestextcolor",
14756-
"description": "Use current working text's accent color for browse toolbar",
14757-
"default": false
14758-
},
1475914753
"uiColor": {
1476014754
"type": "string",
1476114755
"format": "color",
@@ -15038,19 +15032,6 @@
1503815032
"description": "Show location aliases in browse view",
1503915033
"optionalNullable": false
1504015034
},
15041-
"browseBarUsesTextColor": {
15042-
"anyOf": [
15043-
{
15044-
"type": "boolean"
15045-
},
15046-
{
15047-
"type": "null"
15048-
}
15049-
],
15050-
"title": "Browsebarusestextcolor",
15051-
"description": "Use current working text's accent color for browse toolbar",
15052-
"optionalNullable": false
15053-
},
1505415035
"uiColor": {
1505515036
"anyOf": [
1505615037
{

Tekst-API/tekst/models/platform.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,6 @@ class PlatformState(ModelBase, ModelFactoryMixin):
200200
),
201201
] = True
202202

203-
browse_bar_uses_text_color: Annotated[
204-
bool,
205-
Field(
206-
description="Use current working text's accent color for browse toolbar",
207-
),
208-
] = False
209-
210203
ui_color: Annotated[
211204
Color,
212205
ColorSerializer,

Tekst-Web/i18n/ui/deDE.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ models:
363363
showResourceCategoryHeadings: Zeige Überschriften für Kategorien
364364
prioritizeBrowseLevelResources: Platziere Ressourcen der aktuellen Ebene vor anderen (innerhalb ihrer Kategorien)
365365
showLocationAliases: Zeige Belegstellen-Aliase
366-
browseBarUsesTextColor: Färbe Toolbar der Lese-Ansicht in der Farbe des aktuellen Arbeitstextes
367366
denyResourceTypes: Erstellung dieser Ressourcentypen nur Administratoren erlauben
368367
fonts: Benutzer*innendefinierte Schritarten
369368
uiFont: UI-Schriftart

Tekst-Web/i18n/ui/enUS.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ models:
359359
showResourceCategoryHeadings: Show category headings
360360
prioritizeBrowseLevelResources: Place resources of current browse level before others (inside their category)
361361
showLocationAliases: Show location aliases
362-
browseBarUsesTextColor: Use current working text's accent color for browse toolbar
363362
denyResourceTypes: Allow creation of these resource types for administrators only
364363
fonts: Custom Fonts
365364
uiFont: User Interface Font

Tekst-Web/src/api/schema.d.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4780,12 +4780,6 @@ export interface components {
47804780
* @default true
47814781
*/
47824782
showLocationAliases: boolean;
4783-
/**
4784-
* Browsebarusestextcolor
4785-
* @description Use current working text's accent color for browse toolbar
4786-
* @default false
4787-
*/
4788-
browseBarUsesTextColor: boolean;
47894783
/**
47904784
* Uicolor
47914785
* Format: color
@@ -4905,11 +4899,6 @@ export interface components {
49054899
* @description Show location aliases in browse view
49064900
*/
49074901
showLocationAliases?: boolean;
4908-
/**
4909-
* Browsebarusestextcolor
4910-
* @description Use current working text's accent color for browse toolbar
4911-
*/
4912-
browseBarUsesTextColor?: boolean;
49134902
/**
49144903
* Uicolor
49154904
* @description Primary color used in for client UI

Tekst-Web/src/components/browse/BookmarksWidget.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useRouter } from 'vue-router';
1515
1616
defineProps<{
1717
buttonSize?: 'small' | 'medium' | 'large';
18+
color?: string;
1819
}>();
1920
2021
const browse = useBrowseStore();
@@ -87,7 +88,7 @@ async function handleWidgetClick() {
8788
<template>
8889
<n-button
8990
quaternary
90-
color="var(--base-color)"
91+
:color="color"
9192
:size="buttonSize"
9293
:focusable="false"
9394
:title="$t('browse.bookmarks.bookmarks')"

Tekst-Web/src/components/browse/BrowseLocationControls.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { ref } from 'vue';
1414
withDefaults(
1515
defineProps<{
1616
buttonSize?: 'small' | 'medium' | 'large';
17+
color?: string;
1718
}>(),
1819
{
1920
buttonSize: 'large',
@@ -54,7 +55,7 @@ whenever(ArrowRight, () => {
5455
<n-flex justify="space-between" align="center" :wrap="false">
5556
<n-button
5657
quaternary
57-
color="var(--base-color)"
58+
:color="color"
5859
:focusable="false"
5960
:title="$t('browse.toolbar.tipPreviousLocation')"
6061
:size="buttonSize"
@@ -70,7 +71,7 @@ whenever(ArrowRight, () => {
7071
<n-badge value="!" :show="!browse.isOnDefaultLevel && !browse.loadingLocationData">
7172
<n-button
7273
quaternary
73-
color="var(--base-color)"
74+
:color="color"
7475
:title="
7576
$t('browse.toolbar.tipSelectLocation') +
7677
(!browse.isOnDefaultLevel ? ' (' + $t('browse.toolbar.tipNotOnDefaultLevel') + ')' : '')
@@ -86,11 +87,11 @@ whenever(ArrowRight, () => {
8687
</n-button>
8788
</n-badge>
8889

89-
<bookmarks-widget v-if="!!auth.user" :button-size="buttonSize" />
90+
<bookmarks-widget v-if="!!auth.user" :button-size="buttonSize" :color="color" />
9091

9192
<n-button
9293
quaternary
93-
color="var(--base-color)"
94+
:color="color"
9495
:focusable="false"
9596
:title="$t('browse.toolbar.tipNextLocation')"
9697
:size="buttonSize"

Tekst-Web/src/components/browse/BrowseSearchResultsToolbar.vue

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
SkipNextIcon,
99
SkipPreviousIcon,
1010
} from '@/icons';
11-
import { useBrowseStore, useSearchStore, useStateStore, useThemeStore } from '@/stores';
11+
import { useBrowseStore, useSearchStore, useThemeStore } from '@/stores';
1212
import { NBadge, NButton, NFlex, NIcon } from 'naive-ui';
1313
import { computed, onMounted } from 'vue';
1414
@@ -22,17 +22,10 @@ withDefaults(
2222
}
2323
);
2424
25-
const state = useStateStore();
2625
const browse = useBrowseStore();
2726
const search = useSearchStore();
2827
const theme = useThemeStore();
2928
30-
const bgColor = computed(() =>
31-
!!state.pf?.state.browseBarUsesTextColor
32-
? theme.getTextColors().fade4
33-
: 'var(--primary-color-fade4)'
34-
);
35-
3629
const resultNo = computed(
3730
() =>
3831
search.settingsGeneral.pgn.pgs * (search.settingsGeneral.pgn.pg - 1) +
@@ -44,6 +37,8 @@ const viewingSearchResult = computed(
4437
() => search.browseCurrHit?.id === browse.locationPathHead?.id
4538
);
4639
40+
const toolbarTxtColor = computed(() => (theme.dark ? '#fff' : '#333'));
41+
4742
async function skip(direction: 'previous' | 'next') {
4843
await search.browseSkipTo(direction);
4944
if (search.browseHitResourcesActive) {
@@ -83,12 +78,13 @@ onMounted(() => {
8378
align="center"
8479
:wrap="false"
8580
class="bsr-toolbar"
86-
:style="{ backgroundColor: bgColor }"
81+
:style="{ backgroundColor: theme.dark ? '#444' : '#c5c5c5' }"
8782
>
8883
<n-flex :wrap="false">
8984
<!-- skip to previous search result -->
9085
<n-button
9186
quaternary
87+
:color="toolbarTxtColor"
9288
:size="buttonSize"
9389
:title="$t('search.results.browsePrev')"
9490
:focusable="false"
@@ -103,6 +99,7 @@ onMounted(() => {
10399
<!-- go to search results -->
104100
<n-button
105101
quaternary
102+
:color="toolbarTxtColor"
106103
:size="buttonSize"
107104
:title="$t('search.results.heading')"
108105
:focusable="false"
@@ -117,6 +114,7 @@ onMounted(() => {
117114
<!-- skip to next search result -->
118115
<n-button
119116
quaternary
117+
:color="toolbarTxtColor"
120118
:size="buttonSize"
121119
:title="$t('search.results.browseNext')"
122120
:focusable="false"
@@ -137,6 +135,7 @@ onMounted(() => {
137135
align="center"
138136
:wrap="false"
139137
class="bsr-toolbar-middle text-small"
138+
:style="{ color: toolbarTxtColor }"
140139
>
141140
<n-flex
142141
v-if="!search.loading"
@@ -167,6 +166,7 @@ onMounted(() => {
167166
<n-button
168167
:quaternary="!search.browseHitResourcesActive"
169168
:tertiary="search.browseHitResourcesActive"
169+
:color="toolbarTxtColor"
170170
:size="buttonSize"
171171
:title="$t('search.results.browseHitResourcesActive')"
172172
:focusable="false"
@@ -181,6 +181,7 @@ onMounted(() => {
181181
<!-- stop browsing search results -->
182182
<n-button
183183
quaternary
184+
:color="toolbarTxtColor"
184185
:size="buttonSize"
185186
:title="$t('search.results.browseStop')"
186187
:focusable="false"
@@ -202,7 +203,7 @@ onMounted(() => {
202203
}
203204
204205
.bsr-toolbar {
205-
padding: var(--gap-sm);
206+
padding: var(--gap-sm) var(--gap-md);
206207
border-bottom-left-radius: var(--border-radius);
207208
border-bottom-right-radius: var(--border-radius);
208209
}

Tekst-Web/src/components/browse/BrowseToolbar.vue

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ const browse = useBrowseStore();
1212
const search = useSearchStore();
1313
const theme = useThemeStore();
1414
15-
const bgColor = computed(() =>
16-
!!state.pf?.state.browseBarUsesTextColor ? theme.getTextColors().base : 'var(--primary-color)'
17-
);
1815
const affixRef = ref();
16+
const affixed = ref(false);
17+
18+
const toolbarTxtColor = computed(() => (theme.dark ? '#fff' : '#333'));
19+
1920
const resourcesCount = computed(
2021
() => browse.resourcesCategorized.map((c) => c.resources).flat().length
2122
);
@@ -34,7 +35,10 @@ onMounted(() => {
3435
nextTick(() => {
3536
if (affixRef.value) {
3637
new IntersectionObserver(
37-
([e]) => e.target.classList.toggle('affixed', e.intersectionRatio < 1),
38+
([e]) => {
39+
affixed.value = e.intersectionRatio < 1;
40+
e.target.classList.toggle('affixed', affixed.value);
41+
},
3842
{ threshold: [1] }
3943
).observe(affixRef.value);
4044
}
@@ -57,22 +61,35 @@ const buttonSize = computed(() => (state.smallScreen ? 'small' : 'large'));
5761
justify="space-between"
5862
align="center"
5963
class="browse-toolbar"
60-
:style="{ backgroundColor: bgColor }"
64+
:style="{ backgroundColor: theme.dark ? '#555' : '#d5d5d5' }"
6165
>
62-
<browse-location-controls :button-size="buttonSize" data-tour-key="browseNav" />
63-
64-
<div v-if="!state.smallScreen" class="browse-toolbar-middle browse-location-label text-small">
66+
<browse-location-controls
67+
:button-size="buttonSize"
68+
:color="toolbarTxtColor"
69+
data-tour-key="browseNav"
70+
/>
71+
72+
<div
73+
v-if="!state.smallScreen"
74+
class="browse-toolbar-middle browse-location-label"
75+
:style="{ color: toolbarTxtColor }"
76+
:title="affixed ? state.text?.title : undefined"
77+
>
6578
<n-flex justify="center" align="center" :wrap="false">
66-
<b style="text-align: center">{{ state.text?.title || '???' }}</b>
79+
<div
80+
class="text-color-indicator"
81+
:style="{ backgroundColor: theme.getTextColors().base }"
82+
></div>
83+
<span v-if="!affixed">{{ state.text?.title || '???' }}</span>
84+
<span v-else><location-label /></span>
6785
</n-flex>
68-
<div><location-label /></div>
6986
</div>
7087

7188
<div class="browse-toolbar-end">
7289
<n-badge dot :offset="[-2, 5]" :show="browse.focusView">
7390
<n-button
7491
quaternary
75-
color="var(--base-color)"
92+
:color="toolbarTxtColor"
7693
:style="{
7794
backgroundColor: browse.focusView ? 'var(--base-color-translucent)' : undefined,
7895
}"
@@ -96,7 +113,7 @@ const buttonSize = computed(() => (state.smallScreen ? 'small' : 'large'));
96113
>
97114
<n-button
98115
quaternary
99-
color="var(--base-color)"
116+
:color="toolbarTxtColor"
100117
:size="buttonSize"
101118
:title="$t('browse.toolbar.tipOpenResourceList')"
102119
:focusable="false"
@@ -178,9 +195,10 @@ const buttonSize = computed(() => (state.smallScreen ? 'small' : 'large'));
178195
max-width: var(--max-app-width);
179196
}
180197
181-
.browse-toolbar .browse-location-label {
182-
visibility: hidden;
183-
color: var(--base-color);
198+
.browse-toolbar .browse-location-label .text-color-indicator {
199+
width: 16px;
200+
height: 16px;
201+
border-radius: 50%;
184202
}
185203
186204
.browse-toolbar-container.affixed .browse-location-label {

0 commit comments

Comments
 (0)