This commit is contained in:
+27
-16
@@ -60,32 +60,43 @@ export default Plugin.define({
|
||||
setRevision((value) => value + 1);
|
||||
});
|
||||
|
||||
const Slot = (props: { instance: string }) => {
|
||||
const Slot = (props: { instance: string; centered?: boolean; visible?: () => boolean }) => {
|
||||
const [status] = createResource(
|
||||
() => `${props.instance}:${revision()}`,
|
||||
() => (props.visible?.() === false ? false : `${props.instance}:${revision()}`),
|
||||
() => loadQuotaStatus(() => quota.status({})),
|
||||
);
|
||||
const Content = () => (
|
||||
<box flexDirection="column">
|
||||
<text fg={context.theme.text.default}>
|
||||
<b>ChatGPT quota ({status()!.plan})</b>
|
||||
</text>
|
||||
<For each={status()!.windows}>
|
||||
{(window) => (
|
||||
<text fg={context.theme.text.muted}>{formatQuotaWindow(window)}</text>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
);
|
||||
return (
|
||||
<Show when={status()}>
|
||||
<box flexDirection="column">
|
||||
<text fg={context.theme.text.default}>
|
||||
<b>ChatGPT quota ({status()!.plan})</b>
|
||||
</text>
|
||||
<For each={status()!.windows}>
|
||||
{(window) => (
|
||||
<text fg={context.theme.text.muted}>
|
||||
{formatQuotaWindow(window)}
|
||||
</text>
|
||||
)}
|
||||
</For>
|
||||
</box>
|
||||
<Show when={props.centered} fallback={<Content />}>
|
||||
<box width="100%" alignItems="center">
|
||||
<Content />
|
||||
</box>
|
||||
</Show>
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
const removeHome = context.ui.slot({
|
||||
append: "home.footer.status",
|
||||
render: () => <Slot instance="home" />,
|
||||
after: "prompt.footer",
|
||||
render: () => (
|
||||
<Slot
|
||||
instance="home"
|
||||
centered
|
||||
visible={() => context.ui.router.current().type === "home"}
|
||||
/>
|
||||
),
|
||||
});
|
||||
const removeSidebar = context.ui.slot({
|
||||
append: "sidebar.footer",
|
||||
|
||||
Reference in New Issue
Block a user