Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kinode/packages/app_store/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function App() {

useEffect(() => {
provider?.getNetwork().then(network => {
// TODO: don't have this fire 20 times on load
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really really wish we could fix this for 0.6.3

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah if you want me on that, I can make another branch and try to get it done for 0.6.3

if (network.chainId === ChainId.OPTIMISM) {
setPackageAbi(PackageStore__factory.connect(
PACKAGE_STORE_ADDRESSES[ChainId.OPTIMISM],
Expand Down
8 changes: 4 additions & 4 deletions kinode/packages/app_store/ui/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

@font-face {
font-family: 'Futura';
src: url('./fonts/Futura-Heavy.ttf');
src: url('/main:app_store:sys/assets/fonts/Futura-Heavy.ttf');
}

@font-face {
font-family: 'OpenSans';
src: url('./fonts/OpenSans-CondBold.ttf');
src: url('/main:app_store:sys/assets/fonts/OpenSans-CondBold.ttf');
}

@font-face {
font-family: 'Barlow';
src: url('./fonts/BarlowCondensed-Black.ttf');
src: url('/main:app_store:sys/assets/fonts/BarlowCondensed-Black.ttf');
}

body {
Expand Down Expand Up @@ -84,7 +84,7 @@ button[type="submit"],
}

body {
@apply bg-[url('./background.jpg')] bg-cover bg-no-repeat bg-center bg-fixed text-white;
@apply bg-[url('/main:app_store:sys/assets/background.jpg')] bg-cover bg-no-repeat bg-center bg-fixed text-white;
}

input {
Expand Down
61 changes: 61 additions & 0 deletions kinode/packages/app_store/ui/src/pages/PublishPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default function PublishPage({
const [metadataUrl, setMetadataUrl] = useState<string>("");
const [metadataHash, setMetadataHash] = useState<string>(""); // BytesLike
const [isUpdate, setIsUpdate] = useState<boolean>(false);
const [myPublishedApps, setMyPublishedApps] = useState<AppInfo[]>([]);

useEffect(() => {
const app: AppInfo | undefined = state?.app;
Expand All @@ -54,6 +55,12 @@ export default function PublishPage({
}
}, [state])

useEffect(() => {
setMyPublishedApps(
listedApps.filter((app) => app.owner?.toLowerCase() === account?.toLowerCase())
);
}, [listedApps, account])

const connectWallet = useCallback(async () => {
await metaMask.activate().catch(() => { });

Expand Down Expand Up @@ -157,6 +164,35 @@ export default function PublishPage({
]
);

const unpublishPackage = useCallback(
async (packageName: string, publisherName: string) => {
try {
await setChain(OPTIMISM_OPT_HEX);

const tx = await
packageAbi.unlistPacakge(
utils.keccak256(utils.solidityPack(
["string", "bytes"],
[packageName, toDNSWireFormat(publisherName)]
))
);

await new Promise((resolve) => setTimeout(resolve, 2000));

setLoading("Unlisting package...");
await tx.wait();
} catch (error) {
console.error(error);
window.alert(
"Error unlisting package"
);
} finally {
setLoading("");
}
},
[packageAbi, setLoading]
);

const checkIfUpdate = useCallback(async () => {
if (isUpdate) return;

Expand Down Expand Up @@ -293,6 +329,31 @@ export default function PublishPage({
</button>
</form>
)}

<div className="flex flex-col my-2 mt-4">
<h4>Packages You Own</h4>
{myPublishedApps.length > 0 ? (
<div className="flex flex-col">
{myPublishedApps.map((app) => (
<div key={`${app.package}${app.publisher}`} className="flex items-center justify-between">
<div className="flex items-center">
<Jazzicon address={app.publisher} className="mr-2" />
<span>{app.package}</span>
</div>
{/* <Tooltip content="View Package"> */}
<button className="flex items-center" onClick={() => unpublishPackage(app.package, app.publisher)}>
<span>Unpublish</span>
</button>
{/* </Tooltip> */}
</div>
))}
</div>
) : (
<div className="flex items-center">
<span>No packages published</span>
</div>
)}
</div>
</div>
);
}
3 changes: 1 addition & 2 deletions kinode/packages/app_store/ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ This must match the process name from pkg/manifest.json + pkg/metadata.json
The format is "/" + "process_name:package_name:publisher_node"
*/
const BASE_URL = `/main:app_store:sys`;
// const BASE_URL = `/${manifest[0].process_name}:${metadata.package}:${metadata.publisher}`;

// This is the proxy URL, it must match the node you are developing against
const PROXY_URL = (process.env.VITE_NODE_URL || 'http://127.0.0.1:8080').replace('localhost', '127.0.0.1');
Expand Down Expand Up @@ -79,7 +78,7 @@ export default defineConfig({
rewrite: (path) => path.replace(BASE_URL, ''),
},
// This route will match all other HTTP requests to the backend
[`^${BASE_URL}/(?!(@vite/client|src/.*|node_modules/.*|@react-refresh|$))`]: {
[`^${BASE_URL}/(?!(@vite/client|src/.*|node_modules/.*|@react-refresh|__uno.css|$))`]: {
target: PROXY_URL,
changeOrigin: true,
},
Expand Down