mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-31 01:24:37 +02:00
add quick settings buttons in footer
This commit is contained in:
parent
85ace035f2
commit
dc2ba8e724
@ -4,9 +4,11 @@
|
|||||||
<div class="flex flex-row items-center px-4 py-2">
|
<div class="flex flex-row items-center px-4 py-2">
|
||||||
<div class="text-sm" v-html="routerViewFooterText"></div>
|
<div class="text-sm" v-html="routerViewFooterText"></div>
|
||||||
<div class="grow" />
|
<div class="grow" />
|
||||||
|
<div id="footer-buttons" class="flex flex-row-reverse gap-buttons">
|
||||||
<SettingsMenu />
|
<SettingsMenu />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<Notifications :notificationFIFO="notificationFIFO" ref="notifications" />
|
<Notifications :notificationFIFO="notificationFIFO" ref="notifications" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -21,6 +23,9 @@ const props = defineProps({ notificationFIFO: FIFO });
|
|||||||
|
|
||||||
const providesValid = ref(false);
|
const providesValid = ref(false);
|
||||||
|
|
||||||
|
const darkMode = ref(false);
|
||||||
|
provide('darkModeInjectionKey', darkMode);
|
||||||
|
|
||||||
const notifications = ref();
|
const notifications = ref();
|
||||||
provide(notificationsInjectionKey, notifications);
|
provide(notificationsInjectionKey, notifications);
|
||||||
|
|
||||||
|
23
navigator/src/components/IconToggle.vue
Normal file
23
navigator/src/components/IconToggle.vue
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<template>
|
||||||
|
<button @click="$emit('update:modelValue', modelValue === trueValue ? falseValue: trueValue)">
|
||||||
|
<slot :value="modelValue === trueValue">
|
||||||
|
|
||||||
|
</slot>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
modelValue: Boolean,
|
||||||
|
trueValue: {
|
||||||
|
required: false,
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
|
falseValue: {
|
||||||
|
required: false,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
@ -73,16 +73,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<Teleport to="#footer-buttons">
|
||||||
|
<IconToggle v-model="darkMode" v-slot="{ value }">
|
||||||
|
<MoonIcon v-if="value" class="size-icon icon-default" />
|
||||||
|
<SunIcon v-else class="size-icon icon-default" />
|
||||||
|
</IconToggle>
|
||||||
|
<IconToggle v-model="settings.directoryView.showHidden" v-slot="{ value }">
|
||||||
|
<EyeIcon v-if="value" class="size-icon icon-default" />
|
||||||
|
<EyeOffIcon v-else class="size-icon icon-default" />
|
||||||
|
</IconToggle>
|
||||||
|
<IconToggle v-model="settings.directoryView.view" trueValue="list" falseValue="grid" v-slot="{ value }">
|
||||||
|
<ViewListIcon v-if="value" class="size-icon icon-default" />
|
||||||
|
<ViewGridIcon v-else class="size-icon icon-default" />
|
||||||
|
</IconToggle>
|
||||||
|
</Teleport>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { inject, ref, reactive, watch, nextTick } from 'vue';
|
import { inject, ref, reactive, watch, nextTick } from 'vue';
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import DirectoryView from "../components/DirectoryView.vue";
|
import DirectoryView from "../components/DirectoryView.vue";
|
||||||
import { useSpawn, errorString, errorStringHTML, canonicalPath } from '@45drives/cockpit-helpers';
|
|
||||||
import PathBreadCrumbs from '../components/PathBreadCrumbs.vue';
|
import PathBreadCrumbs from '../components/PathBreadCrumbs.vue';
|
||||||
import { notificationsInjectionKey, pathHistoryInjectionKey, lastPathStorageKey, settingsInjectionKey } from '../keys';
|
import { notificationsInjectionKey, pathHistoryInjectionKey, lastPathStorageKey, settingsInjectionKey } from '../keys';
|
||||||
import { ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, RefreshIcon, ChevronDownIcon, SearchIcon } from '@heroicons/vue/solid';
|
import { ArrowLeftIcon, ArrowRightIcon, ArrowUpIcon, RefreshIcon, ChevronDownIcon, SearchIcon, SunIcon, MoonIcon, EyeIcon, EyeOffIcon, ViewListIcon, ViewGridIcon } from '@heroicons/vue/solid';
|
||||||
|
import IconToggle from '../components/IconToggle.vue';
|
||||||
|
|
||||||
const encodePartial = (string) =>
|
const encodePartial = (string) =>
|
||||||
encodeURIComponent(string)
|
encodeURIComponent(string)
|
||||||
@ -94,6 +108,7 @@ const encodePartial = (string) =>
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
|
const darkMode = inject('darkModeInjectionKey');
|
||||||
const settings = inject(settingsInjectionKey);
|
const settings = inject(settingsInjectionKey);
|
||||||
const notifications = inject(notificationsInjectionKey);
|
const notifications = inject(notificationsInjectionKey);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
@ -180,6 +195,8 @@ export default {
|
|||||||
return {
|
return {
|
||||||
cockpit,
|
cockpit,
|
||||||
console,
|
console,
|
||||||
|
darkMode,
|
||||||
|
settings,
|
||||||
pathHistory,
|
pathHistory,
|
||||||
directoryViewRef,
|
directoryViewRef,
|
||||||
searchFilterStr,
|
searchFilterStr,
|
||||||
@ -203,6 +220,13 @@ export default {
|
|||||||
RefreshIcon,
|
RefreshIcon,
|
||||||
ChevronDownIcon,
|
ChevronDownIcon,
|
||||||
SearchIcon,
|
SearchIcon,
|
||||||
|
IconToggle,
|
||||||
|
SunIcon,
|
||||||
|
MoonIcon,
|
||||||
|
EyeIcon,
|
||||||
|
EyeOffIcon,
|
||||||
|
ViewListIcon,
|
||||||
|
ViewGridIcon,
|
||||||
},
|
},
|
||||||
emits: [
|
emits: [
|
||||||
'updateFooterText'
|
'updateFooterText'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user