Skip to content

Commit

Permalink
feat: delete snapshots + minor improvs (#2)
Browse files Browse the repository at this point in the history
* chore: fix config to work locally

* feat: add delete snapshots action
  • Loading branch information
thlorenz committed Jan 29, 2024
1 parent a686bdb commit 67db265
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
6 changes: 4 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const buildingGhPages = process.env.CI != null

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
Expand All @@ -6,14 +8,14 @@ const nextConfig = {
*
* @see https://nextjs.org/docs/app/building-your-application/deploying/static-exports
*/
output: 'export',
output: buildingGhPages ? 'export' : 'standalone',

/**
* Set base path. This is the slug of your GitHub repository.
*
* @see https://nextjs.org/docs/app/api-reference/next-config-js/basePath
*/
basePath: '/ex-tictactoe.web',
basePath: buildingGhPages ? '/ex-tictactoe.web' : '',

/**
* Disable server-based image optimization. Next.js does not support
Expand Down
6 changes: 6 additions & 0 deletions src/lib/luzid-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,10 @@ export class GameLuzid {
).setData(data, { size })
)
}

async deleteAppSnapshots() {
return this.luzid.snapshot.deleteSnapshotsMatching({
group: SNAPSHOT_GROUP,
})
}
}
16 changes: 14 additions & 2 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,14 @@ export default function Home() {
>
Set Winning State
</Button>
<Button
onClick={async () => {
const snapshotIds = await gameLuzid.deleteAppSnapshots()
toast(`${snapshotIds.length} App Snapshots Removed`)
}}
>
Remove App Snapshots
</Button>
<Button
onClick={async () => {
const version = await gameLuzid.restartValidator()
Expand Down Expand Up @@ -194,7 +202,9 @@ export default function Home() {
</div>
</div>

{/* Table with Game Info */}
{/*
Table with Game Info
*/}
<table className="border border-slate-400 border-separate border-spacing-2.52 mt-4">
<tbody>
<tr>
Expand Down Expand Up @@ -237,7 +247,9 @@ export default function Home() {
</tbody>
</table>

{/* Bottom section (not important) */}
{/*
Bottom section (not important)
*/}
<div className="mb-32 grid text-center lg:max-w-5xl lg:w-full lg:mb-0 lg:grid-cols-2 lg:text-left">
<a
href="https://luzid.app"
Expand Down

0 comments on commit 67db265

Please sign in to comment.