From a8211cef7de29b5cf02f6faffab3434bbb5747c1 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Mon, 27 Jan 2025 16:19:39 -0500 Subject: [PATCH] feat: style improvements --- api/src/core/sso/sso-remove.ts | 6 +++--- api/src/index.ts | 1 - api/src/unraid-api/cli/sso/add-sso-user.command.ts | 3 ++- api/src/unraid-api/cli/start.command.ts | 11 +++++++++++ .../src/components/common/sheet/sheet.variants.ts | 2 +- unraid-ui/src/theme/preset.ts | 3 +++ web/assets/main.css | 3 --- web/components/Notifications/List.vue | 2 +- web/components/shadcn/sheet/index.ts | 2 +- web/store/theme.ts | 9 +++++---- 10 files changed, 27 insertions(+), 15 deletions(-) diff --git a/api/src/core/sso/sso-remove.ts b/api/src/core/sso/sso-remove.ts index 5788a2035..e1bc59a7c 100644 --- a/api/src/core/sso/sso-remove.ts +++ b/api/src/core/sso/sso-remove.ts @@ -1,6 +1,6 @@ import { existsSync, renameSync, unlinkSync } from 'node:fs'; -import { cliLogger } from '@app/core/log'; +import { logger } from '@app/core/log'; export const removeSso = () => { const path = '/usr/local/emhttp/plugins/dynamix/include/.login.php'; @@ -13,8 +13,8 @@ export const removeSso = () => { unlinkSync(path); } renameSync(backupPath, path); - cliLogger.debug('SSO login file restored.'); + logger.debug('SSO login file restored.'); } else { - cliLogger.debug('No SSO login file backup found.'); + logger.debug('No SSO login file backup found.'); } }; diff --git a/api/src/index.ts b/api/src/index.ts index 75ed72627..91edaf665 100644 --- a/api/src/index.ts +++ b/api/src/index.ts @@ -108,7 +108,6 @@ try { logger.info('SSO setup complete'); } else { await removeSso(); - logger.info('SSO removed'); } } catch (err) { logger.error('Failed to setup SSO with error: %o', err); diff --git a/api/src/unraid-api/cli/sso/add-sso-user.command.ts b/api/src/unraid-api/cli/sso/add-sso-user.command.ts index 10e955db5..da49f191a 100644 --- a/api/src/unraid-api/cli/sso/add-sso-user.command.ts +++ b/api/src/unraid-api/cli/sso/add-sso-user.command.ts @@ -40,7 +40,8 @@ export class AddSSOUserCommand extends CommandRunner { writeConfigSync('flash'); this.logger.info(`User added ${options.username}`); if (shouldRestart) { - this.logger.info('Restarting the Unraid API to enable to SSO button'); + this.logger.info('Restarting the Unraid API in 5 seconds to enable the SSO button'); + await new Promise(resolve => setTimeout(resolve, 5000)); await this.restartCommand.run([]); } } diff --git a/api/src/unraid-api/cli/start.command.ts b/api/src/unraid-api/cli/start.command.ts index 4e550c637..792d5fdfa 100644 --- a/api/src/unraid-api/cli/start.command.ts +++ b/api/src/unraid-api/cli/start.command.ts @@ -17,6 +17,17 @@ export class StartCommand extends CommandRunner { async run(_: string[], options: StartCommandOptions): Promise { this.logger.info('Starting the Unraid API'); + + // Update PM2 first if necessary + const { stderr: updateErr, stdout: updateOut } = await execa(`${PM2_PATH} update`); + if (updateOut) { + this.logger.log(updateOut); + } + if (updateErr) { + this.logger.error('PM2 Update Error: ' + updateErr); + process.exit(1); + } + const envLog = options['log-level'] ? `LOG_LEVEL=${options['log-level']}` : ''; const { stderr, stdout } = await execa(`${envLog} ${PM2_PATH}`.trim(), [ 'start', diff --git a/unraid-ui/src/components/common/sheet/sheet.variants.ts b/unraid-ui/src/components/common/sheet/sheet.variants.ts index 018324e8a..65f0f5a5d 100644 --- a/unraid-ui/src/components/common/sheet/sheet.variants.ts +++ b/unraid-ui/src/components/common/sheet/sheet.variants.ts @@ -1,7 +1,7 @@ import { cva } from "class-variance-authority"; export const sheetVariants = cva( - "fixed z-50 bg-background gap-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", + "fixed z-50 bg-background gap-4 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500 border-border", { variants: { side: { diff --git a/unraid-ui/src/theme/preset.ts b/unraid-ui/src/theme/preset.ts index 186befae2..9d45433f2 100644 --- a/unraid-ui/src/theme/preset.ts +++ b/unraid-ui/src/theme/preset.ts @@ -14,6 +14,9 @@ export const unraidPreset = { }, }, extend: { + borderColor: { + DEFAULT: "hsl(var(--border))", + }, fontFamily: { sans: "clear-sans,ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji", }, diff --git a/web/assets/main.css b/web/assets/main.css index 9c331c58d..c2036a522 100644 --- a/web/assets/main.css +++ b/web/assets/main.css @@ -39,9 +39,6 @@ body { @tailwind utilities; @layer base { - * { - @apply border-border; - } body { @apply bg-background text-foreground; } diff --git a/web/components/Notifications/List.vue b/web/components/Notifications/List.vue index 1114df3ea..153a3a9f2 100644 --- a/web/components/Notifications/List.vue +++ b/web/components/Notifications/List.vue @@ -70,7 +70,7 @@ async function onLoadMore() {
= { '--popover-foreground': '0 0% 98%', '--card': '0 0% 14.9%', '--card-foreground': '0 0% 98%', - '--border': '0 0% 14.9%', + '--border': '0 0% 20%', '--input': '0 0% 14.9%', '--primary': '24 100% 50%', '--primary-foreground': '0 0% 98%', @@ -74,8 +74,8 @@ export const defaultColors: Record = { }, } as const; -export const DARK_THEMES = ['black', 'azure'] as const; - +// used to swap the UPC text color when using the azure or gray theme +export const DARK_THEMES = ['black', 'gray'] as const; export const useThemeStore = defineStore('theme', () => { // State @@ -83,10 +83,11 @@ export const useThemeStore = defineStore('theme', () => { const activeColorVariables = ref(defaultColors.light); // Getters + const darkMode = computed( () => DARK_THEMES.includes(theme.value?.name as (typeof DARK_THEMES)[number]) ?? false ); - // used to swap the UPC text color when using the azure or gray theme + const bannerGradient = computed(() => { if (!theme.value?.banner || !theme.value?.bannerGradient) { return undefined;