Skip to content

Commit

Permalink
update editor
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed Aug 24, 2024
1 parent ec25460 commit 376f8de
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 125 deletions.
3 changes: 3 additions & 0 deletions app/typr/PageContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,9 @@ function DemoPageContent() {
</div>
<IndexedDBBrowser
data={data}
reset={()=>{
setPostId(-1)
}}
onDelete={fetchData}
router={router}
searchParams={searchParams}
Expand Down
23 changes: 17 additions & 6 deletions components/typr-demo/IndexedDBBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { DB_NAME, STORE_NAME } from "@/lib/typr-demo/indexedDB"; // Import the I
import { TrashIcon } from "@radix-ui/react-icons"; // Import the Radix TrashIcon
import { PlusIcon } from "@radix-ui/react-icons"; // Import the Radix PlusIcon

const IndexedDBBrowser = ({ data, onDelete, router, searchParams }) => {
const IndexedDBBrowser = ({ data, onDelete, router, searchParams, reset }) => {
const deleteRow = async id => {
// const db = await openDB(DB_NAME, 1);
const db = await openDB(DB_NAME);
Expand All @@ -15,8 +15,9 @@ const IndexedDBBrowser = ({ data, onDelete, router, searchParams }) => {
onDelete(); // Fetch data again after deletion
};

const handleCreateNew = () => {
const handleCreateNew = reset => {
router.push("/typr");
reset();
};

return (
Expand All @@ -27,14 +28,22 @@ const IndexedDBBrowser = ({ data, onDelete, router, searchParams }) => {
) : (
<>
{data.map(entry => (
<Card key={entry.id} entry={entry} router={router} searchParams={searchParams} onDelete={deleteRow} />
<Card
key={entry.id}
entry={entry}
router={router}
searchParams={searchParams}
onDelete={deleteRow}
/>
))}
<div
className="bg-gradient-to-b group from-slate-100 transition transition-all duration-600 to-slate-50 hover:shadow border border-dotted border-gray-300/70 rounded-lg p-2 mb-4 relative group cursor-pointer flex items-center justify-center"
onClick={handleCreateNew}
>
<PlusIcon className="text-gray-500" />
<span className="ml-2 text-sm group-hover:text-gray-800 text-gray-500">Start New</span>
<span className="ml-2 text-sm group-hover:text-gray-800 text-gray-500">
Start New
</span>
</div>
</>
)}
Expand Down Expand Up @@ -71,7 +80,9 @@ const Card = ({ entry, onDelete, router, searchParams }) => {

return (
<div
className={`bg-gradient-to-b from-slate-100 transition transition-all duration-600 to-slate-50 hover:shadow border border-gray-300/70 rounded-lg p-2 mb-4 relative group hover:from-white hover:to-white cursor-pointer ${isActive ? 'border-gray-500 from-white to-white' : ''}`}
className={`bg-gradient-to-b from-slate-100 transition transition-all duration-600 to-slate-50 hover:shadow border border-gray-300/70 rounded-lg p-2 mb-4 relative group hover:from-white hover:to-white cursor-pointer ${
isActive ? "border-gray-500 from-white to-white" : ""
}`}
onClick={handleClick}
>
<div className="flex justify-between items-start">
Expand All @@ -97,4 +108,4 @@ const Card = ({ entry, onDelete, router, searchParams }) => {
</div>
</div>
);
};
};
128 changes: 11 additions & 117 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"swiper": "^8.0.0",
"swr": "^1.3.0",
"tailwindcss-border-gradient-radius": "^3.0.1",
"tiptypr": "^0.0.90",
"tiptypr": "^0.0.91",
"tsparticles": "^2.7.1",
"uuidv4": "^6.2.13",
"yup": "^0.32.11",
Expand Down Expand Up @@ -168,7 +168,7 @@
"tailwindcss-scoped-groups": "^2.0.0"
},
"optionalDependencies": {
"@prototypr/paper-interview": "^0.0.475",
"@prototypr/paper-interview": "^0.0.476",
"@prototypr/prototypr-postie": "^1.0.91"
}
}

0 comments on commit 376f8de

Please sign in to comment.