Skip to content

Commit

Permalink
feat: Basic features page + accidentally linted it all
Browse files Browse the repository at this point in the history
  • Loading branch information
noahgerard committed Aug 30, 2024
1 parent 0801ac1 commit b17efd7
Show file tree
Hide file tree
Showing 17 changed files with 325 additions and 183 deletions.
7 changes: 7 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ const config = {
serverComponentsExternalPackages: ["@node-rs/argon2"],
},
transpilePackages: ["geist"],
images: {
remotePatterns: [
{
hostname: "upload.wikimedia.org",
}
]
}
};

export default config;
44 changes: 16 additions & 28 deletions src/app/_components/dashboard/devices/AddDeviceDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
"use client";

import { Button, Flex, Text, Dialog, TextField, Select } from "@radix-ui/themes";
import {
Button,
Flex,
Text,
Dialog,
TextField,
Select,
} from "@radix-ui/themes";
import { useAtom } from "jotai";
import { useState } from "react";
import toast from "react-hot-toast";
Expand Down Expand Up @@ -74,50 +81,31 @@ export default function AddDeviceDialog({ refetch }: { refetch: () => void }) {
return (
<Dialog.Root open={dialogOpen} onOpenChange={setDialogOpen}>
<Dialog.Trigger onClick={() => setDialogOpen(!dialogOpen)}>
<Button
variant="solid"
>
New Device
</Button>
<Button variant="solid">New Device</Button>
</Dialog.Trigger>
<Dialog.Content maxWidth={"400px"}>
<Dialog.Title>
Add A New Device
</Dialog.Title>
<Dialog.Title>Add A New Device</Dialog.Title>

<Flex direction={"column"} gap={"2"}>
<Text size={"3"}>
Device Name
</Text>
<Text size={"3"}>Device Name</Text>
<TextField.Root
value={deviceName}
placeholder="Your device name..."
onChange={(e) =>
setDeviceName(e.target.value)
}
onChange={(e) => setDeviceName(e.target.value)}
required
className="w-full"
/>
<Text size={"3"}>
Device Type
</Text>
<Select.Root
onValueChange={(e) =>
setDeviceType(e)
}
>
<Text size={"3"}>Device Type</Text>
<Select.Root onValueChange={(e) => setDeviceType(e)}>
<Select.Trigger
variant="surface"
className="z-10"
value={deviceType || "Phone"}
>
</Select.Trigger>
></Select.Trigger>
<Select.Content>
<Select.Group>

{deviceTypes.map((type, i) => (
<Select.Item value={type.id}
key={i}>
<Select.Item value={type.id} key={i}>
{type.name}
</Select.Item>
))}
Expand Down
16 changes: 8 additions & 8 deletions src/app/_components/dashboard/devices/DeleteDeviceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ interface DeleteDeviceProps {
deviceId: string;
}

export default function DeleteDeviceDialog({ refetch, deviceId }: DeleteDeviceProps) {
export default function DeleteDeviceDialog({
refetch,
deviceId,
}: DeleteDeviceProps) {
const [user] = useAtom(userAtom);

const [dialogOpen, setDialogOpen] = useState<boolean>(false);
Expand Down Expand Up @@ -52,7 +55,7 @@ export default function DeleteDeviceDialog({ refetch, deviceId }: DeleteDevicePr

setDeletingDevice(false);
setDialogOpen(false);
}
},
});

useEffect(() => {
Expand Down Expand Up @@ -96,19 +99,16 @@ export default function DeleteDeviceDialog({ refetch, deviceId }: DeleteDevicePr
</Button>
</Dialog.Trigger>
<Dialog.Content maxWidth={"400px"}>
<Dialog.Title align={"center"}>
Delete Your Device
</Dialog.Title>
<Dialog.Title align={"center"}>Delete Your Device</Dialog.Title>

<div className="flex flex-col gap-2">
<div className="flex flex-col text-center">
<p className="text-red-400">
This is a destructive action.
</p>{" "}
<p>
All device data for this device
will be deleted. Are you
sure you want to delete this device?
All device data for this device will be deleted. Are
you sure you want to delete this device?
</p>
</div>
<div className="mt-2 flex items-center justify-between">
Expand Down
4 changes: 2 additions & 2 deletions src/app/_components/dashboard/devices/DeviceButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export default function DeviceButtons({ deviceId }: { deviceId: string }) {
refetch={() => deviceQuery.refetch()}
deviceId={deviceId}
/>
<DeleteDeviceDialog
refetch={()=> deviceQuery.refetch()}
<DeleteDeviceDialog
refetch={() => deviceQuery.refetch()}
deviceId={deviceId}
/>
</div>
Expand Down
48 changes: 21 additions & 27 deletions src/app/_components/dashboard/devices/EditDeviceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@
// edit device dialog
// TODO: update select so it shows current device type on open

import { Button, Flex, Dialog, Text, TextField, Select } from "@radix-ui/themes";
import {
Button,
Flex,
Dialog,
Text,
TextField,
Select,
} from "@radix-ui/themes";
import { useAtom } from "jotai";
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
Expand Down Expand Up @@ -121,22 +128,18 @@ export default function EditDeviceDialog({
</Button>
</Dialog.Trigger>
<Dialog.Content maxWidth={"400px"}>
<Dialog.Title>
Edit Your Device
</Dialog.Title>
<Dialog.Title>Edit Your Device</Dialog.Title>

<Flex direction={"column"} gap={"2"}>
<Text size={"3"}>
Device Name
</Text>
<div className="relative flex w-full
flex-row items-center justify-end">
<Text size={"3"}>Device Name</Text>
<div
className="relative flex w-full
flex-row items-center justify-end"
>
<TextField.Root
value={deviceName}
placeholder="Your device name..."
onChange={(e) =>
setDeviceName(e.target.value)
}
onChange={(e) => setDeviceName(e.target.value)}
required
disabled={!nameToggle}
className="w-full"
Expand All @@ -148,31 +151,22 @@ export default function EditDeviceDialog({
setNameToggle(!nameToggle);
}}
>
{!nameToggle && <RxPencil1/>}
{nameToggle && <FaCheck/>}
{!nameToggle && <RxPencil1 />}
{nameToggle && <FaCheck />}
</button>
</div>

<Text size={"3"}>
Device Type
</Text>
<Select.Root
onValueChange={(e) =>
setDeviceType(e)
}
>
<Text size={"3"}>Device Type</Text>
<Select.Root onValueChange={(e) => setDeviceType(e)}>
<Select.Trigger
variant="surface"
className="z-10"
value={deviceType || "Phone"}
>
</Select.Trigger>
></Select.Trigger>
<Select.Content>
<Select.Group>

{deviceTypes.map((type, i) => (
<Select.Item value={type.id}
key={i}>
<Select.Item value={type.id} key={i}>
{type.name}
</Select.Item>
))}
Expand Down
26 changes: 6 additions & 20 deletions src/app/_components/dashboard/groups/CreateGroupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,25 @@ export default function CreateGroupDialog({
return (
<Dialog.Root open={dialogOpen} onOpenChange={setDialogOpen}>
<Dialog.Trigger onClick={() => setDialogOpen(!dialogOpen)}>
<Button
variant="solid"
>
New Group
</Button>
<Button variant="solid">New Group</Button>
</Dialog.Trigger>
<Dialog.Content maxWidth={"400px"}>
<Dialog.Title>
Add A New Group
</Dialog.Title>
<Dialog.Title>Add A New Group</Dialog.Title>

<Flex direction={"column"} gap={"2"}>
<Text size={"3"}>
Group Name
</Text>
<Text size={"3"}>Group Name</Text>
<TextField.Root
value={groupName}
placeholder="Your group name..."
onChange={(e) =>
setGroupName(e.target.value)
}
onChange={(e) => setGroupName(e.target.value)}
required
className="w-full"
/>
<Text size={"3"}>
Group Description
</Text>
<Text size={"3"}>Group Description</Text>
<TextField.Root
value={groupDescription}
placeholder="Your group description..."
onChange={(e) =>
setGroupDescription(e.target.value)
}
onChange={(e) => setGroupDescription(e.target.value)}
required
className="w-full"
/>
Expand Down
18 changes: 9 additions & 9 deletions src/app/_components/dashboard/groups/DeleteGroupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ interface DeleteGroupProps {
groupId: string;
}

export default function DeleteGroupDialog({ refetch, groupId }: DeleteGroupProps) {
export default function DeleteGroupDialog({
refetch,
groupId,
}: DeleteGroupProps) {
const [user, setUser] = useAtom(userAtom);

const [dialogOpen, setDialogOpen] = useState(false);
Expand Down Expand Up @@ -49,7 +52,7 @@ export default function DeleteGroupDialog({ refetch, groupId }: DeleteGroupProps

setDeletingGroup(false);
setDialogOpen(false);
}
},
});

useEffect(() => {
Expand Down Expand Up @@ -93,20 +96,17 @@ export default function DeleteGroupDialog({ refetch, groupId }: DeleteGroupProps
</Button>
</Dialog.Trigger>
<Dialog.Content maxWidth={"400px"}>
<Dialog.Title align={"center"}>
Delete Your Group
</Dialog.Title>
<Dialog.Title align={"center"}>Delete Your Group</Dialog.Title>

<div className="flex flex-col gap-2">
<div className="flex flex-col text-center">
<p className="text-red-400">
This is a destructive action.
</p>{" "}
<p>
All group data for this group, including places and
connected members, &#40;not member data&#41;
will be deleted. Are you sure you want to delete
this group?
All group data for this group, including places and
connected members, &#40;not member data&#41; will be
deleted. Are you sure you want to delete this group?
</p>
</div>
<div className="mt-2 flex items-center justify-between">
Expand Down
38 changes: 17 additions & 21 deletions src/app/_components/dashboard/groups/EditGroupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,18 @@ export default function EditGroupDialog({ refetch, groupId }: EditGroupProps) {
</Button>
</Dialog.Trigger>
<Dialog.Content maxWidth={"400px"}>
<Dialog.Title>
Edit Your Group
</Dialog.Title>
<Dialog.Title>Edit Your Group</Dialog.Title>

<Flex direction={"column"} gap={"2"}>
<Text size={"3"}>
Group Name
</Text>
<div className="relative flex w-full
flex-row items-center justify-end">
<Text size={"3"}>Group Name</Text>
<div
className="relative flex w-full
flex-row items-center justify-end"
>
<TextField.Root
value={groupName}
placeholder="Your device name..."
onChange={(e) =>
setGroupName(e.target.value)
}
onChange={(e) => setGroupName(e.target.value)}
required
disabled={!nameToggle}
className="w-full"
Expand All @@ -143,20 +139,20 @@ export default function EditGroupDialog({ refetch, groupId }: EditGroupProps) {
setNameToggle(!nameToggle);
}}
>
{!nameToggle && <RxPencil1/>}
{nameToggle && <FaCheck/>}
{!nameToggle && <RxPencil1 />}
{nameToggle && <FaCheck />}
</button>
</div>

<Text size={"3"}>
Group Description
</Text>
<div className="relative flex w-full
flex-row items-center justify-end">
<Text size={"3"}>Group Description</Text>
<div
className="relative flex w-full
flex-row items-center justify-end"
>
<TextField.Root
value={groupDescription}
placeholder="Your device description..."
onChange={(e) =>
onChange={(e) =>
setGroupDescription(e.target.value)
}
required
Expand All @@ -170,8 +166,8 @@ export default function EditGroupDialog({ refetch, groupId }: EditGroupProps) {
setDescToggle(!descToggle);
}}
>
{!descToggle && <RxPencil1/>}
{descToggle && <FaCheck/>}
{!descToggle && <RxPencil1 />}
{descToggle && <FaCheck />}
</button>
</div>
<div
Expand Down
Loading

0 comments on commit b17efd7

Please sign in to comment.