Skip to content

Commit 863a596

Browse files
fix: add back button to all screens (#46) (#61)
* fix: add back button to all screens * fix: remove wrap * fix: change wraps and add back buttons
1 parent d9ed162 commit 863a596

File tree

12 files changed

+71
-18
lines changed

12 files changed

+71
-18
lines changed

apps/web/src/app/maintenance/edit/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useParams, useNavigate } from "react-router-dom";
22
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3+
import { BackButton } from "@/components/back-button";
34
import {
45
getMaintenancesByIdOptions,
56
getMaintenancesByIdQueryKey,
@@ -151,6 +152,7 @@ const EditMaintenance = () => {
151152

152153
return (
153154
<Layout pageName={`Edit Maintenance: ${maintenance?.title}`}>
155+
<BackButton to="/maintenances" />
154156
<CreateEditMaintenance
155157
initialValues={initialValues}
156158
mode="edit"

apps/web/src/app/maintenance/new/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Layout from "@/layout";
22
import CreateEditMaintenance, {
33
type MaintenanceFormValues,
44
} from "../components/create-edit-form";
5+
import { BackButton } from "@/components/back-button";
56
import {
67
getMaintenancesQueryKey,
78
postMaintenancesMutation,
@@ -82,6 +83,7 @@ const NewMaintenance = () => {
8283

8384
return (
8485
<Layout pageName="Schedule Maintenance">
86+
<BackButton to="/maintenances" />
8587
<CreateEditMaintenance onSubmit={handleSubmit} />
8688
</Layout>
8789
);

apps/web/src/app/monitors/edit/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import CreateEditForm from "../components/create-edit-form";
1414
import type { NotificationChannelModel, ProxyModel } from "@/api";
1515
import CreateProxy from "@/app/proxies/components/create-proxy";
1616
import CreateNotificationChannel from "@/app/notification-channels/components/create-notification-channel";
17+
import { BackButton } from "@/components/back-button";
1718

1819
const EditMonitorForm = () => {
1920
const {
@@ -29,7 +30,8 @@ const EditMonitorForm = () => {
2930
if (!monitor) return null;
3031

3132
return (
32-
<Layout pageName={`Edit Monitor | ${monitor?.data?.name}`}>
33+
<Layout pageName={`Edit Monitor: ${monitor?.data?.name}`}>
34+
<BackButton to={`/monitors/${monitor?.data?.id}`} />
3335
<div className="flex flex-col gap-4">
3436
<p className="text-gray-500">
3537
Create a new monitor to start tracking your website's performance.

apps/web/src/app/monitors/new/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Layout from "@/layout";
22
import { Sheet, SheetContent } from "@/components/ui/sheet";
3+
import { BackButton } from "@/components/back-button";
34
import {
45
MonitorFormProvider,
56
useMonitorFormContext,
@@ -24,6 +25,7 @@ const NewMonitorContent = () => {
2425

2526
return (
2627
<Layout pageName="New Monitor">
28+
<BackButton to="/monitors" />
2729
<div className="flex flex-col gap-4">
2830
<p className="text-gray-500">
2931
Create a new monitor to start tracking your website's performance.

apps/web/src/app/monitors/view/page.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { useWebSocket, WebSocketStatus } from "@/context/websocket-context";
2929
import Layout from "@/layout";
3030
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3131
import {
32-
ArrowLeft,
3332
Copy,
3433
Edit,
3534
Loader2,
@@ -43,6 +42,7 @@ import { useNavigate, useParams } from "react-router-dom";
4342
import { toast } from "sonner";
4443
import { cn, commonMutationErrorHandler } from "@/lib/utils";
4544
import ImportantNotificationsList from "../components/important-notifications-list";
45+
import { BackButton } from "@/components/back-button";
4646

4747
const MonitorPage = () => {
4848
const { id } = useParams();
@@ -295,21 +295,12 @@ const MonitorPage = () => {
295295

296296
return (
297297
<Layout
298-
pageName={`Monitors > ${monitor?.name ?? ""}`}
298+
pageName={`Monitors: ${monitor?.name ?? ""}`}
299299
isLoading={isLoading}
300300
error={error && <div>Error: {error.message}</div>}
301301
>
302302
<div>
303-
<div>
304-
<Button
305-
variant="ghost"
306-
onClick={() => navigate("/monitors")}
307-
className="mb-4 "
308-
>
309-
<ArrowLeft />
310-
Back
311-
</Button>
312-
</div>
303+
<BackButton to="/monitors" />
313304
<div className="pl-4">
314305
<span className="text-sm text-muted-foreground mr-2">
315306
{monitor?.type} monitor for

apps/web/src/app/notification-channels/edit/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useParams, useNavigate } from "react-router-dom";
22
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
3+
import { BackButton } from "@/components/back-button";
34
import {
45
getNotificationChannelsByIdOptions,
56
getNotificationChannelsByIdQueryKey,
@@ -65,7 +66,8 @@ const EditNotificationChannel = () => {
6566
};
6667

6768
return (
68-
<Layout pageName={`Edit Notifier: ${notifier.name}`}>
69+
<Layout pageName={`Edit Notification Channel: ${notifier.name}`}>
70+
<BackButton to="/notification-channels" />
6971
<CreateEditNotificationChannel
7072
initialValues={initialValues}
7173
onSubmit={handleSubmit}

apps/web/src/app/notification-channels/new/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import Layout from "@/layout";
22
import { useNavigate } from "react-router-dom";
33
import CreateNotificationChannel from "../components/create-notification-channel";
4+
import { BackButton } from "@/components/back-button";
45

56
const NewNotificationChannel = () => {
67
const navigate = useNavigate();
78

89
return (
9-
<Layout pageName="New Notification channel">
10+
<Layout pageName="New Notification Channel">
11+
<BackButton to="/notification-channels" />
1012
<CreateNotificationChannel onSuccess={() => navigate("/notification-channels")} />
1113
</Layout>
1214
);

apps/web/src/app/proxies/edit/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useParams, useNavigate } from "react-router-dom";
22
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
3+
import { BackButton } from "@/components/back-button";
34
import {
45
getProxiesByIdOptions,
56
putProxiesByIdMutation,
@@ -79,6 +80,7 @@ const EditProxy = () => {
7980

8081
return (
8182
<Layout pageName={`Edit Proxy: ${proxy.host}:${proxy.port}`}>
83+
<BackButton to="/proxies" />
8284
<CreateEditProxy
8385
initialValues={initialValues}
8486
onSubmit={handleSubmit}

apps/web/src/app/proxies/new/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import Layout from "@/layout";
22
import { useNavigate } from "react-router-dom";
33
import CreateProxy from "../components/create-proxy";
4+
import { BackButton } from "@/components/back-button";
45

56
const NewProxy = () => {
67
const navigate = useNavigate();
78

89
return (
910
<Layout pageName="New Proxy">
11+
<BackButton to="/proxies" />
1012
<CreateProxy onSuccess={() => navigate("/proxies")} />
1113
</Layout>
1214
);

apps/web/src/app/status-pages/edit/page.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Layout from "@/layout";
22
import CreateEditForm, { type StatusPageForm } from "../components/create-edit-form";
33
import { useNavigate, useParams } from "react-router-dom";
4+
import { BackButton } from "@/components/back-button";
45
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
56
import {
67
getMonitorsBatchOptions,
@@ -62,17 +63,26 @@ const EditStatusPageContent = () => {
6263
});
6364

6465
if (statusPageIsLoading || monitorsDataIsLoading) {
65-
return <div>Loading...</div>;
66+
return (
67+
<Layout pageName="Edit Status Page">
68+
<div>Loading...</div>
69+
</Layout>
70+
);
6671
}
6772

6873
if (!statusPage?.data) {
69-
return <div>Status page not found</div>;
74+
return (
75+
<Layout pageName="Edit Status Page">
76+
<div>Status page not found</div>
77+
</Layout>
78+
);
7079
}
7180

7281
const statusPageData = statusPage?.data;
7382

7483
return (
75-
<Layout pageName="Edit Status Page">
84+
<Layout pageName={`Edit Status Page: ${statusPageData.title}`}>
85+
<BackButton to="/status-pages" />
7686
<div className="flex flex-col gap-4">
7787
<p className="text-gray-500">
7888
Update your status page settings and configuration.

0 commit comments

Comments
 (0)