mirror of
https://github.com/crocofied/CoreControl.git
synced 2025-12-18 07:56:57 +00:00
Sites Display
This commit is contained in:
parent
400db0babf
commit
e21167e09b
@ -3,6 +3,8 @@ import Sidebar from "@/components/Sidebar";
|
|||||||
import { Plus } from "lucide-react";
|
import { Plus } from "lucide-react";
|
||||||
import AddSite from "@/components/dialogues/AddSite";
|
import AddSite from "@/components/dialogues/AddSite";
|
||||||
import Sites from "@/components/cards/Sites";
|
import Sites from "@/components/cards/Sites";
|
||||||
|
import axios from "axios";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
interface SitesPageProps {
|
interface SitesPageProps {
|
||||||
username: string;
|
username: string;
|
||||||
@ -11,6 +13,13 @@ interface SitesPageProps {
|
|||||||
|
|
||||||
|
|
||||||
export default function SitesPage({ username, name }: SitesPageProps) {
|
export default function SitesPage({ username, name }: SitesPageProps) {
|
||||||
|
const [sites, setSites] = useState([]);
|
||||||
|
useEffect(() => {
|
||||||
|
axios.get('/api/sites/get_all').then((response) => {
|
||||||
|
setSites(response.data.sites);
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Sidebar
|
<Sidebar
|
||||||
username={username}
|
username={username}
|
||||||
@ -30,7 +39,11 @@ export default function SitesPage({ username, name }: SitesPageProps) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AddSite />
|
<AddSite />
|
||||||
<Sites id="" name="test" description="test" networks={[]} />
|
<div className="flex flex-col gap-4 pt-4">
|
||||||
|
{sites.map((site: any) => (
|
||||||
|
<Sites key={site.id} id={site.id} name={site.name} description={site.description} networks={site.networks} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -11,7 +11,12 @@ export default function Sites({ id, name, description, networks }: SitesProps) {
|
|||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h2 className="card-title">{name}</h2>
|
<h2 className="card-title">{name}</h2>
|
||||||
<p>{description}</p>
|
<p>{description}</p>
|
||||||
|
{ networks && networks.length > 0 && (
|
||||||
<p>Networks: {networks.join(', ')}</p>
|
<p>Networks: {networks.join(', ')}</p>
|
||||||
|
)}
|
||||||
|
<div className="card-actions justify-end">
|
||||||
|
<button className="btn btn-secondary btn-sm btn-outline">View</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user