Skip to content

Commit fd5be54

Browse files
committed
chore: more ui improvements
1 parent 791af4c commit fd5be54

File tree

10 files changed

+28
-38
lines changed

10 files changed

+28
-38
lines changed

pnpm-lock.yaml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/src/app.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ async function editContentFile(id: string) {
3535
ui.open(StudioFeature.Content)
3636
}
3737
38-
const colorModeClass = ref(host.ui.colorMode)
39-
40-
host.on.colorModeChange((colorMode) => {
41-
colorModeClass.value = colorMode
42-
})
43-
4438
host.on.mounted(() => {
4539
detectActiveDocuments()
4640
host.on.routeChange(() => {
@@ -59,7 +53,7 @@ router.beforeEach((to, from) => {
5953
</script>
6054

6155
<template>
62-
<div :class="colorModeClass">
56+
<div :class="ui.colorMode.value">
6357
<UApp :toaster="{ portal: false }">
6458
<AppLayout :open="ui.isOpen.value">
6559
<RouterView v-slot="{ Component }">

src/app/src/components/shared/item/ItemActionsToolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const actions = computed(() => {
1212
</script>
1313

1414
<template>
15-
<div class="flex items-center gap-1">
15+
<div class="flex items-center">
1616
<UTooltip
1717
v-for="action in actions"
1818
:key="action.id"

src/app/src/components/shared/item/ItemBadge.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ defineProps({
1616
:color="COLOR_UI_STATUS_MAP[status]"
1717
:label="status"
1818
variant="soft"
19+
size="sm"
1920
/>
2021
</template>

src/app/src/components/shared/item/ItemBreadcrumb.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { computed, unref } from 'vue'
55
import type { TreeItem } from '../../../types'
66
import { useStudio } from '../../../composables/useStudio'
77
import { findParentFromId, ROOT_ITEM } from '../../../utils/tree'
8-
import { FEATURE_DISPLAY_MAP } from '../../../utils/context'
98
import { DraftStatus } from '../../../types/draft'
109
1110
const { context } = useStudio()
@@ -15,7 +14,7 @@ const tree = computed(() => context.featureTree.value.root.value)
1514
1615
const items = computed<BreadcrumbItem[]>(() => {
1716
const rootItem = {
18-
label: FEATURE_DISPLAY_MAP[context.featureTree.value.type as keyof typeof FEATURE_DISPLAY_MAP],
17+
icon: 'i-lucide-folder-git',
1918
onClick: () => {
2019
// TODO: update for ROOT_DOCUMENT_ITEM and ROOT_MEDIA_ITEM
2120
context.featureTree.value.select(ROOT_ITEM)
@@ -70,10 +69,11 @@ const items = computed<BreadcrumbItem[]>(() => {
7069
</script>
7170

7271
<template>
73-
<div class="flex gap-2">
72+
<div class="flex items-center gap-1">
7473
<UBreadcrumb
7574
:items="items"
7675
color="neutral"
76+
:ui="{ link: 'text-xs', list: 'gap-0.5', separatorIcon: 'size-3', linkLeadingIcon: 'size-4' }"
7777
>
7878
<template #ellipsis="{ item }">
7979
<UDropdownMenu :items="item.children">

src/app/src/components/shared/item/ItemCard.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import type { PropType } from 'vue'
44
import { computed } from 'vue'
55
import { Image } from '@unpic/vue'
66
import { titleCase } from 'scule'
7-
import { COLOR_STATUS_MAP } from '../../../utils/draft'
7+
import { COLOR_UI_STATUS_MAP } from '../../../utils/draft'
8+
import { DraftStatus } from '../../../types/draft'
89
910
const props = defineProps({
1011
item: {
@@ -36,20 +37,21 @@ const imageSrc = computed(() => {
3637
return 'https://placehold.co/1920x1080/f9fafc/f9fafc'
3738
})
3839
39-
const statusRingColor = computed(() => props.item.status ? `ring-${COLOR_STATUS_MAP[props.item.status]}-200 hover:ring-${COLOR_STATUS_MAP[props.item.status]}-300 hover:dark:ring-${COLOR_STATUS_MAP[props.item.status]}-700` : 'ring-gray-200 hover:ring-gray-300 hover:dark:ring-gray-700')
40+
// ring-(--ui-success) ring-(--ui-info) ring-(--ui-warning) ring-(--ui-error) ring-(--ui-neutral)
41+
const statusRingColor = computed(() => props.item.status ? `ring-(--ui-${COLOR_UI_STATUS_MAP[props.item.status]})` : 'ring-(--ui-border) hover:ring-(--ui-border-accented)')
4042
</script>
4143

4244
<template>
4345
<UPageCard
4446
reverse
45-
class="cursor-pointer hover:bg-white relative w-full min-w-0 overflow-hidden"
47+
class="cursor-pointer hover:bg-muted relative w-full min-w-0 overflow-hidden"
4648
:class="statusRingColor"
4749
>
4850
<div
4951
v-if="item.type === 'file'"
5052
class="relative"
5153
>
52-
<div class="bg-[#f7f9fa] bg-[linear-gradient(45deg,#e6e9ea_25%,transparent_0),linear-gradient(-45deg,#e6e9ea_25%,transparent_0),linear-gradient(45deg,transparent_75%,#e6e9ea_0),linear-gradient(-45deg,transparent_75%,#e6e9ea_0)] bg-size-[24px_24px] bg-position-[0_0,0_12px,12px_-12px,-12px_0]">
54+
<div class="bg-default bg-[linear-gradient(45deg,#e6e9ea_25%,transparent_0),linear-gradient(-45deg,#e6e9ea_25%,transparent_0),linear-gradient(45deg,transparent_75%,#e6e9ea_0),linear-gradient(-45deg,transparent_75%,#e6e9ea_0)] bg-size-[24px_24px] bg-position-[0_0,0_12px,12px_-12px,-12px_0]">
5355
<Image
5456
:src="imageSrc"
5557
width="426"
@@ -63,12 +65,12 @@ const statusRingColor = computed(() => props.item.status ? `ring-${COLOR_STATUS_
6365
>
6466
<UIcon
6567
:name="itemExtensionIcon"
66-
class="w-8 h-8 text-gray-400 dark:text-gray-500"
68+
class="w-8 h-8 text-muted"
6769
/>
6870
</div>
6971
</div>
7072
<ItemBadge
71-
v-if="item.status"
73+
v-if="item.status && item.status !== DraftStatus.Opened"
7274
:status="item.status"
7375
class="absolute top-2 right-2"
7476
/>
@@ -81,15 +83,15 @@ const statusRingColor = computed(() => props.item.status ? `ring-${COLOR_STATUS_
8183
<UIcon
8284
v-if="isFolder"
8385
name="i-lucide-folder"
84-
class="h-4 w-4 shrink-0"
86+
class="h-4 w-4 shrink-0 text-muted"
8587
/>
8688
<UIcon
8789
v-else-if="name === 'Home'"
8890
name="i-lucide-house"
89-
class="h-4 w-4 shrink-0"
91+
class="h-4 w-4 shrink-0 text-muted"
9092
/>
9193
<h3
92-
class="text-sm font-semibold truncate"
94+
class="text-sm font-semibold truncate text-default"
9395
:class="props.item.status === 'deleted' && 'line-through'"
9496
>
9597
{{ name }}
@@ -99,7 +101,7 @@ const statusRingColor = computed(() => props.item.status ? `ring-${COLOR_STATUS_
99101
</div>
100102

101103
<UTooltip :text="item.routePath">
102-
<span class="truncate leading-relaxed text-xs text-gray-400 dark:text-gray-500 block w-full">
104+
<span class="truncate leading-relaxed text-xs text-dimmed block w-full">
103105
{{ item.routePath || item.fsPath }}
104106
</span>
105107
</UTooltip>

src/app/src/composables/useUI.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export const useUI = createSharedComposable((host: StudioHost) => {
88
const sidebar = useSidebar()
99
const isOpen = ref(false)
1010
const currentPanel = ref<StudioFeature | null>(null)
11+
const colorMode = ref(host.ui.colorMode)
12+
13+
host.on.colorModeChange((newColorMode) => {
14+
colorMode.value = newColorMode
15+
})
1116

1217
watch(isOpen, (value) => {
1318
if (value) {
@@ -20,6 +25,7 @@ export const useUI = createSharedComposable((host: StudioHost) => {
2025

2126
return {
2227
config,
28+
colorMode,
2329
sidebar,
2430
isOpen,
2531
currentPanel,

src/app/src/utils/context.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
import { type StudioAction, StudioFeature, type TreeItem } from '../types'
1+
import { type StudioAction, type TreeItem } from '../types'
22
import { DraftStatus } from '../types/draft'
33
import type { ActionHandlerParams } from '../types/context'
44
import { StudioItemActionId } from '../types/context'
55

6-
export const FEATURE_DISPLAY_MAP = {
7-
[StudioFeature.Content]: '/',
8-
[StudioFeature.Media]: '/',
9-
} as const
10-
116
export const oneStepActions: StudioItemActionId[] = [StudioItemActionId.RevertItem, StudioItemActionId.DeleteItem, StudioItemActionId.DuplicateItem]
127
export const twoStepActions: StudioItemActionId[] = [StudioItemActionId.CreateDocument, StudioItemActionId.CreateFolder, StudioItemActionId.RenameItem]
138

src/app/src/utils/draft.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@ import { type BaseItem, type DatabasePageItem, ContentFileExtension, DraftStatus
22
import { stringify } from 'minimark/stringify'
33
import { ROOT_ITEM } from './tree'
44

5-
export const COLOR_STATUS_MAP: { [key in DraftStatus]?: string } = {
6-
[DraftStatus.Created]: 'green',
7-
[DraftStatus.Updated]: 'orange',
8-
[DraftStatus.Deleted]: 'red',
9-
[DraftStatus.Renamed]: 'blue',
10-
[DraftStatus.Opened]: 'gray',
11-
} as const
12-
135
export const COLOR_UI_STATUS_MAP: { [key in DraftStatus]?: string } = {
146
[DraftStatus.Created]: 'success',
157
[DraftStatus.Updated]: 'warning',

src/app/vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default defineConfig({
2323
},
2424
ui: {
2525
colors: {
26-
neutral: 'zinc',
26+
neutral: 'neutral',
2727
},
2828
pageCard: {
2929
slots: {

0 commit comments

Comments
 (0)