From 946b5d8b616b1a532e04cb824edf9a7e9b76140b Mon Sep 17 00:00:00 2001 From: Ichsan Kurniawan Date: Tue, 23 Dec 2025 18:49:34 +0700 Subject: [PATCH] update page title metadata --- app/(dashboard)/(main)/page.tsx | 2 -- app/(dashboard)/history/page.tsx | 2 +- app/(dashboard)/iam-here/page.tsx | 3 +-- app/(dashboard)/leave/page.tsx | 2 +- app/(dashboard)/presence-v2/page.tsx | 12 ++++++++++-- app/(dashboard)/profile/page.tsx | 2 +- app/(dashboard)/release-notes/page.tsx | 3 ++- app/(dashboard)/work-permit/page.tsx | 2 +- app/@modal/(.)performance/[id]/page.tsx | 16 ++++++++++++++++ app/admin/administration/user/page.tsx | 3 ++- app/performance/[id]/page.tsx | 17 +++++++++++++++++ 11 files changed, 52 insertions(+), 12 deletions(-) diff --git a/app/(dashboard)/(main)/page.tsx b/app/(dashboard)/(main)/page.tsx index bdfeeae..ceca9b5 100644 --- a/app/(dashboard)/(main)/page.tsx +++ b/app/(dashboard)/(main)/page.tsx @@ -42,8 +42,6 @@ export default async function DashboardPage() { const alreadyCheckin = todayPresence.history.length > 0 const alreadyCheckout = (alreadyCheckin && todayPresence.history[0].presence_checkout) || todayPresence.history.length === 0 - console.log(session) - return ( <>
diff --git a/app/(dashboard)/history/page.tsx b/app/(dashboard)/history/page.tsx index 8ac283f..626af6b 100644 --- a/app/(dashboard)/history/page.tsx +++ b/app/(dashboard)/history/page.tsx @@ -16,7 +16,7 @@ export async function generateMetadata(): Promise { const session = await getServerSession(authOptions) return { - title: `History - ${session?.user?.detail.fullname || 'User'}`, + title: `${session?.user?.detail.fullname || 'User'}'s History - HIS Attendance Task System (H.A.T.s)`, } } diff --git a/app/(dashboard)/iam-here/page.tsx b/app/(dashboard)/iam-here/page.tsx index fac7e34..471176d 100644 --- a/app/(dashboard)/iam-here/page.tsx +++ b/app/(dashboard)/iam-here/page.tsx @@ -11,8 +11,7 @@ import { authOptions } from '@/pages/api/auth/[...nextauth]'; const FormComponent = lazy(() => import('./components/FormComponent')) export const metadata: Metadata = { - title: "I'am Here", - description: "Employee update presence page.", + title: "Update your current work location (I'am Here) - HIS Attendance Task System (H.A.T.s)", } type Props = {}; diff --git a/app/(dashboard)/leave/page.tsx b/app/(dashboard)/leave/page.tsx index 8d3eea0..22f05ff 100644 --- a/app/(dashboard)/leave/page.tsx +++ b/app/(dashboard)/leave/page.tsx @@ -8,7 +8,7 @@ import { fetchDataWithPost } from '@/lib/fetchData'; const FormComponent = lazy(() => import('./components')) export const metadata: Metadata = { - title: "Apply for Leave", + title: "Apply for Leave - HIS Attendance Task System (H.A.T.s)", } const WorkLeave = async () => { diff --git a/app/(dashboard)/presence-v2/page.tsx b/app/(dashboard)/presence-v2/page.tsx index 5cb1d10..77b9df6 100644 --- a/app/(dashboard)/presence-v2/page.tsx +++ b/app/(dashboard)/presence-v2/page.tsx @@ -8,8 +8,16 @@ import fetchData from '@/lib/fetchData'; const FormComponent = lazy(() => import('./components/FormComponent')) export const metadata: Metadata = { - title: "Presence", - description: "Employee presence page.", + title: "Presence - HIS Attendance Task System (H.A.T.s)", +} + +export async function generateMetadata({ searchParams }: any): Promise { + const checkout = (await searchParams)?.checkout + const title = checkout === 'true' ? 'Check-out Presence' : 'Check-in Presence' + + return { + title: `${title} - HIS Attendance Task System (H.A.T.s)`, + } } type Props = { diff --git a/app/(dashboard)/profile/page.tsx b/app/(dashboard)/profile/page.tsx index 17c57c0..584b7a4 100644 --- a/app/(dashboard)/profile/page.tsx +++ b/app/(dashboard)/profile/page.tsx @@ -269,7 +269,7 @@ export default async function ProfilePage() { Privacy Policy
-

App Version {process.env.NEXT_PUBLIC_APP_VERSION}

+

App version {process.env.NEXT_PUBLIC_APP_VERSION}

diff --git a/app/(dashboard)/release-notes/page.tsx b/app/(dashboard)/release-notes/page.tsx index c3f0628..b29bc75 100644 --- a/app/(dashboard)/release-notes/page.tsx +++ b/app/(dashboard)/release-notes/page.tsx @@ -26,6 +26,7 @@ const releaseNotes: ReleaseNote[] = [ { category: "improvement", description: "Upgraded React and ReactDOM from v18.2.0 to v19.2.3" }, { category: "improvement", description: "Replaced native img tags with Next.js Image component and added lazy loading for avatars" }, { category: "bugfix", description: "Fixed spamming \"Failed to fetch geolocation\" alerts when presence using mobile devices" }, + { category: "feature", description: "Added progress bar indicator when route change in employee routes" }, { category: 'feature', description:
Added hats team page
}, { category: 'feature', description:
Added release notes page
}, ] @@ -41,7 +42,7 @@ const releaseNotes: ReleaseNote[] = [ { category: "feature", description: "Open Google Maps to show presence location in attendance history" }, { category: "bugfix", description: "Fixed issues in manual attendance" }, { category: "improvement", description: "Improved donut chart responsiveness on the homepage for mobile view" }, - { category: "feature", description: "Added progress bar indicator when route change in admin pane" }, + { category: "feature", description: "Added progress bar indicator when route change in admin panel" }, ] }, { diff --git a/app/(dashboard)/work-permit/page.tsx b/app/(dashboard)/work-permit/page.tsx index a91889f..67ac9c2 100644 --- a/app/(dashboard)/work-permit/page.tsx +++ b/app/(dashboard)/work-permit/page.tsx @@ -8,7 +8,7 @@ import { fetchDataWithPost } from '@/lib/fetchData'; const FormComponent = lazy(() => import('./components')) export const metadata: Metadata = { - title: "Work Permit and Sick", + title: "Work Permit and Sick - HIS Attendance Task System (H.A.T.s)", } const WorkPermit = async () => { diff --git a/app/@modal/(.)performance/[id]/page.tsx b/app/@modal/(.)performance/[id]/page.tsx index bee2354..1d7d134 100644 --- a/app/@modal/(.)performance/[id]/page.tsx +++ b/app/@modal/(.)performance/[id]/page.tsx @@ -2,9 +2,25 @@ import { FC, Suspense, lazy } from 'react'; import InterceptModal from '@/components/modal/InterceptModal'; import LazyLoading from '@/components/loader/LazyLoading'; import DateRangePicker from '@/app/performance/[id]/components/DateRangePicker'; +import { getServerSession } from 'next-auth'; +import { authOptions } from '@/pages/api/auth/[...nextauth]'; +import { Metadata } from 'next'; +import dayjs from 'dayjs'; const PerformanceComponent = lazy(() => import('@/app/performance/[id]/components')); +export async function generateMetadata({ searchParams }: any): Promise { + const session = await getServerSession(authOptions) + const start_date = (await searchParams)!.start_date + const end_date = (await searchParams)!.end_date + + const date = start_date && end_date ? `from ${dayjs(start_date).format('MMM DD, YYYY')} to ${dayjs(end_date).format('MMM DD, YYYY')}` : 'the last 30 days' + + return { + title: `${session?.user?.detail.fullname || 'User'}'s Performance in ${date} - HIS Attendance Task System (H.A.T.s)`, + } +} + type Props = { params: Promise<{ id: string | undefined }> searchParams: Promise<{ [key: string]: string | string[] | undefined }> diff --git a/app/admin/administration/user/page.tsx b/app/admin/administration/user/page.tsx index b4741c2..ff4de15 100644 --- a/app/admin/administration/user/page.tsx +++ b/app/admin/administration/user/page.tsx @@ -1,5 +1,5 @@ import { type Metadata } from 'next'; -import { FC, Suspense, lazy } from 'react'; +import { Suspense, lazy } from 'react'; import { getServerSession } from 'next-auth'; import { authOptions } from '@/pages/api/auth/[...nextauth]'; import { type ResponseData } from '@/types/types'; @@ -17,6 +17,7 @@ export const metadata: Metadata = { async function getData() { const { BASE_URL_API } = process.env const session = await getServerSession(authOptions) + console.log("SESSION ADMIN USER PAGE :", session) const res = await fetch(BASE_URL_API + '/user', { headers: { diff --git a/app/performance/[id]/page.tsx b/app/performance/[id]/page.tsx index 01b98d5..3c56adf 100644 --- a/app/performance/[id]/page.tsx +++ b/app/performance/[id]/page.tsx @@ -1,6 +1,10 @@ import { FC, Suspense, lazy } from 'react'; import LazyLoading from '@/components/loader/LazyLoading'; import DateRangePicker from './components/DateRangePicker'; +import { Metadata } from 'next'; +import { getServerSession } from 'next-auth'; +import { authOptions } from '@/pages/api/auth/[...nextauth]'; +import dayjs from 'dayjs'; const Header = lazy(() => import('@/app/(dashboard)/components/Header')) const PerformanceComponent = lazy(() => import('./components')) @@ -10,6 +14,19 @@ type Props = { searchParams: Promise<{ [key: string]: string | string[] | undefined }> }; + +export async function generateMetadata({ searchParams }: any): Promise { + const session = await getServerSession(authOptions) + const start_date = (await searchParams)!.start_date + const end_date = (await searchParams)!.end_date + + const date = start_date && end_date ? `from ${dayjs(start_date).format('MMM DD, YYYY')} to ${dayjs(end_date).format('MMM DD, YYYY')}` : 'the last 30 days' + + return { + title: `${session?.user?.detail.fullname || 'User'}'s Performance in ${date} - HIS Attendance Task System (H.A.T.s)`, + } +} + const PerformancePage: FC = async ({ params, searchParams }) => { const id = (await params).id const start_date = (await searchParams)!.start_date