From ddf65b6d48003c2d98a49a2451ea7ec0fc38321d Mon Sep 17 00:00:00 2001
From: Alvis <37454764+avibn@users.noreply.github.com>
Date: Fri, 12 Apr 2024 11:39:01 +0100
Subject: [PATCH] fix bugs
---
client/.env.production.sample | 2 +-
.../home/(leases)/latest-leases-card.tsx | 1 +
.../home/(messages)/latest-messages-card.tsx | 2 +-
.../app/(dashboard)/(both)/home/loading.tsx | 5 ++
.../(details)/lease-details-card.tsx | 1 +
.../(both)/leases/invite/loading.tsx | 5 ++
.../app/(dashboard)/(both)/leases/page.tsx | 5 +-
.../(both)/maintenance/loading.tsx | 5 ++
.../(both)/maintenance/requests-table.tsx | 2 +-
.../(dashboard)/(both)/messages/loading.tsx | 5 ++
.../app/(dashboard)/(both)/messages/page.tsx | 2 +-
.../(dashboard)/(both)/settings/loading.tsx | 5 ++
.../[propertyID]/delete-property-client.tsx | 2 +-
.../(landlord)/properties/page.tsx | 2 +
.../(landlord)/tenants/tenants-table.tsx | 2 +-
.../src/app/documents/[documentID]/page.tsx | 4 +-
client/src/app/login/page.tsx | 2 +-
client/src/app/page.tsx | 8 +--
client/src/components/buttons/icon-button.tsx | 2 +-
client/src/components/buttons/main-button.tsx | 2 +-
.../components/forms/create-lease-form.tsx | 1 +
client/src/components/loading-spinner.tsx | 19 +++++-
client/src/components/sidebar.tsx | 9 ++-
client/src/middleware.ts | 2 +
client/src/network/server/users.ts | 3 +-
docker-compose.dev.yml | 58 +++++++++----------
26 files changed, 106 insertions(+), 50 deletions(-)
create mode 100644 client/src/app/(dashboard)/(both)/home/loading.tsx
create mode 100644 client/src/app/(dashboard)/(both)/leases/invite/loading.tsx
create mode 100644 client/src/app/(dashboard)/(both)/maintenance/loading.tsx
create mode 100644 client/src/app/(dashboard)/(both)/messages/loading.tsx
create mode 100644 client/src/app/(dashboard)/(both)/settings/loading.tsx
diff --git a/client/.env.production.sample b/client/.env.production.sample
index 659ffaf..e7c8bee 100644
--- a/client/.env.production.sample
+++ b/client/.env.production.sample
@@ -2,4 +2,4 @@
NEXT_PUBLIC_BASE_URL=https://lanten.site/api
# Server URL
-SERVER_BASE_URL=http://server:5000
\ No newline at end of file
+SERVER_BASE_URL=https://lanten.site/api
\ No newline at end of file
diff --git a/client/src/app/(dashboard)/(both)/home/(leases)/latest-leases-card.tsx b/client/src/app/(dashboard)/(both)/home/(leases)/latest-leases-card.tsx
index 63989b8..90d6ec2 100644
--- a/client/src/app/(dashboard)/(both)/home/(leases)/latest-leases-card.tsx
+++ b/client/src/app/(dashboard)/(both)/home/(leases)/latest-leases-card.tsx
@@ -43,6 +43,7 @@ export async function LatestLeasesCard() {
diff --git a/client/src/app/(dashboard)/(both)/home/(messages)/latest-messages-card.tsx b/client/src/app/(dashboard)/(both)/home/(messages)/latest-messages-card.tsx
index 8f6df5b..2a53448 100644
--- a/client/src/app/(dashboard)/(both)/home/(messages)/latest-messages-card.tsx
+++ b/client/src/app/(dashboard)/(both)/home/(messages)/latest-messages-card.tsx
@@ -35,7 +35,7 @@ export async function LatestMessagesCard() {
)}
{messageChannels.map((user) => (
-
+
diff --git a/client/src/app/(dashboard)/(both)/home/loading.tsx b/client/src/app/(dashboard)/(both)/home/loading.tsx
new file mode 100644
index 0000000..658d3df
--- /dev/null
+++ b/client/src/app/(dashboard)/(both)/home/loading.tsx
@@ -0,0 +1,5 @@
+import LoadingSpinner from "@/components/loading-spinner";
+
+export default function Loading() {
+ return ;
+}
diff --git a/client/src/app/(dashboard)/(both)/leases/[leaseID]/(details)/lease-details-card.tsx b/client/src/app/(dashboard)/(both)/leases/[leaseID]/(details)/lease-details-card.tsx
index 8b77a12..7975979 100644
--- a/client/src/app/(dashboard)/(both)/leases/[leaseID]/(details)/lease-details-card.tsx
+++ b/client/src/app/(dashboard)/(both)/leases/[leaseID]/(details)/lease-details-card.tsx
@@ -44,6 +44,7 @@ export default function LeaseDetailsCard({ lease }: LeaseDetailsCardProps) {
{lease.property?.name}
diff --git a/client/src/app/(dashboard)/(both)/leases/invite/loading.tsx b/client/src/app/(dashboard)/(both)/leases/invite/loading.tsx
new file mode 100644
index 0000000..658d3df
--- /dev/null
+++ b/client/src/app/(dashboard)/(both)/leases/invite/loading.tsx
@@ -0,0 +1,5 @@
+import LoadingSpinner from "@/components/loading-spinner";
+
+export default function Loading() {
+ return ;
+}
diff --git a/client/src/app/(dashboard)/(both)/leases/page.tsx b/client/src/app/(dashboard)/(both)/leases/page.tsx
index bff1b73..7de5016 100644
--- a/client/src/app/(dashboard)/(both)/leases/page.tsx
+++ b/client/src/app/(dashboard)/(both)/leases/page.tsx
@@ -44,8 +44,11 @@ export default async function Page() {
+ {activeLeases.length === 0 && (
+
No active leases found.
+ )}
{activeLeases.map((lease) => (
-
+
diff --git a/client/src/app/(dashboard)/(both)/maintenance/loading.tsx b/client/src/app/(dashboard)/(both)/maintenance/loading.tsx
new file mode 100644
index 0000000..658d3df
--- /dev/null
+++ b/client/src/app/(dashboard)/(both)/maintenance/loading.tsx
@@ -0,0 +1,5 @@
+import LoadingSpinner from "@/components/loading-spinner";
+
+export default function Loading() {
+ return
;
+}
diff --git a/client/src/app/(dashboard)/(both)/maintenance/requests-table.tsx b/client/src/app/(dashboard)/(both)/maintenance/requests-table.tsx
index 639d99b..a0a2e27 100644
--- a/client/src/app/(dashboard)/(both)/maintenance/requests-table.tsx
+++ b/client/src/app/(dashboard)/(both)/maintenance/requests-table.tsx
@@ -145,7 +145,7 @@ export const columns: ColumnDef
[] = [
const lease = row.getValue("lease") as Partial;
return (
diff --git a/client/src/app/(dashboard)/(both)/messages/loading.tsx b/client/src/app/(dashboard)/(both)/messages/loading.tsx
new file mode 100644
index 0000000..658d3df
--- /dev/null
+++ b/client/src/app/(dashboard)/(both)/messages/loading.tsx
@@ -0,0 +1,5 @@
+import LoadingSpinner from "@/components/loading-spinner";
+
+export default function Loading() {
+ return ;
+}
diff --git a/client/src/app/(dashboard)/(both)/messages/page.tsx b/client/src/app/(dashboard)/(both)/messages/page.tsx
index 88f7587..8086bca 100644
--- a/client/src/app/(dashboard)/(both)/messages/page.tsx
+++ b/client/src/app/(dashboard)/(both)/messages/page.tsx
@@ -34,7 +34,7 @@ export default async function Page() {
)}
{messageChannels.map((channel) => (
-
+
;
+}
diff --git a/client/src/app/(dashboard)/(landlord)/properties/[propertyID]/delete-property-client.tsx b/client/src/app/(dashboard)/(landlord)/properties/[propertyID]/delete-property-client.tsx
index 9431f99..55a6284 100644
--- a/client/src/app/(dashboard)/(landlord)/properties/[propertyID]/delete-property-client.tsx
+++ b/client/src/app/(dashboard)/(landlord)/properties/[propertyID]/delete-property-client.tsx
@@ -53,7 +53,7 @@ export function DeletePropertyClient({
{leases.map((lease) => (
-
-
+
{" "}
{formatTimeToDateString(
lease.startDate
diff --git a/client/src/app/(dashboard)/(landlord)/properties/page.tsx b/client/src/app/(dashboard)/(landlord)/properties/page.tsx
index 51c2f4a..f1853be 100644
--- a/client/src/app/(dashboard)/(landlord)/properties/page.tsx
+++ b/client/src/app/(dashboard)/(landlord)/properties/page.tsx
@@ -45,6 +45,7 @@ export default async function Page() {
Create
{" "}
@@ -57,6 +58,7 @@ export default async function Page() {
key={property.id}
href={`/properties/${property.id}`}
className="flex-grow flex-shrink basis-0 max-w-80"
+ prefetch={false}
>
diff --git a/client/src/app/(dashboard)/(landlord)/tenants/tenants-table.tsx b/client/src/app/(dashboard)/(landlord)/tenants/tenants-table.tsx
index bc0fa13..97d9873 100644
--- a/client/src/app/(dashboard)/(landlord)/tenants/tenants-table.tsx
+++ b/client/src/app/(dashboard)/(landlord)/tenants/tenants-table.tsx
@@ -138,7 +138,7 @@ export const columns: ColumnDef
[] = [
const lease = row.getValue("lease") as Partial;
return (
diff --git a/client/src/app/documents/[documentID]/page.tsx b/client/src/app/documents/[documentID]/page.tsx
index 44e5833..d75b371 100644
--- a/client/src/app/documents/[documentID]/page.tsx
+++ b/client/src/app/documents/[documentID]/page.tsx
@@ -35,7 +35,7 @@ export default async function Page({ params: { documentID } }: PageProps) {
If the document does not open, click{" "}
.
@@ -46,7 +46,7 @@ export default async function Page({ params: { documentID } }: PageProps) {
Click{" "}
{" "}
to go back to the dashboard.
diff --git a/client/src/app/login/page.tsx b/client/src/app/login/page.tsx
index c1dfe60..ecec6f8 100644
--- a/client/src/app/login/page.tsx
+++ b/client/src/app/login/page.tsx
@@ -19,7 +19,7 @@ export default async function Page({ searchParams }: PageProps) {
return (
<>
-
+
-
+
@@ -42,7 +42,7 @@ export default async function Home() {
{icon}
- )) || {icon}
+ )) || {icon}
) : (
icon
)}
diff --git a/client/src/components/buttons/main-button.tsx b/client/src/components/buttons/main-button.tsx
index 2a14e4a..b3baf1f 100644
--- a/client/src/components/buttons/main-button.tsx
+++ b/client/src/components/buttons/main-button.tsx
@@ -37,7 +37,7 @@ export function MainButton({
icon,
href,
onClick,
- linkPrefetch = true,
+ linkPrefetch = false,
linkProps = {},
}: MainButtonProps) {
const buttonContent = (
diff --git a/client/src/components/forms/create-lease-form.tsx b/client/src/components/forms/create-lease-form.tsx
index 8568554..3a4dd72 100644
--- a/client/src/components/forms/create-lease-form.tsx
+++ b/client/src/components/forms/create-lease-form.tsx
@@ -59,6 +59,7 @@ export function CreateLeaseForm({
create a new property
diff --git a/client/src/components/loading-spinner.tsx b/client/src/components/loading-spinner.tsx
index 3dea172..67fa97f 100644
--- a/client/src/components/loading-spinner.tsx
+++ b/client/src/components/loading-spinner.tsx
@@ -1,12 +1,27 @@
import { cn } from "@/utils/tw-merge";
interface LoadingSpinnerProps {
- size?: number;
+ size?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
loadingText?: string;
textOff?: boolean;
className?: string;
}
+// Specify tailwind classes so tailwind builds these classes
+// https://stackoverflow.com/questions/71886011/why-tailwind-dynamic-class-is-not-present
+const sizeToTwClasses = {
+ 1: "w-1 h-1",
+ 2: "w-2 h-2",
+ 3: "w-3 h-3",
+ 4: "w-4 h-4",
+ 5: "w-5 h-5",
+ 6: "w-6 h-6",
+ 7: "w-7 h-7",
+ 8: "w-8 h-8",
+ 9: "w-9 h-9",
+ 10: "w-10 h-10",
+};
+
export default function LoadingSpinner({
size = 8,
loadingText = "Loading...",
@@ -21,7 +36,7 @@ export default function LoadingSpinner({