-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change verbiage and add purchased field (#26)
- Loading branch information
Showing
19 changed files
with
242 additions
and
76 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
prisma/migrations/20230221220353_add_item_purchased/migration.sql
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 @@ | ||
-- RedefineTables | ||
PRAGMA foreign_keys=OFF; | ||
CREATE TABLE "new_items" ( | ||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, | ||
"name" TEXT NOT NULL, | ||
"price" TEXT, | ||
"url" TEXT, | ||
"note" TEXT, | ||
"image_url" TEXT, | ||
"userId" TEXT NOT NULL, | ||
"addedById" TEXT NOT NULL, | ||
"pledgedById" TEXT, | ||
"approved" BOOLEAN NOT NULL DEFAULT true, | ||
"purchased" BOOLEAN NOT NULL DEFAULT false, | ||
CONSTRAINT "items_userId_fkey" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, | ||
CONSTRAINT "items_addedById_fkey" FOREIGN KEY ("addedById") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE, | ||
CONSTRAINT "items_pledgedById_fkey" FOREIGN KEY ("pledgedById") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE | ||
); | ||
INSERT INTO "new_items" ("addedById", "approved", "id", "image_url", "name", "note", "pledgedById", "price", "url", "userId") SELECT "addedById", "approved", "id", "image_url", "name", "note", "pledgedById", "price", "url", "userId" FROM "items"; | ||
DROP TABLE "items"; | ||
ALTER TABLE "new_items" RENAME TO "items"; | ||
CREATE UNIQUE INDEX "items_id_key" ON "items"("id"); | ||
CREATE INDEX "items_userId_idx" ON "items"("userId"); | ||
PRAGMA foreign_key_check; | ||
PRAGMA foreign_keys=ON; |
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
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,33 @@ | ||
<script lang="ts"> | ||
import { claimOption, CLAIM_OPTIONS } from "$lib/stores/filters"; | ||
import { menu } from "@skeletonlabs/skeleton"; | ||
let menuView = false; | ||
const stateHandler = (response: { menu: string; state: boolean }): void => { | ||
if (response.menu === "view") menuView = response.state; | ||
}; | ||
</script> | ||
|
||
<div class="flex flex-row space-x-4 pb-4"> | ||
<span class="relative"> | ||
<button | ||
class="chip variant-ringed-primary" | ||
class:variant-ghost-primary={$claimOption !== "All"} | ||
use:menu={{ menu: "view", state: stateHandler }} | ||
> | ||
<span>{$claimOption}</span> | ||
<iconify-icon icon="ri:arrow-down-s-fill" class:rotate-180={menuView} /> | ||
</button> | ||
<nav class="list-nav card p-4 shadow-xl" data-menu="view"> | ||
<ul> | ||
{#each CLAIM_OPTIONS as OPTION} | ||
<li> | ||
<button class="list-option w-full" on:click={() => ($claimOption = OPTION)}> | ||
{OPTION} | ||
</button> | ||
</li> | ||
{/each} | ||
</ul> | ||
</nav> | ||
</span> | ||
</div> |
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,5 @@ | ||
import { writable } from "svelte/store"; | ||
|
||
export const CLAIM_OPTIONS = ["All", "Claimed", "Unclaimed"] as const; | ||
export type ClaimOption = (typeof CLAIM_OPTIONS)[number]; | ||
export const claimOption = writable<ClaimOption>("All"); |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.