@osdk/create-app 0.17.0-main-20240530094422 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +60 -1
- package/build/browser/esm-5B4R5BF5.js +248 -0
- package/build/browser/esm-5B4R5BF5.js.map +1 -0
- package/build/browser/esm-7ZL7DCMH.js +451 -0
- package/build/browser/esm-7ZL7DCMH.js.map +1 -0
- package/build/browser/esm-WPXIOIG2.js +1170 -0
- package/build/browser/esm-WPXIOIG2.js.map +1 -0
- package/build/browser/esm-ZCTE2SEE.js +377 -0
- package/build/browser/esm-ZCTE2SEE.js.map +1 -0
- package/build/browser/esm-ZDRBH2ME.js +901 -0
- package/build/browser/esm-ZDRBH2ME.js.map +1 -0
- package/build/browser/index.js +26 -19
- package/build/browser/index.js.map +1 -1
- package/build/cjs/esm-2ZIGIHPI.cjs +379 -0
- package/build/cjs/esm-2ZIGIHPI.cjs.map +1 -0
- package/build/cjs/esm-JBGUEJ46.cjs +250 -0
- package/build/cjs/esm-JBGUEJ46.cjs.map +1 -0
- package/build/cjs/esm-RRFVZF4X.cjs +1172 -0
- package/build/cjs/esm-RRFVZF4X.cjs.map +1 -0
- package/build/cjs/esm-VSENADXB.cjs +903 -0
- package/build/cjs/esm-VSENADXB.cjs.map +1 -0
- package/build/cjs/esm-YRGJOBTV.cjs +453 -0
- package/build/cjs/esm-YRGJOBTV.cjs.map +1 -0
- package/build/cjs/index.cjs +26 -20
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/esm-5B4R5BF5.js +248 -0
- package/build/esm/esm-5B4R5BF5.js.map +1 -0
- package/build/esm/esm-7ZL7DCMH.js +451 -0
- package/build/esm/esm-7ZL7DCMH.js.map +1 -0
- package/build/esm/esm-WPXIOIG2.js +1170 -0
- package/build/esm/esm-WPXIOIG2.js.map +1 -0
- package/build/esm/esm-ZCTE2SEE.js +377 -0
- package/build/esm/esm-ZCTE2SEE.js.map +1 -0
- package/build/esm/esm-ZDRBH2ME.js +901 -0
- package/build/esm/esm-ZDRBH2ME.js.map +1 -0
- package/build/esm/index.js +26 -19
- package/build/esm/index.js.map +1 -1
- package/build/esm/run.d.ts.map +1 -1
- package/build/esm/templates.d.ts +7 -0
- package/build/esm/templates.d.ts.map +1 -1
- package/package.json +18 -9
- package/templates/template-next-static-export/.eslintrc.json +0 -4
- package/templates/template-next-static-export/README.md.hbs +0 -35
- package/templates/template-next-static-export/_gitignore +0 -36
- package/templates/template-next-static-export/next.config.js.hbs +0 -17
- package/templates/template-next-static-export/package.json.hbs +0 -25
- package/templates/template-next-static-export/public/next.svg +0 -20
- package/templates/template-next-static-export/public/palantir.svg +0 -3
- package/templates/template-next-static-export/src/app/auth/callback/page.tsx +0 -25
- package/templates/template-next-static-export/src/app/globals.css +0 -81
- package/templates/template-next-static-export/src/app/icon.svg +0 -20
- package/templates/template-next-static-export/src/app/layout.module.css +0 -11
- package/templates/template-next-static-export/src/app/layout.tsx +0 -51
- package/templates/template-next-static-export/src/app/login/page.tsx +0 -43
- package/templates/template-next-static-export/src/app/page.module.css +0 -7
- package/templates/template-next-static-export/src/app/page.tsx.hbs +0 -53
- package/templates/template-next-static-export/src/lib/client.ts.hbs +0 -31
- package/templates/template-next-static-export/src/lib/useAuthenticated.ts +0 -25
- package/templates/template-next-static-export/tsconfig.json +0 -27
- package/templates/template-react/.eslintrc.cjs +0 -18
- package/templates/template-react/README.md.hbs +0 -35
- package/templates/template-react/_gitignore +0 -24
- package/templates/template-react/index.html +0 -15
- package/templates/template-react/package.json.hbs +0 -30
- package/templates/template-react/public/palantir.svg +0 -3
- package/templates/template-react/public/react.svg +0 -1
- package/templates/template-react/src/AuthCallback.tsx +0 -24
- package/templates/template-react/src/AuthenticatedRoute.tsx +0 -33
- package/templates/template-react/src/Home.module.css +0 -7
- package/templates/template-react/src/Home.tsx.hbs +0 -47
- package/templates/template-react/src/Layout.module.css +0 -10
- package/templates/template-react/src/Layout.tsx +0 -29
- package/templates/template-react/src/Login.tsx +0 -40
- package/templates/template-react/src/client.ts.hbs +0 -31
- package/templates/template-react/src/index.css +0 -81
- package/templates/template-react/src/main.tsx +0 -33
- package/templates/template-react/src/vite-env.d.ts +0 -1
- package/templates/template-react/tsconfig.json +0 -25
- package/templates/template-react/tsconfig.node.json +0 -10
- package/templates/template-react/vite.config.ts.hbs +0 -19
- package/templates/template-tutorial-todo-app/.eslintrc.cjs +0 -18
- package/templates/template-tutorial-todo-app/README.md.hbs +0 -33
- package/templates/template-tutorial-todo-app/index.html +0 -15
- package/templates/template-tutorial-todo-app/package.json.hbs +0 -31
- package/templates/template-tutorial-todo-app/public/todo-app.svg +0 -4
- package/templates/template-tutorial-todo-app/src/AuthCallback.tsx +0 -24
- package/templates/template-tutorial-todo-app/src/AuthenticatedRoute.tsx +0 -33
- package/templates/template-tutorial-todo-app/src/CreateProjectButton.tsx +0 -33
- package/templates/template-tutorial-todo-app/src/CreateProjectDialog.tsx +0 -56
- package/templates/template-tutorial-todo-app/src/CreateTaskButton.tsx +0 -35
- package/templates/template-tutorial-todo-app/src/CreateTaskDialog.tsx +0 -52
- package/templates/template-tutorial-todo-app/src/DeleteProjectButton.tsx +0 -34
- package/templates/template-tutorial-todo-app/src/DeleteProjectDialog.tsx +0 -46
- package/templates/template-tutorial-todo-app/src/Dialog.module.css +0 -5
- package/templates/template-tutorial-todo-app/src/Dialog.tsx +0 -19
- package/templates/template-tutorial-todo-app/src/Home.module.css +0 -35
- package/templates/template-tutorial-todo-app/src/Home.tsx +0 -62
- package/templates/template-tutorial-todo-app/src/Layout.module.css +0 -16
- package/templates/template-tutorial-todo-app/src/Layout.tsx +0 -21
- package/templates/template-tutorial-todo-app/src/Login.module.css +0 -5
- package/templates/template-tutorial-todo-app/src/Login.tsx +0 -42
- package/templates/template-tutorial-todo-app/src/ProjectSelect.tsx +0 -40
- package/templates/template-tutorial-todo-app/src/TaskList.module.css +0 -6
- package/templates/template-tutorial-todo-app/src/TaskList.tsx +0 -38
- package/templates/template-tutorial-todo-app/src/TaskListItem.module.css +0 -3
- package/templates/template-tutorial-todo-app/src/TaskListItem.tsx +0 -37
- package/templates/template-tutorial-todo-app/src/client.ts.hbs +0 -31
- package/templates/template-tutorial-todo-app/src/index.css +0 -80
- package/templates/template-tutorial-todo-app/src/main.tsx +0 -33
- package/templates/template-tutorial-todo-app/src/mocks.ts +0 -137
- package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +0 -55
- package/templates/template-tutorial-todo-app/src/useProjects.ts +0 -43
- package/templates/template-tutorial-todo-app/src/vite-env.d.ts +0 -1
- package/templates/template-tutorial-todo-app/tsconfig.json +0 -25
- package/templates/template-tutorial-todo-app/tsconfig.node.json +0 -10
- package/templates/template-tutorial-todo-app/vite.config.ts.hbs +0 -19
- package/templates/template-vue/.vscode/extensions.json +0 -3
- package/templates/template-vue/README.md.hbs +0 -35
- package/templates/template-vue/_gitignore +0 -24
- package/templates/template-vue/index.html +0 -15
- package/templates/template-vue/package.json.hbs +0 -22
- package/templates/template-vue/public/palantir.svg +0 -3
- package/templates/template-vue/public/vue.svg +0 -1
- package/templates/template-vue/src/AuthCallback.vue +0 -22
- package/templates/template-vue/src/Home.vue.hbs +0 -38
- package/templates/template-vue/src/Layout.vue +0 -26
- package/templates/template-vue/src/Login.vue +0 -36
- package/templates/template-vue/src/client.ts.hbs +0 -31
- package/templates/template-vue/src/main.ts +0 -35
- package/templates/template-vue/src/style.css +0 -81
- package/templates/template-vue/src/vite-env.d.ts +0 -1
- package/templates/template-vue/tsconfig.json +0 -25
- package/templates/template-vue/tsconfig.node.json +0 -10
- package/templates/template-vue/vite.config.ts.hbs +0 -24
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, useCallback, useEffect, useState } from "react";
|
|
2
|
-
import Dialog from "./Dialog";
|
|
3
|
-
import { MockProject } from "./mocks";
|
|
4
|
-
import { useProjectTasks } from "./useProjectTasks";
|
|
5
|
-
|
|
6
|
-
interface CreateTaskDialogProps {
|
|
7
|
-
project: MockProject;
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function CreateTaskDialog({ project, isOpen, onClose }: CreateTaskDialogProps) {
|
|
13
|
-
const { createTask } = useProjectTasks(project);
|
|
14
|
-
|
|
15
|
-
const [name, setName] = useState<string>("New task");
|
|
16
|
-
const handleChange = useCallback(
|
|
17
|
-
(e: ChangeEvent<HTMLInputElement>) => setName(e.target.value),
|
|
18
|
-
[],
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
useEffect(() => setName("New task"), [isOpen]);
|
|
22
|
-
|
|
23
|
-
const [isCreating, setIsCreating] = useState(false);
|
|
24
|
-
const handleSubmit = useCallback(async () => {
|
|
25
|
-
setIsCreating(true);
|
|
26
|
-
try {
|
|
27
|
-
await createTask(name);
|
|
28
|
-
} finally {
|
|
29
|
-
setIsCreating(false);
|
|
30
|
-
onClose();
|
|
31
|
-
}
|
|
32
|
-
}, [onClose, createTask, name]);
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Dialog
|
|
36
|
-
isOpen={isOpen}
|
|
37
|
-
buttons={[
|
|
38
|
-
<button disabled={isCreating} onClick={handleSubmit}>
|
|
39
|
-
Create task
|
|
40
|
-
</button>,
|
|
41
|
-
<button disabled={isCreating} onClick={onClose}>
|
|
42
|
-
Cancel
|
|
43
|
-
</button>,
|
|
44
|
-
]}
|
|
45
|
-
>
|
|
46
|
-
<label>
|
|
47
|
-
Task name: <input type="text" value={name} onChange={handleChange} />
|
|
48
|
-
</label>
|
|
49
|
-
</Dialog>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
export default CreateTaskDialog;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import DeleteProjectDialog from "./DeleteProjectDialog";
|
|
3
|
-
import { MockProject } from "./mocks";
|
|
4
|
-
import useProjects from "./useProjects";
|
|
5
|
-
|
|
6
|
-
interface DeleteProjectButtonProps {
|
|
7
|
-
project: MockProject;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function DeleteProjectButton({ project }: DeleteProjectButtonProps) {
|
|
11
|
-
const { isLoading: isLoadingProjects, isError: isErrorProjects } =
|
|
12
|
-
useProjects();
|
|
13
|
-
|
|
14
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
-
const handleOpen = useCallback(() => setIsOpen(true), []);
|
|
16
|
-
const handleClose = useCallback(() => setIsOpen(false), []);
|
|
17
|
-
|
|
18
|
-
if (isLoadingProjects || isErrorProjects) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<button onClick={handleOpen}>Delete Project</button>
|
|
25
|
-
<DeleteProjectDialog
|
|
26
|
-
project={project}
|
|
27
|
-
isOpen={isOpen}
|
|
28
|
-
onClose={handleClose}
|
|
29
|
-
/>
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default DeleteProjectButton;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import Dialog from "./Dialog";
|
|
3
|
-
import { MockProject } from "./mocks";
|
|
4
|
-
import useProjects from "./useProjects";
|
|
5
|
-
|
|
6
|
-
interface DeleteProjectDialogProps {
|
|
7
|
-
project: MockProject;
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
onClose: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function DeleteProjectDialog({
|
|
13
|
-
project,
|
|
14
|
-
isOpen,
|
|
15
|
-
onClose,
|
|
16
|
-
}: DeleteProjectDialogProps) {
|
|
17
|
-
const { deleteProject } = useProjects();
|
|
18
|
-
|
|
19
|
-
const [isDeleting, setIsDeleting] = useState(false);
|
|
20
|
-
const handleSubmit = useCallback(async () => {
|
|
21
|
-
setIsDeleting(true);
|
|
22
|
-
try {
|
|
23
|
-
await deleteProject(project);
|
|
24
|
-
} finally {
|
|
25
|
-
setIsDeleting(false);
|
|
26
|
-
onClose();
|
|
27
|
-
}
|
|
28
|
-
}, [deleteProject, onClose, project]);
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Dialog
|
|
32
|
-
isOpen={isOpen}
|
|
33
|
-
buttons={[
|
|
34
|
-
<button disabled={isDeleting} onClick={handleSubmit}>
|
|
35
|
-
Delete
|
|
36
|
-
</button>,
|
|
37
|
-
<button disabled={isDeleting} onClick={onClose}>
|
|
38
|
-
Cancel
|
|
39
|
-
</button>,
|
|
40
|
-
]}
|
|
41
|
-
>
|
|
42
|
-
Are you sure you want to delete this project?
|
|
43
|
-
</Dialog>
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
export default DeleteProjectDialog;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import css from "./Dialog.module.css";
|
|
3
|
-
|
|
4
|
-
interface DialogProps {
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
buttons?: React.ReactElement[];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function Dialog({ children, isOpen, buttons }: PropsWithChildren<DialogProps>) {
|
|
10
|
-
return (
|
|
11
|
-
<dialog open={isOpen}>
|
|
12
|
-
{children}
|
|
13
|
-
{buttons != null && buttons.length > 0 && (
|
|
14
|
-
<div className={css.buttons}>{buttons}</div>
|
|
15
|
-
)}
|
|
16
|
-
</dialog>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
export default Dialog;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
.tutorialBannerWrapper {
|
|
2
|
-
display: flex;
|
|
3
|
-
margin: 2em;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.tutorialBanner {
|
|
7
|
-
flex: 1;
|
|
8
|
-
width: 0;
|
|
9
|
-
background: #646cff;
|
|
10
|
-
color: #ffffff;
|
|
11
|
-
border-radius: 1em;
|
|
12
|
-
padding: 1em;
|
|
13
|
-
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.tutorialBannerTitle {
|
|
17
|
-
margin-top: 0;
|
|
18
|
-
font-weight: 600;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.projectSelect {
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
gap: 1em;
|
|
25
|
-
margin: 2em;
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.projectCard {
|
|
30
|
-
margin: 2em;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.projectTitle {
|
|
34
|
-
font-size: 1.5em;
|
|
35
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import CreateProjectButton from "./CreateProjectButton";
|
|
3
|
-
import CreateTaskButton from "./CreateTaskButton";
|
|
4
|
-
import DeleteProjectButton from "./DeleteProjectButton";
|
|
5
|
-
import css from "./Home.module.css";
|
|
6
|
-
import Layout from "./Layout";
|
|
7
|
-
import { MockProject } from "./mocks";
|
|
8
|
-
import ProjectSelect from "./ProjectSelect";
|
|
9
|
-
import TaskList from "./TaskList";
|
|
10
|
-
import useProjects from "./useProjects";
|
|
11
|
-
|
|
12
|
-
function Home() {
|
|
13
|
-
const [projectId, setProjectId] = useState<string | undefined>(undefined);
|
|
14
|
-
const { projects } = useProjects();
|
|
15
|
-
const project = projects?.find((p) => p.id === projectId);
|
|
16
|
-
|
|
17
|
-
const handleSelectProject = useCallback(
|
|
18
|
-
(p: MockProject) => setProjectId(p.id),
|
|
19
|
-
[],
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (project == null && projects != null && projects.length > 0) {
|
|
24
|
-
setProjectId(projects[0].id);
|
|
25
|
-
}
|
|
26
|
-
}, [project, projects]);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Layout>
|
|
30
|
-
<div className={css.tutorialBannerWrapper}>
|
|
31
|
-
<div className={css.tutorialBanner}>
|
|
32
|
-
<p className={css.tutorialBannerTitle}>
|
|
33
|
-
💡 Welcome to this tutorial!
|
|
34
|
-
</p>
|
|
35
|
-
<p>
|
|
36
|
-
The Todo App below has been implemented with fake in memory data.
|
|
37
|
-
Can you solve how to switch it to use the Ontology SDK instead?
|
|
38
|
-
</p>
|
|
39
|
-
</div>
|
|
40
|
-
</div>
|
|
41
|
-
<div className={css.projectSelect}>
|
|
42
|
-
<span>Project:</span>
|
|
43
|
-
<ProjectSelect
|
|
44
|
-
project={project}
|
|
45
|
-
projects={projects ?? []}
|
|
46
|
-
onSelectProject={handleSelectProject}
|
|
47
|
-
/>
|
|
48
|
-
<CreateProjectButton onProjectCreated={setProjectId} />
|
|
49
|
-
{project != null && <DeleteProjectButton project={project} />}
|
|
50
|
-
</div>
|
|
51
|
-
{project != null && (
|
|
52
|
-
<div className={css.projectCard} key={project.id}>
|
|
53
|
-
<h1 className={css.projectTitle}>{project.name}</h1>
|
|
54
|
-
<TaskList project={project} />
|
|
55
|
-
<CreateTaskButton project={project} />
|
|
56
|
-
</div>
|
|
57
|
-
)}
|
|
58
|
-
</Layout>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default Home;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import todoAppLogo from "/todo-app.svg";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import css from "./Layout.module.css";
|
|
4
|
-
|
|
5
|
-
interface LayoutProps {
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function Layout({ children }: LayoutProps) {
|
|
10
|
-
return (
|
|
11
|
-
<>
|
|
12
|
-
<div className={css.header}>
|
|
13
|
-
<img src={todoAppLogo} className={css.logo} alt="Todo App logo" />
|
|
14
|
-
<div className={css.title}>Ontology SDK Tutorial - Todo App</div>
|
|
15
|
-
</div>
|
|
16
|
-
{children}
|
|
17
|
-
</>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default Layout;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import { Navigate } from "react-router-dom";
|
|
3
|
-
import client from "./client";
|
|
4
|
-
import Layout from "./Layout";
|
|
5
|
-
import css from "./Login.module.css";
|
|
6
|
-
|
|
7
|
-
function Login() {
|
|
8
|
-
const [isLoggingIn, setIsLoggingIn] = useState(false);
|
|
9
|
-
const [error, setError] = useState<string | undefined>(undefined);
|
|
10
|
-
const token = client.auth.token;
|
|
11
|
-
|
|
12
|
-
const handleLogin = useCallback(async () => {
|
|
13
|
-
setIsLoggingIn(true);
|
|
14
|
-
try {
|
|
15
|
-
// Initiate the OAuth flow, which will redirect the user to log into Foundry
|
|
16
|
-
// Once the login has completed, the user will be redirected back to the route defined via the
|
|
17
|
-
// FOUNDRY_REDIRECT_URL variable in .env.development
|
|
18
|
-
await client.auth.signIn();
|
|
19
|
-
} catch (e: unknown) {
|
|
20
|
-
console.error(e);
|
|
21
|
-
setError((e as Error).message ?? e);
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
// If the token exists but a user tries to load /login, redirect to the home page instead
|
|
26
|
-
if (token != null) {
|
|
27
|
-
return <Navigate to="/" replace={true} />;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<Layout>
|
|
32
|
-
<div className={css.loginButton}>
|
|
33
|
-
<button onClick={handleLogin}>
|
|
34
|
-
{isLoggingIn ? "Logging in…" : "Log in "}
|
|
35
|
-
</button>
|
|
36
|
-
</div>
|
|
37
|
-
{error && <div>Unable to log in: {error}</div>}
|
|
38
|
-
</Layout>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default Login;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ChangeEvent, useCallback } from "react";
|
|
2
|
-
import { MockProject } from "./mocks";
|
|
3
|
-
|
|
4
|
-
interface ProjectSelectProps {
|
|
5
|
-
project: MockProject | undefined;
|
|
6
|
-
projects: MockProject[];
|
|
7
|
-
onSelectProject: (project: MockProject) => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function ProjectSelect({
|
|
11
|
-
project,
|
|
12
|
-
projects,
|
|
13
|
-
onSelectProject,
|
|
14
|
-
}: ProjectSelectProps) {
|
|
15
|
-
const handleSelect = useCallback(
|
|
16
|
-
(e: ChangeEvent<HTMLSelectElement>) => {
|
|
17
|
-
const nextProject = projects.find((p) => `${p.id}` === e.target.value);
|
|
18
|
-
if (nextProject != null) {
|
|
19
|
-
onSelectProject(nextProject);
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
[projects, onSelectProject],
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<select value={project?.id} onChange={handleSelect}>
|
|
27
|
-
<option hidden disabled selected>
|
|
28
|
-
-- select a project --
|
|
29
|
-
</option>
|
|
30
|
-
|
|
31
|
-
{projects.map((p) => (
|
|
32
|
-
<option key={p.id} value={p.id}>
|
|
33
|
-
{p.name}
|
|
34
|
-
</option>
|
|
35
|
-
))}
|
|
36
|
-
</select>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default ProjectSelect;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { MockProject } from "./mocks";
|
|
2
|
-
import css from "./TaskList.module.css";
|
|
3
|
-
import TaskListItem from "./TaskListItem";
|
|
4
|
-
import { useProjectTasks } from "./useProjectTasks";
|
|
5
|
-
|
|
6
|
-
interface TaskListProps {
|
|
7
|
-
project: MockProject;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function TaskList({ project }: TaskListProps) {
|
|
11
|
-
const {
|
|
12
|
-
tasks,
|
|
13
|
-
isLoading: isLoadingTasks,
|
|
14
|
-
isError: isErrorTasks,
|
|
15
|
-
deleteTask,
|
|
16
|
-
} = useProjectTasks(project);
|
|
17
|
-
|
|
18
|
-
if (isErrorTasks) {
|
|
19
|
-
return <div className={css.taskList}>Error loading tasks!</div>;
|
|
20
|
-
} else if (isLoadingTasks) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const data = tasks ?? [];
|
|
25
|
-
if (data.length === 0) {
|
|
26
|
-
return <div className={css.taskList}>No tasks found</div>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<ul className={css.taskList}>
|
|
31
|
-
{data.map((task) => (
|
|
32
|
-
<TaskListItem key={task.id} task={task} deleteTask={deleteTask} />
|
|
33
|
-
))}
|
|
34
|
-
</ul>
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default TaskList;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from "react";
|
|
2
|
-
import { MockTask } from "./mocks";
|
|
3
|
-
import css from "./TaskListItem.module.css";
|
|
4
|
-
|
|
5
|
-
interface TaskListItemProps {
|
|
6
|
-
task: MockTask;
|
|
7
|
-
deleteTask: (task: MockTask) => Promise<void>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function TaskListItem({ task, deleteTask }: TaskListItemProps) {
|
|
11
|
-
const [isDeleting, setIsDeleting] = useState(false);
|
|
12
|
-
const handleClick = useCallback(async () => {
|
|
13
|
-
setIsDeleting(true);
|
|
14
|
-
try {
|
|
15
|
-
await deleteTask(task);
|
|
16
|
-
} finally {
|
|
17
|
-
setIsDeleting(false);
|
|
18
|
-
}
|
|
19
|
-
}, [deleteTask, task]);
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<li>
|
|
23
|
-
<input
|
|
24
|
-
id={`${task.id}`}
|
|
25
|
-
type="checkbox"
|
|
26
|
-
onClick={handleClick}
|
|
27
|
-
checked={isDeleting}
|
|
28
|
-
disabled={isDeleting}
|
|
29
|
-
/>
|
|
30
|
-
<label className={css.label} htmlFor={`${task.id}`}>
|
|
31
|
-
{task.title}
|
|
32
|
-
</label>
|
|
33
|
-
</li>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export default TaskListItem;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { FoundryClient, PublicClientAuth } from "{{osdkPackage}}";
|
|
2
|
-
|
|
3
|
-
const url = import.meta.env.VITE_FOUNDRY_API_URL;
|
|
4
|
-
const clientId = import.meta.env.VITE_FOUNDRY_CLIENT_ID;
|
|
5
|
-
const redirectUrl = import.meta.env.VITE_FOUNDRY_REDIRECT_URL;
|
|
6
|
-
checkEnv(url, "VITE_FOUNDRY_API_URL");
|
|
7
|
-
checkEnv(clientId, "VITE_FOUNDRY_CLIENT_ID");
|
|
8
|
-
checkEnv(redirectUrl, "VITE_FOUNDRY_REDIRECT_URL");
|
|
9
|
-
|
|
10
|
-
function checkEnv(
|
|
11
|
-
value: string | undefined,
|
|
12
|
-
name: string,
|
|
13
|
-
): asserts value is string {
|
|
14
|
-
if (value == null) {
|
|
15
|
-
throw new Error(`Missing environment variable: ${name}`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Initialize the client to interact with the Ontology SDK
|
|
21
|
-
*/
|
|
22
|
-
const client = new FoundryClient({
|
|
23
|
-
url,
|
|
24
|
-
auth: new PublicClientAuth({
|
|
25
|
-
clientId,
|
|
26
|
-
url,
|
|
27
|
-
redirectUrl,
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export default client;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
-
line-height: 1.5;
|
|
4
|
-
font-weight: 400;
|
|
5
|
-
|
|
6
|
-
color-scheme: light dark;
|
|
7
|
-
color: rgba(255, 255, 255, 0.87);
|
|
8
|
-
background-color: #242424;
|
|
9
|
-
|
|
10
|
-
font-synthesis: none;
|
|
11
|
-
text-rendering: optimizeLegibility;
|
|
12
|
-
-webkit-font-smoothing: antialiased;
|
|
13
|
-
-moz-osx-font-smoothing: grayscale;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
#root-container {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex: 1;
|
|
19
|
-
align-items: center;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#root {
|
|
23
|
-
max-width: 1280px;
|
|
24
|
-
margin: 2rem auto;
|
|
25
|
-
padding: 2rem;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
a {
|
|
29
|
-
font-weight: 500;
|
|
30
|
-
color: #646cff;
|
|
31
|
-
text-decoration: inherit;
|
|
32
|
-
}
|
|
33
|
-
a:hover {
|
|
34
|
-
color: #535bf2;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
body {
|
|
38
|
-
margin: 0;
|
|
39
|
-
display: flex;
|
|
40
|
-
flex-direction: column;
|
|
41
|
-
min-width: 320px;
|
|
42
|
-
min-height: 100vh;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
h1 {
|
|
46
|
-
font-size: 3.2em;
|
|
47
|
-
line-height: 1.1;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
button {
|
|
51
|
-
border-radius: 8px;
|
|
52
|
-
border: 1px solid transparent;
|
|
53
|
-
padding: 0.6em 1.2em;
|
|
54
|
-
font-size: 1em;
|
|
55
|
-
font-weight: 500;
|
|
56
|
-
font-family: inherit;
|
|
57
|
-
background-color: #1a1a1a;
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
transition: border-color 0.25s;
|
|
60
|
-
}
|
|
61
|
-
button:hover {
|
|
62
|
-
border-color: #646cff;
|
|
63
|
-
}
|
|
64
|
-
button:focus,
|
|
65
|
-
button:focus-visible {
|
|
66
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
@media (prefers-color-scheme: light) {
|
|
70
|
-
:root {
|
|
71
|
-
color: #213547;
|
|
72
|
-
background-color: #ffffff;
|
|
73
|
-
}
|
|
74
|
-
a:hover {
|
|
75
|
-
color: #747bff;
|
|
76
|
-
}
|
|
77
|
-
button {
|
|
78
|
-
background-color: #f9f9f9;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import ReactDOM from "react-dom/client";
|
|
2
|
-
import { createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
3
|
-
import AuthCallback from "./AuthCallback";
|
|
4
|
-
import AuthenticatedRoute from "./AuthenticatedRoute";
|
|
5
|
-
import Home from "./Home";
|
|
6
|
-
import Login from "./Login";
|
|
7
|
-
import "./index.css";
|
|
8
|
-
|
|
9
|
-
const router = createBrowserRouter([
|
|
10
|
-
{
|
|
11
|
-
path: "/",
|
|
12
|
-
element: <AuthenticatedRoute />,
|
|
13
|
-
children: [
|
|
14
|
-
{
|
|
15
|
-
path: "/",
|
|
16
|
-
element: <Home />,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
path: "/login",
|
|
22
|
-
element: <Login />,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
// This is the route defined in your application's redirect URL
|
|
26
|
-
path: "/auth/callback",
|
|
27
|
-
element: <AuthCallback />,
|
|
28
|
-
},
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
32
|
-
<RouterProvider router={router} />,
|
|
33
|
-
);
|