From a8a125306798852b854605a9e1e7373ff1715258 Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 25 Nov 2025 20:48:49 +0100 Subject: [PATCH 1/6] Add internationalization to account page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace hardcoded text with next-intl placeholders for proper i18n support. - Add translation keys for page title, settings button, and logout button - Add translations for both Croatian (hr) and English (en) locales šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/[locale]/account/page.tsx | 37 ++++++++++++++++------------------- messages/en.json | 5 +++++ messages/hr.json | 5 +++++ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/[locale]/account/page.tsx b/app/[locale]/account/page.tsx index 4c0003d..a541a77 100644 --- a/app/[locale]/account/page.tsx +++ b/app/[locale]/account/page.tsx @@ -1,32 +1,29 @@ -import { FC, Suspense } from 'react'; +import { FC } from 'react'; import { Main } from '@/app/ui/Main'; -import { UserSettingsForm as UserSettingsForm, UserSettingsFormSkeleton } from '@/app/ui/UserSettingsForm'; -import { getUserSettings } from '@/app/lib/actions/userSettingsActions'; +import Link from 'next/link'; +import SettingsIcon from "@mui/icons-material/Settings"; +import LogoutIcon from "@mui/icons-material/Logout"; +import AccountCircle from "@mui/icons-material/AccountCircle"; +import { useTranslations } from 'next-intl'; -const AccountPage: FC = async () => { - const userSettings = await getUserSettings(); + +const Page: FC = () => { + const t = useTranslations('account-page'); return (
- +
+
+

{t('title')}

+ {t('settings-button')} + {t('logout-button')} +
+
+
- ); -}; -const Page: FC = () => { - return ( - -
-
- -
- - }> - -
); }; diff --git a/messages/en.json b/messages/en.json index e61aaa7..50c0a1c 100644 --- a/messages/en.json +++ b/messages/en.json @@ -2,6 +2,11 @@ "Index": { "title": "Welcome!" }, + "account-page": { + "title": "User account", + "settings-button": "User Settings", + "logout-button": "Logout" + }, "PageFooter": { "app-description": "Helping you to stay on top of your utility bills", "links": { diff --git a/messages/hr.json b/messages/hr.json index d437e10..cd3a06c 100644 --- a/messages/hr.json +++ b/messages/hr.json @@ -2,6 +2,11 @@ "Index": { "title": "DobrodoÅ”li" }, + "account-page": { + "title": "Korisnički račun", + "settings-button": "Korisničke postavke", + "logout-button": "Odjava" + }, "PageFooter": { "app-description": "Preuzmite kontrolu nad svojim režijama!", "links": { From 62d0cb81a72e96302ef35cb33756f6191ef5044d Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 25 Nov 2025 20:49:33 +0100 Subject: [PATCH 2/6] Refactor account page structure and update UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move user settings form to dedicated /account/settings route - Update PageHeader icon from Settings to AccountCircle for clarity - Update debug log labels in auth config for better readability šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/[locale]/account/settings/page.tsx | 33 ++++++++++++++++++++++++++ app/lib/auth.ts | 6 ++--- app/ui/PageHeader.tsx | 4 ++-- 3 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 app/[locale]/account/settings/page.tsx diff --git a/app/[locale]/account/settings/page.tsx b/app/[locale]/account/settings/page.tsx new file mode 100644 index 0000000..f4cab95 --- /dev/null +++ b/app/[locale]/account/settings/page.tsx @@ -0,0 +1,33 @@ +import { FC, Suspense } from 'react'; +import { Main } from '@/app/ui/Main'; +import { UserSettingsForm as UserSettingsForm, UserSettingsFormSkeleton } from '@/app/ui/UserSettingsForm'; +import { getUserSettings } from '@/app/lib/actions/userSettingsActions'; + +const UserSettingsPage: FC = async () => { + const userSettings = await getUserSettings(); + + return ( +
+
+ +
+
+ ); +}; + +const Page: FC = () => { + return ( + +
+
+ +
+ + }> + +
+ ); +}; + +export default Page; diff --git a/app/lib/auth.ts b/app/lib/auth.ts index 5c09a61..dac126a 100644 --- a/app/lib/auth.ts +++ b/app/lib/auth.ts @@ -35,8 +35,8 @@ export const authConfig: NextAuthConfig = { // see: https://stackoverflow.com/questions/70409219/get-user-id-from-session-in-next-auth-client jwt({ token, account, user }) { if (account) { - // console.log("(jwt) account:", account); - // console.log("(jwt) user:", user); + // console.log("(JWT) account:", account); + // console.log("(JWT) user:", user); token.accessToken = account.access_token; // attach Google account ID to the token token.piggyback_providerAccountId = account.providerAccountId; @@ -51,7 +51,7 @@ export const authConfig: NextAuthConfig = { if(session.user && token) { // assign Google account ID from the token to the Session user ID session.user.id = token.piggyback_providerAccountId; - // console.log("(jwt) token:", token); +// console.log("(SESSION) token:", token); } return session; }, diff --git a/app/ui/PageHeader.tsx b/app/ui/PageHeader.tsx index 2c02d7e..04d2b15 100644 --- a/app/ui/PageHeader.tsx +++ b/app/ui/PageHeader.tsx @@ -1,7 +1,7 @@ import Image from "next/image"; import Link from "next/link"; import { SelectLanguage } from "./SelectLanguage"; -import Settings from "@mui/icons-material/Settings"; +import AccountCircle from "@mui/icons-material/AccountCircle"; export const PageHeader = () =>
@@ -9,6 +9,6 @@ export const PageHeader = () =>   - +
\ No newline at end of file From 572466497b5124580ca3a8dccebf3c584c54d22a Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 25 Nov 2025 20:49:47 +0100 Subject: [PATCH 3/6] Clean up whitespace in account page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove extra blank lines for cleaner formatting. šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/[locale]/account/page.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/[locale]/account/page.tsx b/app/[locale]/account/page.tsx index a541a77..7d1c37c 100644 --- a/app/[locale]/account/page.tsx +++ b/app/[locale]/account/page.tsx @@ -6,7 +6,6 @@ import LogoutIcon from "@mui/icons-material/Logout"; import AccountCircle from "@mui/icons-material/AccountCircle"; import { useTranslations } from 'next-intl'; - const Page: FC = () => { const t = useTranslations('account-page'); @@ -20,10 +19,8 @@ const Page: FC = () => { {t('logout-button')} - - ); }; From 42040c79182fcc5922d55c29b9104af91ecb127d Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 25 Nov 2025 21:11:41 +0100 Subject: [PATCH 4/6] Implement logout functionality for account page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create LogoutButton client component using signOut from next-auth/react - Update account page to use LogoutButton instead of static link - Convert account page to async server component for proper i18n - Add locale-aware routing for settings link - Add logging-out-message translations (EN/HR) šŸ¤– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/[locale]/account/LogoutButton.tsx | 20 ++++++++++++++++++++ app/[locale]/account/page.tsx | 13 +++++++------ messages/en.json | 3 ++- messages/hr.json | 3 ++- 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 app/[locale]/account/LogoutButton.tsx diff --git a/app/[locale]/account/LogoutButton.tsx b/app/[locale]/account/LogoutButton.tsx new file mode 100644 index 0000000..d4bc1b1 --- /dev/null +++ b/app/[locale]/account/LogoutButton.tsx @@ -0,0 +1,20 @@ +"use client"; + +import { FC } from 'react'; +import LogoutIcon from "@mui/icons-material/Logout"; +import { signOut } from 'next-auth/react'; +import { useLocale, useTranslations } from 'next-intl'; +import { Button } from '@/app/ui/button'; + +export const LogoutButton: FC = () => { + const t = useTranslations('account-page'); + const locale = useLocale(); + + const handleLogout = () => { + signOut({ callbackUrl: `/${locale}/login` }); + }; + + return ( + + ) +} \ No newline at end of file diff --git a/app/[locale]/account/page.tsx b/app/[locale]/account/page.tsx index 7d1c37c..d60ace9 100644 --- a/app/[locale]/account/page.tsx +++ b/app/[locale]/account/page.tsx @@ -2,12 +2,13 @@ import { FC } from 'react'; import { Main } from '@/app/ui/Main'; import Link from 'next/link'; import SettingsIcon from "@mui/icons-material/Settings"; -import LogoutIcon from "@mui/icons-material/Logout"; import AccountCircle from "@mui/icons-material/AccountCircle"; -import { useTranslations } from 'next-intl'; +import { getTranslations, getLocale } from 'next-intl/server'; +import { LogoutButton } from './LogoutButton'; -const Page: FC = () => { - const t = useTranslations('account-page'); +const Page: FC = async () => { + const t = await getTranslations('account-page'); + const locale = await getLocale(); return (
@@ -15,8 +16,8 @@ const Page: FC = () => {

{t('title')}

- {t('settings-button')} - {t('logout-button')} + {t('settings-button')} +
diff --git a/messages/en.json b/messages/en.json index 50c0a1c..8402eb8 100644 --- a/messages/en.json +++ b/messages/en.json @@ -5,7 +5,8 @@ "account-page": { "title": "User account", "settings-button": "User Settings", - "logout-button": "Logout" + "logout-button": "Logout", + "logging-out-message": "Logging out..." }, "PageFooter": { "app-description": "Helping you to stay on top of your utility bills", diff --git a/messages/hr.json b/messages/hr.json index cd3a06c..8725686 100644 --- a/messages/hr.json +++ b/messages/hr.json @@ -5,7 +5,8 @@ "account-page": { "title": "Korisnički račun", "settings-button": "Korisničke postavke", - "logout-button": "Odjava" + "logout-button": "Odjava", + "logging-out-message": "Odjavljujem se..." }, "PageFooter": { "app-description": "Preuzmite kontrolu nad svojim režijama!", From 07422826e0f842a865a503c06b18826b97c6b467 Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 25 Nov 2025 21:12:06 +0100 Subject: [PATCH 5/6] removed unused messages --- messages/en.json | 3 +-- messages/hr.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/messages/en.json b/messages/en.json index 8402eb8..50c0a1c 100644 --- a/messages/en.json +++ b/messages/en.json @@ -5,8 +5,7 @@ "account-page": { "title": "User account", "settings-button": "User Settings", - "logout-button": "Logout", - "logging-out-message": "Logging out..." + "logout-button": "Logout" }, "PageFooter": { "app-description": "Helping you to stay on top of your utility bills", diff --git a/messages/hr.json b/messages/hr.json index 8725686..cd3a06c 100644 --- a/messages/hr.json +++ b/messages/hr.json @@ -5,8 +5,7 @@ "account-page": { "title": "Korisnički račun", "settings-button": "Korisničke postavke", - "logout-button": "Odjava", - "logging-out-message": "Odjavljujem se..." + "logout-button": "Odjava" }, "PageFooter": { "app-description": "Preuzmite kontrolu nad svojim režijama!", From f8d578faf6f0572cfc5911c3a116ba9c5ccce323 Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 25 Nov 2025 21:12:46 +0100 Subject: [PATCH 6/6] 2.6.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index d0b1d90..4740841 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "evidencija-rezija", - "version": "2.6.0", + "version": "2.6.2", "lockfileVersion": 3, "requires": true, "packages": { "": { - "version": "2.6.0", + "version": "2.6.2", "dependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.1", diff --git a/package.json b/package.json index a6b3565..ce12caa 100644 --- a/package.json +++ b/package.json @@ -59,5 +59,5 @@ "engines": { "node": ">=18.17.0" }, - "version": "2.6.0" + "version": "2.6.2" }