Feat(UI/modules): display more module informations

This commit is contained in:
Johannes Kirschbauer
2025-05-12 18:09:42 +02:00
parent 552ea582d6
commit ef4806f71c
3 changed files with 35 additions and 34 deletions

View File

@@ -143,6 +143,8 @@ def get_roles(module_path: Path) -> None | list[str]:
class ModuleManifest(TypedDict):
name: str
description: str
categories: list[str]
features: dict[str, bool]

View File

@@ -22,10 +22,10 @@ export const createModulesQuery = (
const response = await callApi("list_modules", {
base_path: uri,
});
console.log({ response });
if (response.status === "error") {
toast.error("Failed to fetch data");
} else {
console.log(response.data.localModules["hello-world"]["manifest"]);
return response.data;
}
}

View File

@@ -48,6 +48,7 @@ const Roles = (props: RolesProps) => {
const ModuleItem = (props: {
name: string;
info: ModuleInfo;
source: string;
class?: string;
}) => {
const { name, info } = props;
@@ -60,10 +61,27 @@ const ModuleItem = (props: {
props.class,
)}
>
{/* <div class="stat-figure text-primary-800">
<div class="join">
<header class="flex flex-row items-center justify-between">
<div class="flex flex-col gap-4">
<A href={`/modules/details/${props.source}/${info.manifest.name}`}>
<div class="">
<div class="flex flex-col">
{/* <Categories categories={info.categories} /> */}
<Typography hierarchy="title" size="m" weight="medium">
{info.manifest.name}
</Typography>
</div>
</div>
</A>
<div class="w-full">
<Typography hierarchy="body" size="xs">
{info.manifest.description}
</Typography>
</div>
</div>
<Menu popoverid={`menu-${props.name}`} label={<Icon icon={"More"} />}>
<ul class="z-[1] w-52 p-2 shadow">
<ul class="z-[1] w-52 bg-slate-100 p-2 shadow">
<li>
<a
onClick={() => {
@@ -75,27 +93,6 @@ const ModuleItem = (props: {
</li>
</ul>
</Menu>
</div>
</div> */}
<header class="flex flex-col gap-4">
<A href={`/modules/details/${name}`}>
<div class="">
<div class="flex flex-col">
{/* <Categories categories={info.categories} /> */}
<Typography hierarchy="title" size="m" weight="medium">
{name}
</Typography>
</div>
</div>
</A>
<div class="w-full">
<Typography hierarchy="body" size="xs">
description
{/* TODO: {info.description} */}
</Typography>
</div>
</header>
<Roles roles={info.roles || {}} />
</div>
@@ -181,6 +178,7 @@ export const ModuleList = () => {
<For each={Object.entries(v)}>
{([moduleName, moduleInfo]) => (
<ModuleItem
source={sourceName}
info={moduleInfo}
name={moduleName}
class={view() == "grid" ? cx("max-w-md") : ""}
@@ -194,6 +192,7 @@ export const ModuleList = () => {
<For each={Object.entries(modules().localModules)}>
{([moduleName, moduleInfo]) => (
<ModuleItem
source={"localModules"}
info={moduleInfo}
name={moduleName}
class={view() == "grid" ? cx("max-w-md") : ""}