|
| 1 | +<script lang="ts" setup> |
| 2 | +import { computed, ref } from 'vue'; |
| 3 | +import VersionNumber from '../../../model/VersionNumber'; |
| 4 | +import ManagerInformation from '../../../_managerinf/ManagerInformation'; |
| 5 | +import { Hero } from '../../all'; |
| 6 | +import SettingsSection from './SettingsSection.vue'; |
| 7 | +import GameDirectory from './entries/GameDirectory.vue'; |
| 8 | +import DataDirectory from './entries/DataDirectory.vue'; |
| 9 | +import ExportProfile from './entries/ExportProfile.vue'; |
| 10 | +import Theme from './entries/Theme.vue'; |
| 11 | +import ExpandCards from './entries/ExpandCards.vue'; |
| 12 | +import FunkyMode from './entries/FunkyMode.vue'; |
| 13 | +import RefreshOnlineModList from './entries/RefreshOnlineModList.vue'; |
| 14 | +
|
| 15 | +const managerVersionNumber = ref<VersionNumber>(ManagerInformation.VERSION); |
| 16 | +const appName = computed(() => ManagerInformation.APP_NAME); |
| 17 | +
|
| 18 | +const categories = ['All', 'Directories', 'Profile', 'Debugging', 'Modpacks', 'Other'] as const; |
| 19 | +type Category = typeof categories[number]; |
| 20 | +
|
| 21 | +const activeCategory = ref<Category>('All'); |
| 22 | +
|
| 23 | +function isVisible(section: Category): boolean { |
| 24 | + return activeCategory.value === 'All' || activeCategory.value === section; |
| 25 | +} |
| 26 | +</script> |
| 27 | + |
| 28 | +<template> |
| 29 | + <div id="settings-view"> |
| 30 | + <Hero |
| 31 | + title="Settings" |
| 32 | + :subtitle="`Advanced options for ${appName}: ${managerVersionNumber.toString()}`" |
| 33 | + heroType="primary" |
| 34 | + /> |
| 35 | + <div class="settings-shell"> |
| 36 | + <aside class="menu settings-nav"> |
| 37 | + <p class="menu-label">Sections</p> |
| 38 | + <ul class="menu-list"> |
| 39 | + <li v-for="category in categories" :key="category"> |
| 40 | + <a |
| 41 | + :class="{ 'is-active': activeCategory === category }" |
| 42 | + @click="activeCategory = category" |
| 43 | + > |
| 44 | + {{ category }} |
| 45 | + </a> |
| 46 | + </li> |
| 47 | + </ul> |
| 48 | + </aside> |
| 49 | + |
| 50 | + <div class="settings-list"> |
| 51 | + <SettingsSection v-if="isVisible('Directories')" name="Directories"> |
| 52 | + <GameDirectory /> |
| 53 | + <DataDirectory /> |
| 54 | + </SettingsSection> |
| 55 | + |
| 56 | + <SettingsSection v-if="isVisible('Profile')" name="Profile"> |
| 57 | + <ExportProfile /> |
| 58 | + </SettingsSection> |
| 59 | + |
| 60 | + <SettingsSection v-if="isVisible('Other')" name="Other"> |
| 61 | + <Theme /> |
| 62 | + <ExpandCards /> |
| 63 | + <FunkyMode /> |
| 64 | + <RefreshOnlineModList /> |
| 65 | + </SettingsSection> |
| 66 | + </div> |
| 67 | + </div> |
| 68 | + </div> |
| 69 | +</template> |
| 70 | + |
| 71 | +<style lang="scss" scoped> |
| 72 | +#settings-view { |
| 73 | + width: 100%; |
| 74 | + display: flex; |
| 75 | + flex-direction: column; |
| 76 | + flex: 1; |
| 77 | + min-height: 0; |
| 78 | + overflow-y: auto; |
| 79 | +} |
| 80 | +
|
| 81 | +.settings-shell { |
| 82 | + display: flex; |
| 83 | + align-items: flex-start; |
| 84 | + flex: 1 0 auto; |
| 85 | +} |
| 86 | +
|
| 87 | +.settings-nav { |
| 88 | + flex: 0 0 200px; |
| 89 | + padding: 1.25rem 1rem; |
| 90 | + position: sticky; |
| 91 | + top: 0; |
| 92 | + align-self: flex-start; |
| 93 | + max-height: 100vh; |
| 94 | + overflow-y: auto; |
| 95 | +} |
| 96 | +
|
| 97 | +.settings-list { |
| 98 | + flex: 1; |
| 99 | + min-width: 0; |
| 100 | + padding: 1rem 1.25rem 1rem; |
| 101 | +} |
| 102 | +</style> |
0 commit comments