Skip to content

Commit 366fa1a

Browse files
committed
fix: aligned solution after rebase
1 parent 2a3b13a commit 366fa1a

File tree

16 files changed

+73
-89
lines changed

16 files changed

+73
-89
lines changed

app/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const localeMap = locales.value.reduce(
2222
)
2323
2424
const darkMode = usePreferredDark()
25-
const colorMode = useColorMode()
25+
const { colorMode } = useColorModePreference()
2626
const colorScheme = computed(() => {
2727
return {
2828
system: darkMode ? 'dark light' : 'light dark',

app/components/Chart/SplitSparkline.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const props = defineProps<{
2828
}>()
2929
3030
const { locale } = useI18n()
31-
const colorMode = useColorMode()
31+
const { colorMode } = useColorModePreference()
3232
const resolvedMode = shallowRef<'light' | 'dark'>('light')
3333
const rootEl = shallowRef<HTMLElement | null>(null)
3434
const palette = getPalette('')

app/components/Compare/FacetBarChart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const props = defineProps<{
2424
facetLoading?: boolean
2525
}>()
2626
27-
const colorMode = useColorMode()
27+
const { colorMode } = useColorModePreference()
2828
const resolvedMode = shallowRef<'light' | 'dark'>('light')
2929
const rootEl = shallowRef<HTMLElement | null>(null)
3030
const { width } = useElementSize(rootEl)

app/components/Package/Header.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const diffLink = computed((): RouteLocationRaw | null => {
120120
return diffRoute(props.pkg.name, props.resolvedVersion, props.latestVersion.version)
121121
})
122122
123-
const keyboardShortcuts = useKeyboardShortcuts()
123+
const keyboardShortcuts = useKeyboardShortcutsPreference()
124124
125125
onKeyStroke(
126126
e => keyboardShortcuts.value && isKeyWithoutModifiers(e, '.') && !isEditableElement(e.target),

app/components/Package/TrendsChart.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const { accentColors, selectedAccentColor } = useAccentColor();
6262
const { localSettings } = useUserLocalSettings();
6363
const { copy, copied } = useClipboard();
6464
65-
const colorMode = useColorMode();
65+
const { colorMode } = useColorModePreference();
6666
const resolvedMode = shallowRef<"light" | "dark">("light");
6767
const rootEl = shallowRef<HTMLElement | null>(null);
6868
const isZoomed = shallowRef(false);

app/components/Package/VersionDistribution.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const props = defineProps<{
2121
const { accentColors, selectedAccentColor } = useAccentColor()
2222
const { copy, copied } = useClipboard()
2323
24-
const colorMode = useColorMode()
24+
const { colorMode } = useColorModePreference()
2525
const resolvedMode = shallowRef<'light' | 'dark'>('light')
2626
const rootEl = shallowRef<HTMLElement | null>(null)
2727

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const props = defineProps<{
2020
const router = useRouter()
2121
const route = useRoute()
2222
const { localSettings } = useUserLocalSettings()
23+
const { preferences } = useUserPreferencesState()
2324
2425
const chartModal = useModal('chart-modal')
2526
const hasChartModalTransitioned = shallowRef(false)
@@ -63,7 +64,7 @@ const { fetchPackageDownloadEvolution } = useCharts()
6364
6465
const { accentColors, selectedAccentColor } = useAccentColor()
6566
66-
const colorMode = useColorMode()
67+
const { colorMode } = useColorModePreference()
6768
6869
const resolvedMode = shallowRef<'light' | 'dark'>('light')
6970
@@ -306,7 +307,7 @@ function layEgg() {
306307
showPulse.value = false
307308
nextTick(() => {
308309
showPulse.value = true
309-
settings.value.enableGraphPulseLooping = !settings.value.enableGraphPulseLooping
310+
preferences.value.enableGraphPulseLooping = !preferences.value.enableGraphPulseLooping
310311
playEggPulse()
311312
})
312313
}
@@ -364,7 +365,7 @@ const config = computed<VueUiSparklineConfig>(() => {
364365
color: colors.value.borderHover,
365366
pulse: {
366367
show: showPulse.value, // the pulse will not show if prefers-reduced-motion (enforced by vue-data-ui)
367-
loop: settings.value.enableGraphPulseLooping,
368+
loop: preferences.value.enableGraphPulseLooping,
368369
radius: 1.5,
369370
color: pulseColor.value!,
370371
easing: 'ease-in-out',

app/composables/atproto/useAtproto.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
import type { PublicUserSession } from '#shared/schemas/publicUserSession'
1+
import type { PublicUserSessionSchema } from "#shared/schemas/publicUserSession";
2+
import type { InferOutput } from "valibot";
3+
4+
type User = InferOutput<typeof PublicUserSessionSchema>;
25

36
export interface UseAtprotoReturn {
4-
user: Ref<PublicUserSession | null | undefined>
5-
pending: Ref<boolean>
6-
logout: () => Promise<void>
7+
user: Ref<User | null | undefined>;
8+
pending: Ref<boolean>;
9+
logout: () => Promise<void>;
710
}
811

912
declare global {

app/composables/userPreferences/useAccentColor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import type { AccentColorId } from '#shared/schemas/userPreferences'
33

44
export function useAccentColor() {
55
const { preferences } = useUserPreferencesState()
6-
const colorMode = useColorMode()
6+
const { colorMode } = useColorModePreference()
7+
const { t } = useI18n()
78

89
const accentColors = computed(() => {
910
const isDark = colorMode.value === 'dark'
@@ -12,6 +13,7 @@ export function useAccentColor() {
1213
return Object.entries(colors).map(([id, value]) => ({
1314
id: id as AccentColorId,
1415
name: id,
16+
label: id === 'neutral' ? t('settings.clear_accent') : t(`settings.accent_colors.${id}`),
1517
value,
1618
}))
1719
})

app/composables/userPreferences/useBackgroundTheme.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ import { BACKGROUND_THEMES } from '#shared/utils/constants'
22
import type { BackgroundThemeId } from '#shared/schemas/userPreferences'
33

44
export function useBackgroundTheme() {
5-
const backgroundThemes = Object.entries(BACKGROUND_THEMES).map(([id, value]) => ({
6-
id: id as BackgroundThemeId,
7-
name: id,
8-
value,
9-
}))
10-
115
const { preferences } = useUserPreferencesState()
6+
const { t } = useI18n()
7+
8+
const backgroundThemes = computed(() =>
9+
Object.entries(BACKGROUND_THEMES).map(([id, value]) => ({
10+
id: id as BackgroundThemeId,
11+
name: id,
12+
label: t(`settings.background_themes.${id}`),
13+
value,
14+
})),
15+
)
1216

1317
function setBackgroundTheme(id: BackgroundThemeId | null) {
1418
if (import.meta.server) {

0 commit comments

Comments
 (0)