From 2c8c9d22b4b8ea0aef7c7acecba746144d5b1759 Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Fri, 31 Jul 2026 11:49:09 +0700 Subject: [PATCH] refactor: standardize theme colors, update UI components, and refine auth redirection logic --- .../layouts/components/bookmark/index.tsx | 10 +-- .../layouts/components/header.layout.tsx | 8 +- .../layouts/components/history/index.tsx | 14 ++-- .../notifications/notification-dropdown.tsx | 9 +- .../src/apps/modules/system/setting/index.tsx | 2 +- apps/web/src/core/lib/auth.helper.ts | 22 +++-- .../core-i18n/src/languages/id/common.json | 4 +- .../providers/form-page.provider.tsx | 6 +- packages/ui/src/provider/theme-provider.tsx | 8 +- packages/ui/src/theme/tokens/colors.ts | 82 +++++++++---------- 10 files changed, 95 insertions(+), 70 deletions(-) diff --git a/apps/web/src/apps/modules/layouts/components/bookmark/index.tsx b/apps/web/src/apps/modules/layouts/components/bookmark/index.tsx index 4015ee1..93e8a2b 100644 --- a/apps/web/src/apps/modules/layouts/components/bookmark/index.tsx +++ b/apps/web/src/apps/modules/layouts/components/bookmark/index.tsx @@ -2,7 +2,7 @@ import { useState, useEffect } from 'react'; import { Drawer, Text, Stack, NavLink, ThemeIcon, ActionIcon, ScrollArea, Group } from '@repo/ui/components'; import { useAppEvent } from '@repo/core-events'; import { useTranslation } from '@repo/core-i18n'; -import { Bookmark, Trash2 } from 'lucide-react'; +import { Bookmark, Trash } from 'lucide-react'; import { LAYOUT_EVENTS } from '../../../../../core/constants/events'; import { appDatabase, AppDatabaseKey } from '../../../../../core/storage/local'; import { Link } from 'react-router-dom'; @@ -85,11 +85,11 @@ export function BookmarkDrawer() { - {t('bookmark:clearAll')} + {t('bookmark:clearAll')} @@ -120,7 +120,7 @@ export function BookmarkDrawer() { rightSection={ { e.preventDefault(); @@ -128,7 +128,7 @@ export function BookmarkDrawer() { }} aria-label={t('bookmark:removeItem')} > - + } styles={{ diff --git a/apps/web/src/apps/modules/layouts/components/header.layout.tsx b/apps/web/src/apps/modules/layouts/components/header.layout.tsx index db52533..b4223a3 100644 --- a/apps/web/src/apps/modules/layouts/components/header.layout.tsx +++ b/apps/web/src/apps/modules/layouts/components/header.layout.tsx @@ -63,7 +63,7 @@ export default function HeaderLayout() { {t('common:cancel')} - diff --git a/apps/web/src/core/lib/auth.helper.ts b/apps/web/src/core/lib/auth.helper.ts index ce0fd41..20c81a5 100644 --- a/apps/web/src/core/lib/auth.helper.ts +++ b/apps/web/src/core/lib/auth.helper.ts @@ -25,15 +25,21 @@ export async function terminateAuthSession(options: TerminateOptions = {}) { */ let loginUrl = '/auth/login'; - if (preserveRedirect) { - const currentPath = window.location.pathname + window.location.search; - loginUrl += `?redirect=${encodeURIComponent(currentPath)}`; - } + // Check if the current page is NOT the login page + const isNotLoginPage = !window.location.pathname.includes('/auth/login'); - /** - * Redirect without saving history to prevent infinite back-loops - */ - window.location.replace(loginUrl); + if (isNotLoginPage) { + // Set redirect parameters only if requested AND the user is not currently on the login page + if (preserveRedirect) { + const currentPath = window.location.pathname + window.location.search; + loginUrl += `?redirect=${encodeURIComponent(currentPath)}`; + } + + /** + * Redirect without saving history to prevent infinite back-loops + */ + window.location.replace(loginUrl); + } } export async function initiateAuthSession(respLogin: any) { diff --git a/packages/core-i18n/src/languages/id/common.json b/packages/core-i18n/src/languages/id/common.json index 493fb98..dcf64f3 100644 --- a/packages/core-i18n/src/languages/id/common.json +++ b/packages/core-i18n/src/languages/id/common.json @@ -3,7 +3,7 @@ "save": "Simpan", "cancel": "Batal", "success": "Sukses", - "error": "Galat", + "error": "Error", "settings": "Pengaturan", "loading": "Memuat", "delete": "Hapus", @@ -144,7 +144,7 @@ }, "notifications": { "successTitle": "Berhasil", - "errorTitle": "Galat", + "errorTitle": "Error", "saveSuccess": "Data berhasil disimpan", "deleteSuccess": "Data berhasil dihapus", "actionSuccess": "{{action}} berhasil diselesaikan", diff --git a/packages/ui/src/foundations/enterprise-module/providers/form-page.provider.tsx b/packages/ui/src/foundations/enterprise-module/providers/form-page.provider.tsx index 6282809..6a16cb3 100644 --- a/packages/ui/src/foundations/enterprise-module/providers/form-page.provider.tsx +++ b/packages/ui/src/foundations/enterprise-module/providers/form-page.provider.tsx @@ -188,7 +188,7 @@ export function EnterpriseFormPageProvider(pr notifications.show({ title: t('common:notifications.errorTitle'), message: message ?? error?.message, - color: 'red', + color: 'var(--mantine-color-error-6)', }); } finally { setIsLoading(false); @@ -250,7 +250,7 @@ export function EnterpriseFormPageProvider(pr notifications.show({ title: t('common:notifications.errorTitle'), message: message ?? error?.message, - color: 'red', + color: 'var(--mantine-color-error-6)', }); } finally { setIsSaving(false); @@ -355,7 +355,7 @@ export function EnterpriseFormPageProvider(pr {t('common:confirmDialog.leave.cancel')}