add proper server region to card

This commit is contained in:
karamvir
2023-08-05 22:00:51 -07:00
parent 334529ab67
commit 867a968b5b
2 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ export const ServerCard = ({ id }: { id: string }) => {
>
<div className="flex flex-col text-sm">
<ServerSpecs server_id={server.id} />
<ServerRegion />
<ServerRegion serverId={server.id} />
</div>
</ResourceCard>
</Link>
+8 -2
View File
@@ -47,11 +47,17 @@ export const ServerSpecs = ({ server_id }: { server_id: string }) => {
);
};
export const ServerRegion = () => {
export const ServerRegion = ({
serverId,
}: {
serverId: string | undefined;
}) => {
const servers = useRead("ListServers", {}).data;
const server = servers?.find((s) => s.id === serverId);
return (
<div className="flex gap-2 items-center text-muted-foreground">
<MapPin className="w-4 h-4" />
server.region
{server?.region || "region unknown"}
</div>
);
};