|
62 | 62 | :title="formatMessage(messages.changeTheme)" |
63 | 63 | @click="changeTheme" |
64 | 64 | > |
65 | | - <MoonIcon v-if="$colorMode.value === 'light'" aria-hidden="true" /> |
| 65 | + <MoonIcon v-if="$theme.active === 'light'" aria-hidden="true" /> |
66 | 66 | <SunIcon v-else aria-hidden="true" /> |
67 | 67 | </button> |
68 | 68 | <div |
|
242 | 242 | {{ formatMessage(commonMessages.settingsLabel) }} |
243 | 243 | </NuxtLink> |
244 | 244 | <button class="iconified-button" @click="changeTheme"> |
245 | | - <MoonIcon v-if="$colorMode.value === 'light'" class="icon" /> |
| 245 | + <MoonIcon v-if="$theme.active === 'light'" class="icon" /> |
246 | 246 | <SunIcon v-else class="icon" /> |
247 | 247 | <span class="dropdown-item__text"> |
248 | 248 | {{ formatMessage(messages.changeTheme) }} |
|
403 | 403 | {{ formatMessage(messages.getModrinthApp) }} |
404 | 404 | </nuxt-link> |
405 | 405 | <button class="iconified-button raised-button" @click="changeTheme"> |
406 | | - <MoonIcon v-if="$colorMode.value === 'light'" aria-hidden="true" /> |
| 406 | + <MoonIcon v-if="$theme.active === 'light'" aria-hidden="true" /> |
407 | 407 | <SunIcon v-else aria-hidden="true" /> |
408 | 408 | {{ formatMessage(messages.changeTheme) }} |
409 | 409 | </button> |
@@ -449,7 +449,6 @@ import ModalCreation from '~/components/ui/ModalCreation.vue' |
449 | 449 | import Avatar from '~/components/ui/Avatar.vue' |
450 | 450 | import { getProjectTypeMessage } from '~/utils/i18n-project-type.ts' |
451 | 451 | import { commonMessages } from '~/utils/common-messages.ts' |
452 | | -import { DARK_THEMES } from '~/composables/theme.js' |
453 | 452 |
|
454 | 453 | const { formatMessage } = useVIntl() |
455 | 454 |
|
@@ -725,31 +724,28 @@ function runAnalytics() { |
725 | 724 | .catch(() => {}) |
726 | 725 | }) |
727 | 726 | } |
| 727 | +
|
728 | 728 | function toggleMobileMenu() { |
729 | 729 | isMobileMenuOpen.value = !isMobileMenuOpen.value |
730 | 730 | if (isMobileMenuOpen.value) { |
731 | 731 | isBrowseMenuOpen.value = false |
732 | 732 | } |
733 | 733 | } |
| 734 | +
|
734 | 735 | function toggleBrowseMenu() { |
735 | 736 | isBrowseMenuOpen.value = !isBrowseMenuOpen.value |
736 | 737 |
|
737 | 738 | if (isBrowseMenuOpen.value) { |
738 | 739 | isMobileMenuOpen.value = false |
739 | 740 | } |
740 | 741 | } |
741 | | -function changeTheme() { |
742 | | - updateTheme( |
743 | | - DARK_THEMES.includes(app.$colorMode.value) |
744 | | - ? 'light' |
745 | | - : cosmetics.value.preferredDarkTheme ?? 'dark', |
746 | | - true |
747 | | - ) |
748 | | -} |
| 742 | +
|
| 743 | +const $theme = useTheme() |
| 744 | +
|
| 745 | +const changeTheme = () => $theme.cycle() |
749 | 746 |
|
750 | 747 | function hideStagingBanner() { |
751 | 748 | cosmetics.value.hideStagingBanner = true |
752 | | - saveCosmetics() |
753 | 749 | } |
754 | 750 | </script> |
755 | 751 |
|
|
0 commit comments