Skip to content

Commit

Permalink
refactor: ui and code
Browse files Browse the repository at this point in the history
  • Loading branch information
thenicekat committed Mar 31, 2024
1 parent a3e1654 commit 9842b4f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
10 changes: 7 additions & 3 deletions frontend/app/admin/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import React, { useEffect, useState } from 'react';
import { User } from '@/types'
import { Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from '@nextui-org/table'
import { siteConfig } from "@/config/site";
import { title } from "@/components/primitives";

axios.defaults.withCredentials = true;

const AdminHomepage = () => {
const [users, setUsers] = useState<User[] | never[]>([]);
const [error, setError] = useState<string>("");
const [loading, setLoading] = useState<boolean>(true); // Add loading state
const [loading, setLoading] = useState<boolean>(true);

useEffect(() => {
const fetchUsers = async () => {
try {
Expand Down Expand Up @@ -51,8 +53,10 @@ const AdminHomepage = () => {

return (
<div>
<h1>Admin Homepage</h1>
{error && <p>{error}</p>}
<h1 className={title()}>Your Post</h1>

{error && <p className="text-red-600 text-center text-xl m-2">{error}</p>}

<div className="p-2">
<Table aria-label="Users Table">
<TableHeader>
Expand Down
24 changes: 12 additions & 12 deletions frontend/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,6 @@ export default function Home() {
</div>
</Tab>

<Tab
key="profile"
title={
<div className="flex items-center space-x-2">
<UserIcon className="h-5 w-5" />
<span>Profile</span>
</div>
}
>
<UpdateProfile />
</Tab>

<Tab
key="myposts"
title={
Expand All @@ -157,6 +145,18 @@ export default function Home() {
>
<SentRequests />
</Tab>

<Tab
key="profile"
title={
<div className="flex items-center space-x-2">
<UserIcon className="h-5 w-5" />
<span>Profile</span>
</div>
}
>
<UpdateProfile />
</Tab>
</Tabs>
</div>
</>
Expand Down

0 comments on commit 9842b4f

Please sign in to comment.