Restructure application to use /home for authenticated pages
- Move authenticated home page from /[locale] to /[locale]/home - Move login page from /[locale]/login to /[locale] (new landing page) - Move all restricted pages (bill, location, year-month, print, account) under /[locale]/home - Simplify middleware to protect all routes under /home instead of using publicPages array - Update auth config: change signIn page from /login to / - Update SignInButton callback URL to redirect to /home after login - Update all internal links throughout the application to reflect new structure - Update server action redirects in navigationActions.ts - Public share routes (/share/*) remain unchanged 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ export const AddLocationButton:React.FC<AddLocationButtonProps> = ({yearMonth})
|
||||
|
||||
return(
|
||||
<div className="card card-compact card-bordered bg-base-100 shadow-s my-1">
|
||||
<Link href={`/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("tooltip")}>
|
||||
<Link href={`/home/location/${ formatYearMonth(yearMonth) }/add`} className="card-body tooltip self-center" data-tip={t("tooltip")}>
|
||||
<span className='flex self-center'>
|
||||
<HomeIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
|
||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.6em] mt-[-.4em]" />
|
||||
|
||||
@@ -18,7 +18,7 @@ export const AddMonthButton:React.FC<AddMonthButtonProps> = ({ yearMonth }) => {
|
||||
|
||||
return(
|
||||
<div className="card card-compact shadow-s mb-4">
|
||||
<Link href={`/${locale}/year-month/${formatYearMonth(yearMonth)}/add`} className='grid self-center tooltip' data-tip={t("tooltip")}>
|
||||
<Link href={`/${locale}/home/year-month/${formatYearMonth(yearMonth)}/add`} className='grid self-center tooltip' data-tip={t("tooltip")}>
|
||||
<span className='flex self-center'>
|
||||
<CalendarDaysIcon className="h-[1em] w-[1em] cursor-pointer text-4xl" />
|
||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-xl text-green-500 ml-[-.4em] mt-[-.4em]" />
|
||||
|
||||
@@ -8,6 +8,6 @@ export interface BillBadgeProps {
|
||||
};
|
||||
|
||||
export const BillBadge:FC<BillBadgeProps> = ({ locationId, bill: { _id: billId, name, paid, hasAttachment }}) =>
|
||||
<Link href={`/bill/${locationId}-${billId}/edit`} className={`badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
||||
<Link href={`/home/bill/${locationId}-${billId}/edit`} className={`badge badge-lg ${paid?"badge-success":" badge-outline"} ${ !paid && hasAttachment ? "btn-outline btn-success" : "" } cursor-pointer`}>
|
||||
{name}
|
||||
</Link>;
|
||||
@@ -62,7 +62,7 @@ export const BillDeleteForm:FC<BillDeleteFormProps> = ({ bill, location }) => {
|
||||
|
||||
<div className="pt-4 text-center">
|
||||
<button className="btn btn-primary w-[5.5em]">{t("confirm-button")}</button>
|
||||
<Link className="btn btn-neutral w-[5.5em] ml-3" href={`/bill/${location._id}-${bill._id}/edit/`}>{t("cancel-button")}</Link>
|
||||
<Link className="btn btn-neutral w-[5.5em] ml-3" href={`/home/bill/${location._id}-${bill._id}/edit/`}>{t("cancel-button")}</Link>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -122,7 +122,7 @@ export const BillEditForm: FC<BillEditFormProps> = ({ location, bill }) => {
|
||||
{
|
||||
// don't show the delete button if we are adding a new bill
|
||||
bill ?
|
||||
<Link href={`/${locale}/bill/${locationID}-${billID}/delete/`} data-tip={t("delete-tooltip")}>
|
||||
<Link href={`/${locale}/home/bill/${locationID}-${billID}/delete/`} data-tip={t("delete-tooltip")}>
|
||||
<TrashIcon className="h-[1em] w-[1em] absolute cursor-pointer text-error bottom-5 right-4 text-2xl" />
|
||||
</Link> : null
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ export const LocationCard: FC<LocationCardProps> = ({ location, currency }) => {
|
||||
return (
|
||||
<div data-key={_id} className="card card-compact card-bordered max-w-[30em] bg-base-100 border-1 border-neutral my-1">
|
||||
<div className="card-body">
|
||||
<Link href={`/location/${_id}/edit`} className="card-subtitle tooltip" data-tip={t("edit-card-tooltip")}>
|
||||
<Link href={`/home/location/${_id}/edit`} className="card-subtitle tooltip" data-tip={t("edit-card-tooltip")}>
|
||||
<Cog8ToothIcon className="h-[1em] w-[1em] absolute cursor-pointer top-[-.2rem] right-0 text-2xl" />
|
||||
</Link>
|
||||
<h2 className="card-title mr-[2em] mt-[-1em] text-[1rem]">{formatYearMonth(yearMonth)} {name}</h2>
|
||||
@@ -58,7 +58,7 @@ export const LocationCard: FC<LocationCardProps> = ({ location, currency }) => {
|
||||
) : null
|
||||
}
|
||||
<div className="flex justify-between items-center mb-0">
|
||||
<Link href={`/bill/${_id}/add`} className="tooltip" data-tip={t("add-bill-button-tooltip")}>
|
||||
<Link href={`/home/bill/${_id}/add`} className="tooltip" data-tip={t("add-bill-button-tooltip")}>
|
||||
<PlusCircleIcon className="h-[1em] w-[1em] cursor-pointer text-2xl inline" /><span className="text-xs ml-[0.2rem]">{t("add-bill-button-tooltip")}</span>
|
||||
</Link>
|
||||
<ShareIcon className="h-[1em] w-[1em] cursor-pointer text-2xl inline hover:text-red-500" title="create sharable link" onClick={handleCopyLinkClick} />
|
||||
|
||||
@@ -58,7 +58,7 @@ export const LocationDeleteForm:FC<LocationDeleteFormProps> = ({ location }) =>
|
||||
)}
|
||||
<div className="pt-4 text-center">
|
||||
<button className="btn btn-primary w-[5.5em]">{t("confirm-button")}</button>
|
||||
<Link className="btn btn-neutral w-[5.5em] ml-3" href={`/location/${location._id}/edit/`}>{t("cancel-button")}</Link>
|
||||
<Link className="btn btn-neutral w-[5.5em] ml-3" href={`/home/location/${location._id}/edit/`}>{t("cancel-button")}</Link>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -61,7 +61,7 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
|
||||
<form action={dispatch}>
|
||||
{
|
||||
location &&
|
||||
<Link href={`/${locale}/location/${location._id}/delete`} className="absolute bottom-5 right-4 tooltip" data-tip={t("delete-tooltip")}>
|
||||
<Link href={`/${locale}/home/location/${location._id}/delete`} className="absolute bottom-5 right-4 tooltip" data-tip={t("delete-tooltip")}>
|
||||
<TrashIcon className="h-[1em] w-[1em] text-error text-2xl" />
|
||||
</Link>
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ export const MonthLocationList:React.FC<MonthLocationListProps > = ({
|
||||
const handleMonthToggle = (yearMonth:YearMonth) => {
|
||||
// if the month is already expanded, collapse it
|
||||
if(expandedMonth === yearMonth.month) {
|
||||
// router.push(`/?year=${yearMonth.year}`);
|
||||
// router.push(`/home?year=${yearMonth.year}`);
|
||||
setExpandedMonth(-1); // no month is expanded
|
||||
} else {
|
||||
// router.push(`/?year=${yearMonth.year}&month=${yearMonth.month}`);
|
||||
// router.push(`/home?year=${yearMonth.year}&month=${yearMonth.month}`);
|
||||
setExpandedMonth(yearMonth.month);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export const NotFoundPage:FC<NotFoundPageProps> = ({ title="404 Not Found", desc
|
||||
<FaceFrownIcon className="w-10 text-gray-400" />
|
||||
<h2 className="text-xl font-semibold">{title}</h2>
|
||||
<p>{description}</p>
|
||||
<Link href="/" className="mt-4 rounded-md bg-blue-500 px-4 py-2 text-sm text-white transition-colors hover:bg-blue-400">
|
||||
<Link href="/home" className="mt-4 rounded-md bg-blue-500 px-4 py-2 text-sm text-white transition-colors hover:bg-blue-400">
|
||||
Go Back
|
||||
</Link>
|
||||
</main>
|
||||
@@ -16,7 +16,7 @@ export const PageFooter: React.FC = () => {
|
||||
<div className="font-title inline-flex text-3xl font-black ml-2">Režije</div>
|
||||
</div>
|
||||
<p className="text-base-content/70 mb-5">{t('app-description')}</p>
|
||||
<Link href="/" className="link link-hover">{t('links.home')}</Link>
|
||||
<Link href="/home" className="link link-hover">{t('links.home')}</Link>
|
||||
<Link href="/policy/" className="link link-hover">{t('links.privacy-policy')}</Link>
|
||||
<Link href="/terms/" className="link link-hover">{t('links.terms-of-service')}</Link>
|
||||
</div>
|
||||
|
||||
@@ -5,10 +5,10 @@ import AccountCircle from "@mui/icons-material/AccountCircle";
|
||||
|
||||
export const PageHeader = () =>
|
||||
<div className="navbar bg-base-100 mb-6">
|
||||
<Link className="btn btn-ghost text-xl" href="/"><Image src="/icon3.png" alt="logo" width={48} height={48} /> Režije</Link>
|
||||
<Link className="btn btn-ghost text-xl" href="/home"><Image src="/icon3.png" alt="logo" width={48} height={48} /> Režije</Link>
|
||||
<span className="grow"> </span>
|
||||
<SelectLanguage />
|
||||
<Link href="/account/" className="btn btn-ghost btn-circle">
|
||||
<Link href="/home/account/" className="btn btn-ghost btn-circle">
|
||||
<AccountCircle />
|
||||
</Link>
|
||||
</div>
|
||||
@@ -12,7 +12,7 @@ export const PrintButton: React.FC<PrintButtonProps> = ({ yearMonth }) => {
|
||||
const t = useTranslations("home-page.month-card");
|
||||
|
||||
const handlePrintClick = () => {
|
||||
window.open(`/print/${yearMonth.year}/${yearMonth.month}`, '_blank');
|
||||
window.open(`/home/print/${yearMonth.year}/${yearMonth.month}`, '_blank');
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -21,7 +21,7 @@ export const SignInButton:React.FC<{ provider: {id:string, name:string} }> = ({
|
||||
const t = useTranslations("login-page");
|
||||
|
||||
return(
|
||||
<button className="btn btn-neutral m-1" onClick={() => signIn(provider.id, { callbackUrl:"https://rezije.app/" }) }>
|
||||
<button className="btn btn-neutral m-1" onClick={() => signIn(provider.id, { callbackUrl:"/home" }) }>
|
||||
<Image alt="Provider Logo" loading="lazy" height="24" width="24" id="provider-logo-dark" src={providerLogo(provider)} />
|
||||
<span>
|
||||
{t("sign-in-button")} {provider.name}</span>
|
||||
|
||||
Reference in New Issue
Block a user