-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: clean up profile page and summary table
- Loading branch information
Jamesb
committed
Feb 24, 2024
1 parent
7ec86d2
commit 804d562
Showing
10 changed files
with
223 additions
and
118 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
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,77 @@ | ||
import { | ||
Button, | ||
Dialog, | ||
DialogActions, | ||
DialogContent, | ||
DialogTitle, | ||
} from "@mui/material"; | ||
import React from "react"; | ||
import { trpc } from "../lib/trpc"; | ||
import { OnboardingModal } from "./OnboardingModal"; | ||
|
||
interface SettingsModalProps { | ||
children: React.ReactNode; | ||
} | ||
|
||
export function SettingsModal(props: SettingsModalProps) { | ||
const [isOpen, setOpen] = React.useState(false); | ||
const handleOpen = () => setOpen(true); | ||
const handleClose = () => setOpen(false); | ||
const [apiKey, setApiKey] = React.useState<{ | ||
loading: boolean; | ||
data?: string; | ||
}>(); | ||
return ( | ||
<> | ||
<span | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
handleOpen(); | ||
}} | ||
> | ||
{props.children} | ||
</span> | ||
<Dialog open={isOpen} onClose={handleClose}> | ||
<DialogTitle>Settings</DialogTitle> | ||
<DialogContent> | ||
<div> | ||
{!apiKey ? ( | ||
<Button | ||
disabled={!!apiKey} | ||
variant="outlined" | ||
onClick={async () => { | ||
setApiKey({ loading: true }); | ||
const key = await trpc.getAPIKey.mutate(); | ||
if (!key) { | ||
console.log("error getting api key"); | ||
return; | ||
} | ||
setApiKey({ loading: false, data: key }); | ||
}} | ||
> | ||
Get API Key | ||
</Button> | ||
) : ( | ||
<div> | ||
Your API Key ( | ||
<OnboardingModal | ||
shouldOpen | ||
okayText="Ok" | ||
title="API Key" | ||
content="This is your API key. You can use it to upload custom recommendation inputs and get recommendations programmatically. It's like a password, so don't share it with anyone. It will only be shown once. If you lose your key or accidentally share it, create a new API key. You can paste this into the RemNote Incremental Everything plugin to interleave your recommendations with existing elements." | ||
> | ||
<a>What is this?</a> | ||
</OnboardingModal> | ||
): <pre>{apiKey.data}</pre> | ||
</div> | ||
)} | ||
</div> | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={handleClose}>Close</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</> | ||
); | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/server/prisma/migrations/20240224145230_delete_cascade_logs/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,5 @@ | ||
-- DropForeignKey | ||
ALTER TABLE "PipelineTaskLog" DROP CONSTRAINT "PipelineTaskLog_pipelineTaskId_fkey"; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "PipelineTaskLog" ADD CONSTRAINT "PipelineTaskLog_pipelineTaskId_fkey" FOREIGN KEY ("pipelineTaskId") REFERENCES "PipelineTask"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
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.