Created a new /share/rent-due/ page to display rent payment information separately from utility bills. Changes: - Created /share/rent-due/[id]/ page structure with RentViewPage component - Created ViewRentCard component to display rent amount and payment info - Added uploadRentProofOfPayment action for tenant proof upload - Added translation keys for rent-specific labels (en/hr) - Updated rent email templates to link to /share/rent-due/ instead of /share/bills-due/ - Updated documentation to reflect new URL structure The rent page displays: - Rent amount - IBAN or Revolut payment information with QR/barcode - Rent proof of payment upload (when enabled) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
48 lines
1.6 KiB
TypeScript
48 lines
1.6 KiB
TypeScript
import { ViewRentCard } from '@/app/ui/ViewRentCard';
|
|
import { fetchLocationById, setSeenByTenantAt, validateShareAccess } from '@/app/lib/actions/locationActions';
|
|
import { getUserSettingsByUserId } from '@/app/lib/actions/userSettingsActions';
|
|
import { notFound } from 'next/navigation';
|
|
import { myAuth } from '@/app/lib/auth';
|
|
|
|
export default async function RentViewPage({ shareId }: { shareId: string }) {
|
|
// Validate share access (checks checksum + TTL, extracts locationId)
|
|
const accessValidation = await validateShareAccess(shareId);
|
|
|
|
if (!accessValidation.valid || !accessValidation.locationId) {
|
|
return (
|
|
<div className="alert alert-error">
|
|
<p>{accessValidation.error || 'This content is no longer shared'}</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const locationId = accessValidation.locationId;
|
|
|
|
// Fetch location
|
|
const location = await fetchLocationById(locationId);
|
|
|
|
if (!location) {
|
|
return notFound();
|
|
}
|
|
|
|
// Fetch user settings for the location owner
|
|
const userSettings = await getUserSettingsByUserId(location.userId);
|
|
|
|
// Check if the page was accessed by an authenticated user who is the owner
|
|
const session = await myAuth();
|
|
const isOwner = session?.user?.id === location.userId;
|
|
|
|
// If the page is not visited by the owner, mark it as seen by tenant
|
|
if (!isOwner) {
|
|
await setSeenByTenantAt(locationId);
|
|
}
|
|
|
|
return (
|
|
<ViewRentCard
|
|
location={location}
|
|
userSettings={userSettings}
|
|
shareId={shareId}
|
|
/>
|
|
);
|
|
}
|