import { ScrollView, View } from "react-native";
import {
useProjects,
useWorkspaces,
type ProjectRef,
type PluginSidebarViewProps,
} from "@getpaseo/plugin/client";
import { Heading, ProjectHeading, WorkspaceRow } from "./rows";
function Project({ reference, view }: { reference: ProjectRef; view: PluginSidebarViewProps }) {
const workspaces = useWorkspaces({
where: (item) => item.project.key === reference.key && !item.pinnedAt,
orderBy: "name",
});
return (
{workspaces.map((workspace) => (
))}
);
}
export function Workspaces(view: PluginSidebarViewProps) {
const projects = useProjects({ orderBy: "displayName" });
const pinned = useWorkspaces({ where: (item) => !!item.pinnedAt, orderBy: "name" });
return (
{pinned.length ? : null}
{pinned.map((reference) => (
))}
{projects.map((reference) => (
))}
);
}