make server title clickable

This commit is contained in:
ppc
2024-08-10 18:09:09 +01:00
parent efa8dee1bb
commit 45f85fa837
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -9,12 +9,13 @@ export interface AMCardActionProps {
actionDisabled?: boolean,
}
export function AMCard(props: AMCardActionProps & { title: string, children: Readonly<React.ReactNode> }) {
export function AMCard(props: AMCardActionProps & { title: string, titlePerformsAction?: boolean, children: Readonly<React.ReactNode> }) {
return (
<Card>
<div className="grid grid-cols-[1fr_40px] items-center gap-1 p-4 pr-2 sm:p-6">
<div className={`${props.actionClicked ? 'grid grid-cols-[1fr_40px] items-center gap-1' : ''} p-4 pr-2 sm:p-6`}>
<div className="max-w-full overflow-hidden space-y-3">
<h4 className="text-2xl font-semibold select-none text-ellipsis whitespace-nowrap overflow-hidden">
<h4 className="text-2xl font-semibold select-none text-ellipsis whitespace-nowrap overflow-hidden"
onClick={() => props.titlePerformsAction && props.actionClicked ? props.actionClicked() : null}>
{props.title}
</h4>
<div className="text-sm lg:text-md flex flex-auto flex-wrap gap-3">
+1 -1
View File
@@ -62,7 +62,7 @@ function ServerList(props: { servers: AimeServer[] | undefined }) {
{props.servers.map(s =>
<ContextMenu key={s.id}>
<ContextMenuTrigger>
<AMCard title={s.server_name} actionClicked={() => navigate(`/servers/${s.id}`)}>
<AMCard title={s.server_name} titlePerformsAction actionClicked={() => navigate(`/servers/${s.id}`)}>
{s.lastConnected > 0 && (
<AMCardDetail>
<History className="h-5 w-5"/>