Compare commits
18 Commits
d96bc307c0
...
0e3e41e064
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e3e41e064 | |||
| 488c771a09 | |||
| 1076797c89 | |||
|
|
a54771e479 | ||
|
|
c8659c15bb | ||
|
|
1bd755465a | ||
|
|
d3f109ea4b | ||
|
|
2ad2978fd3 | ||
|
|
9a3a30abf8 | ||
|
|
e32818e4ca | ||
| 4336e0ca3f | |||
| e57759d000 | |||
|
|
04c6f1868b | ||
|
|
cbe7b4eb78 | ||
|
|
84b94403c9 | ||
| 0bd9a7b34f | |||
| 79c42aa349 | |||
|
|
4e1bef30f5 |
@@ -4,6 +4,7 @@ import { getUserSettings } from '@/app/lib/actions/userSettingsActions';
|
||||
import { BillingLocation, YearMonth } from '@/app/lib/db-types';
|
||||
import { FC } from 'react';
|
||||
import { MonthLocationList } from '@/app/ui/MonthLocationList';
|
||||
import { ParamsYearInvalidMessage } from './ParamsYearInvalidMessage';
|
||||
|
||||
export interface HomePageProps {
|
||||
searchParams?: {
|
||||
@@ -14,11 +15,9 @@ export interface HomePageProps {
|
||||
|
||||
export const HomePage:FC<HomePageProps> = async ({ searchParams }) => {
|
||||
|
||||
/** years found in the DB sorted descending */
|
||||
let availableYears: number[];
|
||||
|
||||
// const asyncTimout = (ms:number) => new Promise(resolve => setTimeout(resolve, ms));
|
||||
// await asyncTimout(5000);
|
||||
|
||||
try {
|
||||
availableYears = await fetchAvailableYears();
|
||||
} catch (error:any) {
|
||||
@@ -28,14 +27,34 @@ export const HomePage:FC<HomePageProps> = async ({ searchParams }) => {
|
||||
</main>);
|
||||
}
|
||||
|
||||
// if the database is in it's initial state, show the add location button for the current month
|
||||
const paramsYear = searchParams?.year ? Number(searchParams.year) : null;
|
||||
let selectedYear:number;
|
||||
|
||||
// IF year is set via params, check if it's valid
|
||||
if(paramsYear) {
|
||||
|
||||
// IF the database is in it's initial state
|
||||
// THEN show message param being invalid AND redirect to root page
|
||||
if(availableYears.length === 0) {
|
||||
return (<MonthLocationList />);
|
||||
return (<ParamsYearInvalidMessage />);
|
||||
}
|
||||
|
||||
const currentYear = Number(searchParams?.year) || new Date().getFullYear();
|
||||
// IF the year specified in the params is not found in the DB
|
||||
// THEN show message param being invalid AND redirect to page showing first available year
|
||||
if(!availableYears.includes(paramsYear)) {
|
||||
return (<ParamsYearInvalidMessage firstAvailableYear={availableYears[0]} />);
|
||||
}
|
||||
|
||||
const locations = await fetchAllLocations(currentYear);
|
||||
selectedYear = paramsYear;
|
||||
} else {
|
||||
const currYear = new Date().getFullYear();
|
||||
|
||||
// IF current year is available in DB THEN use it
|
||||
// ELSE use the latest year found in the DB
|
||||
selectedYear = availableYears.includes(currYear) ? currYear : availableYears[0];
|
||||
}
|
||||
|
||||
const locations = await fetchAllLocations(selectedYear);
|
||||
const userSettings = await getUserSettings();
|
||||
|
||||
// group locations by month
|
||||
|
||||
@@ -19,7 +19,7 @@ export const PageFooter: React.FC = async () => {
|
||||
</div>
|
||||
<p>{t('app-description')}</p>
|
||||
<div className="flex gap-4">
|
||||
<Link href="/home" className="link link-hover">{t('links.home')}</Link>
|
||||
<Link href="/" className="link link-hover">{t('links.home')}</Link>
|
||||
<Link href={`/${locale}/privacy-policy/`} className="link link-hover">{t('links.privacy-policy')}</Link>
|
||||
<Link href={`/${locale}/terms-of-service/`} className="link link-hover">{t('links.terms-of-service')}</Link>
|
||||
</div>
|
||||
|
||||
21
app/ui/ParamsYearInvalidMessage.tsx
Normal file
21
app/ui/ParamsYearInvalidMessage.tsx
Normal file
@@ -0,0 +1,21 @@
|
||||
"use client";
|
||||
import { FC, useEffect } from 'react';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export const ParamsYearInvalidMessage:FC<{ firstAvailableYear?: number }> = ({ firstAvailableYear }) => {
|
||||
|
||||
// Redirect to the first available year after showing the message
|
||||
useEffect(() => {
|
||||
if(firstAvailableYear) {
|
||||
redirect(`/?year=${firstAvailableYear}`);
|
||||
} else {
|
||||
redirect(`/`);
|
||||
}
|
||||
});
|
||||
|
||||
return(
|
||||
<main className="flex min-h-screen flex-col p-6 bg-base-300">
|
||||
<p className="text-center text-2xl text-red-500">The year specified in the URL is invalid ... redirecting</p>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
@@ -22,7 +22,7 @@
|
||||
"text": "<p>The best part of renting out an apartment or house is when the <strong>rent hits your account</strong>. Dealing with utility bills, though? <strong>Not so much.</strong></p><p>Bills show up one by one, <strong>papers start piling up</strong>, and suddenly you're sorting, checking what came in, what's paid, and what's still outstanding...</p><p>Then you've got to gather everything, send it to the tenant, and keep track of whether they paid. <strong>It's boring, and it needs you to be annoyingly precise.</strong></p>",
|
||||
"go-to-app": "Go to the App",
|
||||
"in-app-browser-warning": "<strong>WARNING!</strong> We detected that the website is opened in an in-app browser. This may cause issues with this web application. <hint>Please open the web application in a regular web browser (rezije.app) 😉</hint>",
|
||||
"image-url": "/man-burried-under-paper.png",
|
||||
"image-url": "/man-burried-under-paper-400.png",
|
||||
"image-alt": "Man buried under papers",
|
||||
"video-url": "/welcome-demo-vp9-25fps-1500bps.webm",
|
||||
"video-title": "Demo of basic steps in the application"
|
||||
@@ -31,13 +31,13 @@
|
||||
"title": "Can it get better?",
|
||||
"text": "<p>You're in luck - <strong>rezije.app</strong> is a free tool built to <strong>solve exactly these problems</strong>!</p><p>This tool will enable you to easily and <strong>clearly track due and paid bills</strong>. All digital, efficient, and meticulous!</p><p>In addition, this tool offers the possibility of <strong>automatic sending</strong> of monthly statements to tenants, which includes a barcode for quick <strong>payment of rent and utilities to your IBAN or Revolut.</strong></p>",
|
||||
"video-url": "/kopiranje-mjeseca-demo.webm",
|
||||
"image-url": "/robot-sorting-papers.png",
|
||||
"image-url": "/robot-sorting-papers-400.png",
|
||||
"image-alt": "Robot sorting papers",
|
||||
"video-title": "Demo of month copying"
|
||||
},
|
||||
"card-2": {
|
||||
"title": "What do I need to get started?",
|
||||
"text": "<p>You don't need to fill out registration forms or confirm your email address.</p><p>All you need is a <strong>Gmail account to sign in</strong> and you can start using the tool right away - <strong>turnkey solution!</strong></p>"
|
||||
"text": "<p>All you need is a <strong>Gmail account to sign in</strong> and you can start using the tool right away!</p><p>You don't need to fill out registration forms or confirm your email address - it's a <strong>turnkey solution!</strong></p>"
|
||||
},
|
||||
"sign-in-button": "Sign in with",
|
||||
"disclaimer": "<disclaimer><bold>Note:</bold> by signing in to this web application, you accept the <linkTermsOfService>Terms of Service</linkTermsOfService> and <linkPrivacyPolicy>Privacy Policy</linkPrivacyPolicy>.</disclaimer>"
|
||||
|
||||
@@ -22,22 +22,22 @@
|
||||
"text": "<p>Svima koji imaju rentaju stan ili kuću, <strong>najdraži trenutak</strong> je kada podstanar plati najam. Vođenje režija međutim je <strong>mrzak posao</strong>.</p><p>Računi kapaju jedan po jedan, <strong>papiri se gomilaju</strong>, treba ih razvrstati, pratiti što je stiglo, što je plaćeno, a što nije...</p><p>Slijedi prikupljanje i <strong>slanje računa podstanaru</strong>, vođenje evidencije o tome je li platio ... dosadan posao koji <strong>traži preciznost</strong>.</p><p></p>",
|
||||
"go-to-app": "Uđi u Aplikaciju",
|
||||
"in-app-browser-warning": "<strong>UPOZORENJE!</strong> Detektirali smo da je web stranica otvorena u in-app pregledniku. To može dovesti do probleme u radu ove web aplikacije. <hint>Molimo otvori web aplikaciju u normalnom web pregledniku (rezije.app) 😉</hint>",
|
||||
"image-url": "/man-burried-under-paper.png",
|
||||
"image-url": "/man-burried-under-paper-400.png",
|
||||
"image-alt": "Čovjek zatrpan papirima",
|
||||
"video-url": "/welcome-demo-vp9-25fps-1500bps.webm",
|
||||
"video-title": "Demo osnovnih koraka u aplikaciji"
|
||||
},
|
||||
"card-1": {
|
||||
"title": "Može li bolje?",
|
||||
"text": "<p>Imate sreće - <strong>režije.app</strong> je besplatni alat je izrađen da <strong>rješava upravo navedene probleme</strong>!</p><p>Ovaj alat će vam omogućiti laku i <strong>preglednu evidenciju dospjelih i plaćenih računa</strong>. Sve digitalno, efikasno i pedantno!</p><p>Uz to ovaj alat nudi moogućnost <strong>automatskog slanja</strong> mjesečnog obračuna podstanarima, koji uključuje bar koda za brzo <strong>plaćanje najamnine i režija na vaš IBAN ili Revolute.</strong></p>",
|
||||
"text": "<p>Imate sreće - <strong>režije.app</strong> je besplatna aplikacija je izrađen da <strong>rješava upravo navedene probleme</strong>!</p><p>Ova aplikacija će vam omogućiti laku i <strong>preglednu evidenciju dospjelih i plaćenih računa</strong>. Sve digitalno, efikasno i pedantno!</p><p>Uz to ovu aplikaciju nudi moogućnost <strong>automatskog slanja</strong> mjesečnog obračuna podstanarima, koji uključuje bar koda za brzo <strong>plaćanje najamnine i režija na vaš IBAN ili Revolute.</strong></p>",
|
||||
"video-url": "/kopiranje-mjeseca-demo.webm",
|
||||
"image-url": "/robot-sorting-papers.png",
|
||||
"image-url": "/robot-sorting-papers-400.png",
|
||||
"image-alt": "Robot sortira papire",
|
||||
"video-title": "Demo kopiranja mjeseca"
|
||||
},
|
||||
"card-2": {
|
||||
"title": "Što mi treba za početak?",
|
||||
"text": "<p>Ne morate popunjavati formulate za registraciju, ni potvrđivati svoju email adresu.</p><p>Dovoljan je samo <strong>Gmail račun za prijavu</strong> i možete odmah početi koristi alat - <strong>sjedi i vozi, ključ u ruke!</strong></p>"
|
||||
"text": "<p>Dovoljan je samo <strong>Gmail račun za prijavu</strong> i možete odmah početi koristiti aplikaciju!</p><p>Ne morate popunjavati formulate za registraciju, ni potvrđivati svoju email adresu - <strong>sjedi i vozi, ključ u ruke!</strong></p>"
|
||||
},
|
||||
"sign-in-button": "Prijavi se pomoću",
|
||||
"disclaimer": "<disclaimer><bold>Napomena:</bold> činom prijave u ovu web aplikaciju prihvaćate <linkTermsOfService>Uvjete korištenja</linkTermsOfService> i <linkPrivacyPolicy>Pravila privatnosti</linkPrivacyPolicy>.</disclaimer>"
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "evidencija-rezija",
|
||||
"version": "2.19.0",
|
||||
"version": "2.20.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"version": "2.19.0",
|
||||
"version": "2.20.3",
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.14.0",
|
||||
"@emotion/styled": "^11.14.1",
|
||||
|
||||
@@ -58,5 +58,5 @@
|
||||
"engines": {
|
||||
"node": ">=18.17.0"
|
||||
},
|
||||
"version": "2.19.0"
|
||||
"version": "2.20.3"
|
||||
}
|
||||
|
||||
BIN
public/man-burried-under-paper-400.png
Normal file
BIN
public/man-burried-under-paper-400.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
BIN
public/robot-sorting-papers-400.png
Normal file
BIN
public/robot-sorting-papers-400.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Reference in New Issue
Block a user