mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-26 15:14:22 +02:00
🚚 Renames AppButtons to AuthButtons
This commit is contained in:
parent
242dfe61c6
commit
e4d7660712
@ -1,62 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div class="display-options">
|
|
||||||
<IconLogout @click="logout()" v-tooltip="tooltip($t('settings.sign-out-tooltip'))"
|
|
||||||
class="layout-icon" tabindex="-2" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { logout as registerLogout } from '@/utils/Auth';
|
|
||||||
import IconLogout from '@/assets/interface-icons/user-logout.svg';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'AppButtons',
|
|
||||||
components: {
|
|
||||||
IconLogout,
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
logout() {
|
|
||||||
registerLogout();
|
|
||||||
this.$toasted.show(this.$t('login.logout-message'));
|
|
||||||
setTimeout(() => {
|
|
||||||
location.reload(true); // eslint-disable-line no-restricted-globals
|
|
||||||
}, 500);
|
|
||||||
},
|
|
||||||
tooltip(content) {
|
|
||||||
return { content, trigger: 'hover focus', delay: 250 };
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
|
|
||||||
span.options-label {
|
|
||||||
color: var(--settings-text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.display-options {
|
|
||||||
color: var(--settings-text-color);
|
|
||||||
svg {
|
|
||||||
path {
|
|
||||||
fill: var(--settings-text-color);
|
|
||||||
}
|
|
||||||
width: 1rem;
|
|
||||||
height: 1rem;
|
|
||||||
margin: 0.2rem;
|
|
||||||
padding: 0.2rem;
|
|
||||||
text-align: center;
|
|
||||||
background: var(--background);
|
|
||||||
border: 1px solid currentColor;
|
|
||||||
border-radius: var(--curve-factor);
|
|
||||||
cursor: pointer;
|
|
||||||
&:hover, &.selected {
|
|
||||||
background: var(--settings-text-color);
|
|
||||||
path { fill: var(--background); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section>
|
||||||
|
<p>{{ getUserState }}</p>
|
||||||
<SearchBar ref="SearchBar"
|
<SearchBar ref="SearchBar"
|
||||||
@user-is-searchin="userIsTypingSomething"
|
@user-is-searchin="userIsTypingSomething"
|
||||||
v-if="searchVisible"
|
v-if="searchVisible"
|
||||||
@ -13,7 +14,7 @@
|
|||||||
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
|
<ItemSizeSelector :iconSize="iconSize" @iconSizeUpdated="updateIconSize" />
|
||||||
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
|
<ConfigLauncher :sections="sections" :pageInfo="pageInfo" :appConfig="appConfig"
|
||||||
@modalChanged="modalChanged" />
|
@modalChanged="modalChanged" />
|
||||||
<AppButtons v-if="isUserLoggedIn()" />
|
<AuthButtons v-if="getUserState != 'noone'" :userType="getUserState" />
|
||||||
</div>
|
</div>
|
||||||
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
|
<div :class="`show-hide-container ${settingsVisible? 'hide-btn' : 'show-btn'}`">
|
||||||
<button @click="toggleSettingsVisibility()"
|
<button @click="toggleSettingsVisibility()"
|
||||||
@ -34,7 +35,7 @@ import ConfigLauncher from '@/components/Settings/ConfigLauncher';
|
|||||||
import ThemeSelector from '@/components/Settings/ThemeSelector';
|
import ThemeSelector from '@/components/Settings/ThemeSelector';
|
||||||
import LayoutSelector from '@/components/Settings/LayoutSelector';
|
import LayoutSelector from '@/components/Settings/LayoutSelector';
|
||||||
import ItemSizeSelector from '@/components/Settings/ItemSizeSelector';
|
import ItemSizeSelector from '@/components/Settings/ItemSizeSelector';
|
||||||
import AppButtons from '@/components/Settings/AppButtons';
|
import AuthButtons from '@/components/Settings/AuthButtons';
|
||||||
import KeyboardShortcutInfo from '@/components/Settings/KeyboardShortcutInfo';
|
import KeyboardShortcutInfo from '@/components/Settings/KeyboardShortcutInfo';
|
||||||
import AppInfoModal from '@/components/Configuration/AppInfoModal';
|
import AppInfoModal from '@/components/Configuration/AppInfoModal';
|
||||||
import IconOpen from '@/assets/interface-icons/config-open-settings.svg';
|
import IconOpen from '@/assets/interface-icons/config-open-settings.svg';
|
||||||
@ -44,6 +45,8 @@ import {
|
|||||||
visibleComponents as defaultVisibleComponents,
|
visibleComponents as defaultVisibleComponents,
|
||||||
} from '@/utils/defaults';
|
} from '@/utils/defaults';
|
||||||
|
|
||||||
|
import { getUserState } from '@/utils/Auth';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SettingsContainer',
|
name: 'SettingsContainer',
|
||||||
props: {
|
props: {
|
||||||
@ -61,7 +64,7 @@ export default {
|
|||||||
ThemeSelector,
|
ThemeSelector,
|
||||||
LayoutSelector,
|
LayoutSelector,
|
||||||
ItemSizeSelector,
|
ItemSizeSelector,
|
||||||
AppButtons,
|
AuthButtons,
|
||||||
KeyboardShortcutInfo,
|
KeyboardShortcutInfo,
|
||||||
AppInfoModal,
|
AppInfoModal,
|
||||||
IconOpen,
|
IconOpen,
|
||||||
@ -87,9 +90,6 @@ export default {
|
|||||||
getInitialTheme() {
|
getInitialTheme() {
|
||||||
return this.appConfig.theme || '';
|
return this.appConfig.theme || '';
|
||||||
},
|
},
|
||||||
isUserLoggedIn() {
|
|
||||||
return !!localStorage[localStorageKeys.USERNAME];
|
|
||||||
},
|
|
||||||
/* Gets user themes if available */
|
/* Gets user themes if available */
|
||||||
getUserThemes() {
|
getUserThemes() {
|
||||||
const userThemes = this.appConfig.cssThemes || [];
|
const userThemes = this.appConfig.cssThemes || [];
|
||||||
@ -105,6 +105,19 @@ export default {
|
|||||||
|| (this.visibleComponents || defaultVisibleComponents).settings);
|
|| (this.visibleComponents || defaultVisibleComponents).settings);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
/**
|
||||||
|
* Determines which button should display, based on the user type
|
||||||
|
* 0 = Auth not configured, don't show anything
|
||||||
|
* 1 = Auth condifured, and user logged in, show logout button
|
||||||
|
* 2 = Auth configured, guest access enabled, and not logged in, show login
|
||||||
|
* Note that if auth is enabled, but not guest access, and user not logged in,
|
||||||
|
* then they will never be able to view the homepage, so no button needed
|
||||||
|
*/
|
||||||
|
getUserState() {
|
||||||
|
return getUserState(this.appConfig);
|
||||||
|
},
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
settingsVisible: this.getSettingsVisibility(),
|
settingsVisible: this.getSettingsVisibility(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user