-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { Plugin } from "@/lib/types" | ||
import bunker from "@/lib/bunker" | ||
import { Settings2 } from "lucide-react" | ||
import { Switch } from "@/components/ui/switch" | ||
import { Label } from "@/components/ui/label" | ||
|
||
import { useEffect, useState } from "react" | ||
|
||
const Settings: Plugin = { | ||
name: "Settings", | ||
id: "bunker.settings", | ||
description: "Modify Bunker & Other apps settings!", | ||
icon: Settings2, | ||
|
||
page({ sdk }) { | ||
function setStorageLocation(checked: boolean) { | ||
if (checked) { | ||
sdk.config.set("pluginLocation", "internal") | ||
} else { | ||
sdk.config.set("pluginLocation", "external") | ||
} | ||
} | ||
return ( | ||
<div className="flex flex-col items-center w-full pt-16"> | ||
<h1 className="font-bold text-5xl">Settings </h1> | ||
|
||
<div className="flex flex-wrap justify-center gap-4 mt-8"> | ||
<Switch id="storage-location" onCheckedChange={(checked) => setStorageLocation(checked)} /> | ||
<Label className="text-md" htmlFor="storage-location">Store Plugins Internally</Label> | ||
</div> | ||
</div> | ||
) | ||
}, | ||
|
||
|
||
onReady() { | ||
console.log("Status") | ||
}, | ||
} | ||
|
||
export default Settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { $plugins } from "@/lib/plugins" | ||
import { SDK } from "@/lib/sdk" | ||
import { useStore } from "@nanostores/react" | ||
|
||
export default function Settings() { | ||
const loadedPlugins = useStore($plugins) | ||
const plugin = "bunker.settings" | ||
|
||
const selectedPlugin = loadedPlugins.find((selected) => selected.id == plugin) | ||
if (!selectedPlugin || !selectedPlugin.page) | ||
return ( | ||
<div className="text-center absolute top-1/2 -translate-y-1/2 w-full text-2xl text-semibold"> | ||
Unable to locate plugin{" "} | ||
<span className="bg-zinc-800 py-1 px-3 rounded-lg border border-white/25 font-mono text-xl"> | ||
{plugin} | ||
</span> | ||
</div> | ||
) | ||
|
||
return ( | ||
<div className="h-screen w-[calc(100vw-4rem)] overflow-auto"> | ||
<selectedPlugin.page sdk={new SDK(selectedPlugin.id)} /> | ||
</div> | ||
) | ||
} |