diff options
| author | Andrew Lee <andrew@alee14.me> | 2025-03-25 14:13:06 -0400 |
|---|---|---|
| committer | Andrew Lee <andrew@alee14.me> | 2025-03-25 14:13:06 -0400 |
| commit | 1c12d378d66b92b1674acd17640f2bac752da289 (patch) | |
| tree | bc8a1ef5047be1ed2400f2204a0222a840375851 /web/src/app/components | |
| parent | ad768e2b25b58d62a44aa2daeb1429a651d488e5 (diff) | |
| download | AleeBot-1c12d378d66b92b1674acd17640f2bac752da289.tar.gz AleeBot-1c12d378d66b92b1674acd17640f2bac752da289.tar.bz2 AleeBot-1c12d378d66b92b1674acd17640f2bac752da289.zip | |
Converted public dashboard to admin dashboard; Made API have a consistent output message
Diffstat (limited to 'web/src/app/components')
| -rw-r--r-- | web/src/app/components/Guilds.jsx | 25 | ||||
| -rw-r--r-- | web/src/app/components/Navbar.jsx | 25 | ||||
| -rw-r--r-- | web/src/app/components/sign-in.jsx | 14 | ||||
| -rw-r--r-- | web/src/app/components/sign-out.jsx | 11 |
4 files changed, 26 insertions, 49 deletions
diff --git a/web/src/app/components/Guilds.jsx b/web/src/app/components/Guilds.jsx deleted file mode 100644 index 38626e4..0000000 --- a/web/src/app/components/Guilds.jsx +++ /dev/null @@ -1,25 +0,0 @@ - -export default async function Guilds({session}) { - - const response = await fetch("https://discord.com/api/users/@me/guilds", { - headers: { - Authorization: `Bearer ${session.accessToken}`, - }, - }); - const guilds = await response.json(); - - const ADMINISTRATOR = 0x0000000000000008; - const MANAGE_GUILD = 0x00000020; - - const filteredGuilds = guilds.filter((guild) => { - // Convert permissions string to a BigInt for bitwise operations - const permissions = BigInt(guild.permissions); - // Check if user is owner, has ADMINISTRATOR or MANAGE_GUILD permissions - return guild.owner || - (permissions & BigInt(ADMINISTRATOR)) === BigInt(ADMINISTRATOR) || - (permissions & BigInt(MANAGE_GUILD)) === BigInt(MANAGE_GUILD); }); - - return filteredGuilds.map((guild) => ( - <div key={guild.id} className="p-1">{guild.name}</div> - )) -} diff --git a/web/src/app/components/Navbar.jsx b/web/src/app/components/Navbar.jsx new file mode 100644 index 0000000..242175c --- /dev/null +++ b/web/src/app/components/Navbar.jsx @@ -0,0 +1,25 @@ +import SignOut from "@/app/components/sign-out"; + +export default function Navbar() { + return ( + <nav className="bg-gray-900 text-white"> + <div className="max-w-screen-xl flex items-center justify-between mx-auto p-4"> + <div className="flex items-center space-x-4"> + <h1 className="text-xl font-medium">AleeBot</h1> + <ul> + <li className="inline-block mx-2">Guilds</li> + <li className="inline-block mx-2">Quotes</li> + <li className="inline-block mx-2">Settings</li> + </ul> + </div> + + <div className="flex items-center space-x-4"> + <span>Uptime: 1 day</span> + <span>API v(version)</span> + <span>4.0.0 Beta</span> + <SignOut /> + </div> + </div> + </nav> + ) +} diff --git a/web/src/app/components/sign-in.jsx b/web/src/app/components/sign-in.jsx deleted file mode 100644 index 3d7142f..0000000 --- a/web/src/app/components/sign-in.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import { signIn } from "@/lib/auth" - -export default function SignIn() { - return ( - <form - action={async () => { - "use server" - await signIn("discord") - }} - > - <button type="submit" className="bg-discord-blurple p-3 rounded-md hover:bg-discord-blurple">Login with Discord</button> - </form> - ) -} diff --git a/web/src/app/components/sign-out.jsx b/web/src/app/components/sign-out.jsx index 69162a4..dd6693d 100644 --- a/web/src/app/components/sign-out.jsx +++ b/web/src/app/components/sign-out.jsx @@ -1,14 +1,5 @@ -import { signOut } from "@/lib/auth" - export default function SignOut() { return ( - <form - action={async () => { - "use server" - await signOut("discord") - }} - > - <button type="submit">Log out</button> - </form> + <button type="submit" className="py-2 px-4 rounded-md text-md bg-red-700 hover:bg-red-500">Sign out</button> ) } |
