@osdk/create-app 0.17.0-beta.3 → 0.17.0-beta.4

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.
Files changed (147) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/browser/index.js +9 -13
  3. package/build/browser/index.js.map +1 -1
  4. package/build/cjs/index.cjs +9 -14
  5. package/build/cjs/index.cjs.map +1 -1
  6. package/build/esm/index.js +9 -13
  7. package/build/esm/index.js.map +1 -1
  8. package/build/esm/run.d.ts.map +1 -1
  9. package/package.json +15 -6
  10. package/templates/template-next-static-export/.eslintrc.json +0 -4
  11. package/templates/template-next-static-export/README.md.hbs +0 -35
  12. package/templates/template-next-static-export/_gitignore +0 -36
  13. package/templates/template-next-static-export/next.config.js.hbs +0 -17
  14. package/templates/template-next-static-export/package.json.hbs +0 -25
  15. package/templates/template-next-static-export/public/next.svg +0 -20
  16. package/templates/template-next-static-export/public/palantir.svg +0 -3
  17. package/templates/template-next-static-export/src/app/auth/callback/page.tsx +0 -25
  18. package/templates/template-next-static-export/src/app/globals.css +0 -81
  19. package/templates/template-next-static-export/src/app/icon.svg +0 -20
  20. package/templates/template-next-static-export/src/app/layout.module.css +0 -11
  21. package/templates/template-next-static-export/src/app/layout.tsx +0 -51
  22. package/templates/template-next-static-export/src/app/login/page.tsx +0 -45
  23. package/templates/template-next-static-export/src/app/page.module.css +0 -7
  24. package/templates/template-next-static-export/src/app/page.tsx.hbs +0 -53
  25. package/templates/template-next-static-export/src/lib/client.ts.hbs +0 -31
  26. package/templates/template-next-static-export/src/lib/useAuthenticated.ts +0 -25
  27. package/templates/template-next-static-export/tsconfig.json +0 -27
  28. package/templates/template-react/.eslintrc.cjs +0 -18
  29. package/templates/template-react/README.md.hbs +0 -35
  30. package/templates/template-react/_gitignore +0 -24
  31. package/templates/template-react/index.html +0 -15
  32. package/templates/template-react/package.json.hbs +0 -30
  33. package/templates/template-react/public/palantir.svg +0 -3
  34. package/templates/template-react/public/react.svg +0 -1
  35. package/templates/template-react/src/AuthCallback.tsx +0 -24
  36. package/templates/template-react/src/AuthenticatedRoute.tsx +0 -33
  37. package/templates/template-react/src/Home.module.css +0 -7
  38. package/templates/template-react/src/Home.tsx.hbs +0 -47
  39. package/templates/template-react/src/Layout.module.css +0 -10
  40. package/templates/template-react/src/Layout.tsx +0 -29
  41. package/templates/template-react/src/Login.tsx +0 -42
  42. package/templates/template-react/src/client.ts.hbs +0 -31
  43. package/templates/template-react/src/index.css +0 -81
  44. package/templates/template-react/src/main.tsx +0 -36
  45. package/templates/template-react/src/vite-env.d.ts +0 -1
  46. package/templates/template-react/tsconfig.json +0 -25
  47. package/templates/template-react/tsconfig.node.json +0 -10
  48. package/templates/template-react/vite.config.ts.hbs +0 -19
  49. package/templates/template-tutorial-todo-aip-app/.eslintrc.cjs +0 -18
  50. package/templates/template-tutorial-todo-aip-app/README.md.hbs +0 -34
  51. package/templates/template-tutorial-todo-aip-app/index.html +0 -15
  52. package/templates/template-tutorial-todo-aip-app/package.json.hbs +0 -31
  53. package/templates/template-tutorial-todo-aip-app/public/aip-icon.svg +0 -3
  54. package/templates/template-tutorial-todo-aip-app/public/todo-aip-app.svg +0 -19
  55. package/templates/template-tutorial-todo-aip-app/src/AuthCallback.tsx +0 -24
  56. package/templates/template-tutorial-todo-aip-app/src/AuthenticatedRoute.tsx +0 -33
  57. package/templates/template-tutorial-todo-aip-app/src/CreateProjectButton.module.css +0 -3
  58. package/templates/template-tutorial-todo-aip-app/src/CreateProjectButton.tsx +0 -36
  59. package/templates/template-tutorial-todo-aip-app/src/CreateProjectDialog.module.css +0 -15
  60. package/templates/template-tutorial-todo-aip-app/src/CreateProjectDialog.tsx +0 -74
  61. package/templates/template-tutorial-todo-aip-app/src/CreateTaskButton.module.css +0 -3
  62. package/templates/template-tutorial-todo-aip-app/src/CreateTaskButton.tsx +0 -38
  63. package/templates/template-tutorial-todo-aip-app/src/CreateTaskDialog.module.css +0 -66
  64. package/templates/template-tutorial-todo-aip-app/src/CreateTaskDialog.tsx +0 -140
  65. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectButton.module.css +0 -3
  66. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectButton.tsx +0 -37
  67. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectDialog.module.css +0 -3
  68. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectDialog.tsx +0 -57
  69. package/templates/template-tutorial-todo-aip-app/src/Dialog.module.css +0 -11
  70. package/templates/template-tutorial-todo-aip-app/src/Dialog.tsx +0 -19
  71. package/templates/template-tutorial-todo-aip-app/src/Home.module.css +0 -28
  72. package/templates/template-tutorial-todo-aip-app/src/Home.tsx +0 -64
  73. package/templates/template-tutorial-todo-aip-app/src/Layout.module.css +0 -16
  74. package/templates/template-tutorial-todo-aip-app/src/Layout.tsx +0 -23
  75. package/templates/template-tutorial-todo-aip-app/src/Login.module.css +0 -5
  76. package/templates/template-tutorial-todo-aip-app/src/Login.tsx +0 -44
  77. package/templates/template-tutorial-todo-aip-app/src/ProjectDetails.module.css +0 -53
  78. package/templates/template-tutorial-todo-aip-app/src/ProjectDetails.tsx +0 -88
  79. package/templates/template-tutorial-todo-aip-app/src/ProjectSelect.tsx +0 -40
  80. package/templates/template-tutorial-todo-aip-app/src/TaskList.module.css +0 -7
  81. package/templates/template-tutorial-todo-aip-app/src/TaskList.tsx +0 -44
  82. package/templates/template-tutorial-todo-aip-app/src/TaskListItem.module.css +0 -35
  83. package/templates/template-tutorial-todo-aip-app/src/TaskListItem.tsx +0 -58
  84. package/templates/template-tutorial-todo-aip-app/src/client.ts.hbs +0 -31
  85. package/templates/template-tutorial-todo-aip-app/src/index.css +0 -75
  86. package/templates/template-tutorial-todo-aip-app/src/main.tsx +0 -36
  87. package/templates/template-tutorial-todo-aip-app/src/mocks.ts +0 -186
  88. package/templates/template-tutorial-todo-aip-app/src/useProjectTasks.ts +0 -75
  89. package/templates/template-tutorial-todo-aip-app/src/useProjects.ts +0 -57
  90. package/templates/template-tutorial-todo-aip-app/src/vite-env.d.ts +0 -1
  91. package/templates/template-tutorial-todo-aip-app/tsconfig.json +0 -25
  92. package/templates/template-tutorial-todo-aip-app/tsconfig.node.json +0 -10
  93. package/templates/template-tutorial-todo-aip-app/vite.config.ts.hbs +0 -19
  94. package/templates/template-tutorial-todo-app/.eslintrc.cjs +0 -18
  95. package/templates/template-tutorial-todo-app/README.md.hbs +0 -33
  96. package/templates/template-tutorial-todo-app/index.html +0 -15
  97. package/templates/template-tutorial-todo-app/package.json.hbs +0 -31
  98. package/templates/template-tutorial-todo-app/public/todo-app.svg +0 -4
  99. package/templates/template-tutorial-todo-app/src/AuthCallback.tsx +0 -24
  100. package/templates/template-tutorial-todo-app/src/AuthenticatedRoute.tsx +0 -33
  101. package/templates/template-tutorial-todo-app/src/CreateProjectButton.tsx +0 -33
  102. package/templates/template-tutorial-todo-app/src/CreateProjectDialog.tsx +0 -56
  103. package/templates/template-tutorial-todo-app/src/CreateTaskButton.tsx +0 -35
  104. package/templates/template-tutorial-todo-app/src/CreateTaskDialog.tsx +0 -52
  105. package/templates/template-tutorial-todo-app/src/DeleteProjectButton.tsx +0 -34
  106. package/templates/template-tutorial-todo-app/src/DeleteProjectDialog.tsx +0 -46
  107. package/templates/template-tutorial-todo-app/src/Dialog.module.css +0 -10
  108. package/templates/template-tutorial-todo-app/src/Dialog.tsx +0 -19
  109. package/templates/template-tutorial-todo-app/src/Home.module.css +0 -34
  110. package/templates/template-tutorial-todo-app/src/Home.tsx +0 -63
  111. package/templates/template-tutorial-todo-app/src/Layout.module.css +0 -16
  112. package/templates/template-tutorial-todo-app/src/Layout.tsx +0 -21
  113. package/templates/template-tutorial-todo-app/src/Login.module.css +0 -5
  114. package/templates/template-tutorial-todo-app/src/Login.tsx +0 -44
  115. package/templates/template-tutorial-todo-app/src/ProjectSelect.tsx +0 -40
  116. package/templates/template-tutorial-todo-app/src/TaskList.module.css +0 -6
  117. package/templates/template-tutorial-todo-app/src/TaskList.tsx +0 -38
  118. package/templates/template-tutorial-todo-app/src/TaskListItem.module.css +0 -13
  119. package/templates/template-tutorial-todo-app/src/TaskListItem.tsx +0 -40
  120. package/templates/template-tutorial-todo-app/src/client.ts.hbs +0 -31
  121. package/templates/template-tutorial-todo-app/src/index.css +0 -75
  122. package/templates/template-tutorial-todo-app/src/main.tsx +0 -36
  123. package/templates/template-tutorial-todo-app/src/mocks.ts +0 -137
  124. package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +0 -60
  125. package/templates/template-tutorial-todo-app/src/useProjects.ts +0 -43
  126. package/templates/template-tutorial-todo-app/src/vite-env.d.ts +0 -1
  127. package/templates/template-tutorial-todo-app/tsconfig.json +0 -25
  128. package/templates/template-tutorial-todo-app/tsconfig.node.json +0 -10
  129. package/templates/template-tutorial-todo-app/vite.config.ts.hbs +0 -19
  130. package/templates/template-vue/.vscode/extensions.json +0 -3
  131. package/templates/template-vue/README.md.hbs +0 -35
  132. package/templates/template-vue/_gitignore +0 -24
  133. package/templates/template-vue/index.html +0 -15
  134. package/templates/template-vue/package.json.hbs +0 -22
  135. package/templates/template-vue/public/palantir.svg +0 -3
  136. package/templates/template-vue/public/vue.svg +0 -1
  137. package/templates/template-vue/src/AuthCallback.vue +0 -22
  138. package/templates/template-vue/src/Home.vue.hbs +0 -38
  139. package/templates/template-vue/src/Layout.vue +0 -26
  140. package/templates/template-vue/src/Login.vue +0 -36
  141. package/templates/template-vue/src/client.ts.hbs +0 -31
  142. package/templates/template-vue/src/main.ts +0 -35
  143. package/templates/template-vue/src/style.css +0 -81
  144. package/templates/template-vue/src/vite-env.d.ts +0 -1
  145. package/templates/template-vue/tsconfig.json +0 -25
  146. package/templates/template-vue/tsconfig.node.json +0 -10
  147. package/templates/template-vue/vite.config.ts.hbs +0 -24
@@ -1,36 +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
- {
12
- path: "/",
13
- element: <AuthenticatedRoute />,
14
- children: [
15
- {
16
- path: "/",
17
- element: <Home />,
18
- },
19
- ],
20
- },
21
- {
22
- path: "/login",
23
- element: <Login />,
24
- },
25
- {
26
- // This is the route defined in your application's redirect URL
27
- path: "/auth/callback",
28
- element: <AuthCallback />,
29
- },
30
- ],
31
- { basename: import.meta.env.BASE_URL },
32
- );
33
-
34
- ReactDOM.createRoot(document.getElementById("root")!).render(
35
- <RouterProvider router={router} />,
36
- );
@@ -1 +0,0 @@
1
- /// <reference types="vite/client" />
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "useDefineForClassFields": true,
5
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "noEmit": true,
15
- "jsx": "react-jsx",
16
-
17
- /* Linting */
18
- "strict": true,
19
- "noUnusedLocals": true,
20
- "noUnusedParameters": true,
21
- "noFallthroughCasesInSwitch": true
22
- },
23
- "include": ["src"],
24
- "references": [{ "path": "./tsconfig.node.json" }]
25
- }
@@ -1,10 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "composite": true,
4
- "skipLibCheck": true,
5
- "module": "ESNext",
6
- "moduleResolution": "bundler",
7
- "allowSyntheticDefaultImports": true
8
- },
9
- "include": ["vite.config.ts"]
10
- }
@@ -1,19 +0,0 @@
1
- import react from "@vitejs/plugin-react";
2
- import { defineConfig } from "vite";
3
-
4
- // https://vitejs.dev/config/
5
- export default defineConfig({
6
- plugins: [react()],
7
- server: {
8
- port: 8080,
9
- {{#if corsProxy}}
10
- proxy: {
11
- "^(/multipass/api|/api)": {
12
- target: "{{foundryUrl}}",
13
- changeOrigin: true,
14
- secure: true,
15
- },
16
- },
17
- {{/if}}
18
- },
19
- });
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: { browser: true, es2020: true },
4
- extends: [
5
- "eslint:recommended",
6
- "plugin:@typescript-eslint/recommended",
7
- "plugin:react-hooks/recommended",
8
- ],
9
- ignorePatterns: ["dist", ".eslintrc.cjs"],
10
- parser: "@typescript-eslint/parser",
11
- plugins: ["react-refresh"],
12
- rules: {
13
- "react-refresh/only-export-components": [
14
- "warn",
15
- { allowConstantExport: true },
16
- ],
17
- },
18
- };
@@ -1,34 +0,0 @@
1
- # {{project}}
2
-
3
-
4
- This project was generated with `@osdk/create-app` and is intended to be used alongside the Developer Console tutorial for creating an AIP Logic backed To Do App against a reference Ontology.
5
-
6
- ## Developing
7
-
8
- Run the following command or equivalent with your preferred package manager to start a local development server on `http://localhost:8080`:
9
-
10
- ```sh
11
- npm run dev
12
- ```
13
-
14
- Development configuration is stored in `.env.development`.
15
-
16
- {{#if corsProxy}}
17
- In order to make API requests to Foundry, a CORS proxy has been set up for local development which may be removed if the stack is configured to allow `http://localhost:8080` to load resources. The configured OAuth client must also allow `http://localhost:8080/auth/callback` as a redirect URL.
18
- {{else}}
19
- In order to make API requests to Foundry, CORS must be configured for the stack to allow `http://localhost:8080` to load resources. The configured OAuth client must also allow `http://localhost:8080/auth/callback` as a redirect URL.
20
- {{/if}}
21
-
22
- ## Deploying
23
-
24
- Run the following command or equivalent with your preferred package manager to create a production build of your application:
25
-
26
- ```sh
27
- npm run build
28
- ```
29
-
30
- Production configuration is stored in `.env.production`.
31
-
32
- If you did not fill in the URL your production application will be hosted on you will need to fill in the `VITE_FOUNDRY_REDIRECT_URL` in `.env.production`.
33
-
34
- In order to make API requests to Foundry, CORS must be configured for the stack to allow the production origin to load resources. The configured OAuth client must also allow the production origin auth callback as a redirect URL.
@@ -1,15 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/todo-aip-app.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Ontology SDK Tutorial - To do AIP App</title>
8
- </head>
9
- <body>
10
- <div id="root-container">
11
- <div id="root"></div>
12
- </div>
13
- <script type="module" src="/src/main.tsx"></script>
14
- </body>
15
- </html>
@@ -1,31 +0,0 @@
1
- {
2
- "name": "{{project}}",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "dev": "vite",
8
- "build": "tsc && vite build",
9
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
10
- "preview": "vite preview"
11
- },
12
- "dependencies": {
13
- "{{osdkPackage}}": "latest",
14
- "react": "^18",
15
- "react-dom": "^18",
16
- "react-router-dom": "^6.23.1",
17
- "swr": "^2.2.5"
18
- },
19
- "devDependencies": {
20
- "@types/react": "^18",
21
- "@types/react-dom": "^18",
22
- "@typescript-eslint/eslint-plugin": "^7.16.0",
23
- "@typescript-eslint/parser": "^7.16.0",
24
- "@vitejs/plugin-react": "^4.2.0",
25
- "eslint": "^8.57.0",
26
- "eslint-plugin-react-hooks": "^4.6.2",
27
- "eslint-plugin-react-refresh": "^0.4.6",
28
- "typescript": "^5.2.2",
29
- "vite": "^5.2.11"
30
- }
31
- }
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M7.99949 1H2.06186C0.477294 1 -0.513276 2.66624 0.278565 3.99968L2.65409 8L0.278565 12.0003C-0.513276 13.3338 0.477295 15 2.06186 15H13.9381C15.5227 15 16.5133 13.3338 15.7214 12.0003L13.3459 8L15.7214 3.99968C16.5133 2.66624 15.5227 1 13.9381 1H8.00051H7.99949ZM6.21704 2.00008H2.06186C1.26957 2.00008 0.774289 2.8332 1.17021 3.49992L3.2483 6.99937L6.21704 2.00008ZM3.2483 9.00063L1.17021 12.5001C0.77429 13.1668 1.26957 13.9999 2.06186 13.9999H6.21704L3.2483 9.00063ZM9.78296 13.9999H13.9381C14.7304 13.9999 15.2257 13.1668 14.8298 12.5001L12.7517 9.00063L9.78296 13.9999ZM12.1575 8L8.89164 13.4996C8.4955 14.1667 7.5045 14.1667 7.10836 13.4996L3.84251 8L7.10836 2.5004C7.5045 1.83331 8.49551 1.83331 8.89165 2.5004L12.1575 8ZM12.7517 6.99936L14.8298 3.49992C15.2257 2.8332 14.7304 2.00008 13.9381 2.00008H9.78296L12.7517 6.99936Z" fill="white"/>
3
- </svg>
@@ -1,19 +0,0 @@
1
- <svg width="50" height="50" viewBox="0 0 50 50" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_3572_62195)">
3
- <rect opacity="0.1" width="50" height="50" fill="#9881F3"/>
4
- <rect x="7" y="11" width="12" height="12" rx="2" fill="#7961DB"/>
5
- <rect x="7.5" y="11.5" width="11" height="11" rx="1.5" stroke="white" stroke-opacity="0.1"/>
6
- <path fill-rule="evenodd" clip-rule="evenodd" d="M16 14.375C15.79 14.375 15.6025 14.4575 15.4675 14.5925L12.25 17.8175L10.5325 16.0925C10.3975 15.9575 10.21 15.875 10 15.875C9.5875 15.875 9.25 16.2125 9.25 16.625C9.25 16.835 9.3325 17.0225 9.4675 17.1575L11.7175 19.4075C11.8525 19.5425 12.04 19.625 12.25 19.625C12.46 19.625 12.6475 19.5425 12.7825 19.4075L16.5325 15.6575C16.6675 15.5225 16.75 15.335 16.75 15.125C16.75 14.7125 16.4125 14.375 16 14.375Z" fill="white"/>
7
- <rect opacity="0.5" x="22" y="15" width="12" height="5" rx="2.5" fill="#634DBF"/>
8
- <rect opacity="0.5" x="36" y="15" width="9" height="5" rx="2.5" fill="#634DBF"/>
9
- <rect x="7.5" y="28.5" width="11" height="11" rx="1.5" fill="#A79BDA" fill-opacity="0.1"/>
10
- <rect x="7.5" y="28.5" width="11" height="11" rx="1.5" stroke="#A39CC1"/>
11
- <rect opacity="0.5" x="23" y="32" width="6" height="5" rx="2.5" fill="#634DBF"/>
12
- <path opacity="0.5" d="M31 34.5C31 33.1193 32.3228 32 33.9545 32H41.0455C42.6772 32 44 33.1193 44 34.5C44 35.8807 42.6772 37 41.0455 37H33.9545C32.3228 37 31 35.8807 31 34.5Z" fill="#634DBF"/>
13
- </g>
14
- <defs>
15
- <clipPath id="clip0_3572_62195">
16
- <rect width="50" height="50" rx="4" fill="white"/>
17
- </clipPath>
18
- </defs>
19
- </svg>
@@ -1,24 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { useNavigate } from "react-router-dom";
3
- import client from "./client";
4
-
5
- /**
6
- * Component to render at `/auth/callback`
7
- * This calls signIn() again to save the token, and then navigates the user back to the home page.
8
- */
9
- function AuthCallback() {
10
- const [error, setError] = useState<string | undefined>(undefined);
11
- const navigate = useNavigate();
12
-
13
- // This effect conflicts with React 18 strict mode in development
14
- // https://react.dev/learn/synchronizing-with-effects#how-to-handle-the-effect-firing-twice-in-development
15
- useEffect(() => {
16
- client.auth
17
- .signIn()
18
- .then(() => navigate("/", { replace: true }))
19
- .catch((e: unknown) => setError((e as Error).message ?? e));
20
- }, [navigate]);
21
- return <div>{error != null ? error : "Authenticating…"}</div>;
22
- }
23
-
24
- export default AuthCallback;
@@ -1,33 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { Outlet, useNavigate } from "react-router-dom";
3
- import client from "./client";
4
-
5
- /**
6
- * A component that can be used to wrap routes that require authentication.
7
- * Nested routes may assume that a valid token is present.
8
- */
9
- function AuthenticatedRoute() {
10
- const navigate = useNavigate();
11
- const [token, setToken] = useState(client.auth.token);
12
- useEffect(() => {
13
- if (client.auth.token == null || client.auth.token.isExpired) {
14
- client.auth
15
- .refresh()
16
- .then(() => {
17
- setToken(client.auth.token);
18
- })
19
- .catch(() => {
20
- // If we cannot refresh the token (i.e. the user is not logged in) we redirect to the login page
21
- navigate("/login");
22
- });
23
- }
24
- }, [navigate]);
25
-
26
- if (token == null || token.isExpired) {
27
- return null;
28
- }
29
-
30
- return <Outlet />;
31
- }
32
-
33
- export default AuthenticatedRoute;
@@ -1,3 +0,0 @@
1
- .button {
2
- border: 1px solid #ccc;
3
- }
@@ -1,36 +0,0 @@
1
- import { useCallback, useState } from "react";
2
- import css from "./CreateProjectButton.module.css";
3
- import CreateProjectDialog from "./CreateProjectDialog";
4
- import useProjects from "./useProjects";
5
-
6
- interface CreateProjectButtonProps {
7
- onProjectCreated?: (projectId: string) => void;
8
- }
9
-
10
- function CreateProjectButton({ onProjectCreated }: CreateProjectButtonProps) {
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} className={css.button}>
25
- Create Project
26
- </button>
27
- <CreateProjectDialog
28
- isOpen={isOpen}
29
- onClose={handleClose}
30
- onProjectCreated={onProjectCreated}
31
- />
32
- </>
33
- );
34
- }
35
-
36
- export default CreateProjectButton;
@@ -1,15 +0,0 @@
1
- .project {
2
- display: flex;
3
- flex-direction: column;
4
- align-content: space-between;
5
- gap: 10px;
6
- }
7
- .label {
8
- display: flex;
9
- justify-content: space-between;
10
- gap: 5px;
11
- }
12
-
13
- .button {
14
- border: 1px solid #ccc;
15
- }
@@ -1,74 +0,0 @@
1
- import type { ChangeEvent } from "react";
2
- import { useCallback, useEffect, useState } from "react";
3
- import css from "./CreateProjectDialog.module.css";
4
-
5
- import Dialog from "./Dialog";
6
- import useProjects from "./useProjects";
7
-
8
- interface CreateProjectDialogProps {
9
- isOpen: boolean;
10
- onClose: () => void;
11
- onProjectCreated?: (projectId: string) => void;
12
- }
13
-
14
- function CreateProjectDialog({
15
- isOpen,
16
- onClose,
17
- onProjectCreated,
18
- }: CreateProjectDialogProps) {
19
- const { createProject } = useProjects();
20
-
21
- const [name, setName] = useState<string>("New project");
22
-
23
- const handleChangeProjectName = useCallback(
24
- (e: ChangeEvent<HTMLInputElement>) => setName(e.target.value),
25
- [],
26
- );
27
-
28
- useEffect(() => setName("New project"), [isOpen]);
29
-
30
- const [isCreating, setIsCreating] = useState(false);
31
-
32
- const handleSubmit = useCallback(async () => {
33
- setIsCreating(true);
34
- try {
35
- const projectId = await createProject(name);
36
- onProjectCreated?.(projectId);
37
- } finally {
38
- setIsCreating(false);
39
- onClose();
40
- }
41
- }, [onProjectCreated, onClose, createProject, name]);
42
-
43
- return (
44
- <Dialog
45
- isOpen={isOpen}
46
- buttons={[
47
- <button
48
- disabled={isCreating}
49
- onClick={onClose}
50
- key="cancel"
51
- className={css.button}
52
- >
53
- Cancel
54
- </button>,
55
- <button
56
- disabled={isCreating}
57
- onClick={handleSubmit}
58
- key="create"
59
- className={css.button}
60
- >
61
- Create project
62
- </button>,
63
- ]}
64
- >
65
- <div className={css.project}>
66
- <label className={css.label}>
67
- Project name:{" "}
68
- <input type="text" value={name} onChange={handleChangeProjectName} />
69
- </label>
70
- </div>
71
- </Dialog>
72
- );
73
- }
74
- export default CreateProjectDialog;
@@ -1,3 +0,0 @@
1
- .button {
2
- border: 1px solid #ccc;
3
- }
@@ -1,38 +0,0 @@
1
- import { useCallback, useState } from "react";
2
- import css from "./CreateTaskButton.module.css";
3
- import CreateTaskDialog from "./CreateTaskDialog";
4
- import type { MockProject } from "./mocks";
5
- import { useProjectTasks } from "./useProjectTasks";
6
-
7
- interface CreateTaskButtonProps {
8
- project: MockProject;
9
- onTaskCreated: (taskId: string) => void;
10
- }
11
-
12
- function CreateTaskButton({ project, onTaskCreated }: CreateTaskButtonProps) {
13
- const { isLoading: isLoadingTasks, isError: isErrorTasks } = useProjectTasks(
14
- project,
15
- );
16
-
17
- const [isOpen, setIsOpen] = useState(false);
18
- const handleOpen = useCallback(() => setIsOpen(true), []);
19
- const handleClose = useCallback(() => setIsOpen(false), []);
20
-
21
- if (isLoadingTasks || isErrorTasks) {
22
- return null;
23
- }
24
-
25
- return (
26
- <>
27
- <button onClick={handleOpen} className={css.button}>Create Task</button>
28
- <CreateTaskDialog
29
- project={project}
30
- isOpen={isOpen}
31
- onClose={handleClose}
32
- onTaskCreated={onTaskCreated}
33
- />
34
- </>
35
- );
36
- }
37
-
38
- export default CreateTaskButton;
@@ -1,66 +0,0 @@
1
- .task {
2
- display: grid;
3
- grid-template-columns: 1fr 1fr;
4
- grid-template-rows: auto min-content;
5
- gap: 10px;
6
- width: 500px;
7
- }
8
- .label {
9
- display: flex;
10
- gap: 5px;
11
- resize: none;
12
- }
13
-
14
- .input {
15
- width: 300px;
16
- border: 1px solid gray;
17
- border-radius: 5px;
18
- }
19
-
20
- .textArea {
21
- width: 300px;
22
- resize: vertical;
23
- border: 1px solid gray;
24
- border-radius: 5px;
25
- padding: 5px;
26
- }
27
-
28
- .aip {
29
- background-color: #7961DB;
30
- border: 1px solid #ccc;
31
- padding: 2px 5px;
32
- display: flex;
33
- justify-content: center;
34
- align-items: center;
35
- }
36
-
37
- .processing {
38
- cursor: progress;
39
- }
40
-
41
- .image {
42
- width: 16px;
43
- height: 16px;
44
- }
45
-
46
- .container {
47
- display: flex;
48
- align-items:flex-start;
49
- gap: 5px;
50
- }
51
-
52
- .dialogContainer {
53
- position: fixed;
54
- top: 0;
55
- right: 0;
56
- bottom: 0;
57
- left: 0;
58
- display: flex;
59
- justify-content: center;
60
- align-items: center;
61
- background-color: rgba(0, 0, 0, 0.5); /* Optional: for dimmed background */
62
- }
63
-
64
- .button {
65
- border: 1px solid #ccc;
66
- }
@@ -1,140 +0,0 @@
1
- import aipLogo from "/aip-icon.svg";
2
- import type { ChangeEvent } from "react";
3
- import { useCallback, useEffect, useRef, useState } from "react";
4
- import css from "./CreateTaskDialog.module.css";
5
- import Dialog from "./Dialog";
6
- import type { MockProject } from "./mocks";
7
- import { useProjectTasks } from "./useProjectTasks";
8
-
9
- interface CreateTaskDialogProps {
10
- project: MockProject;
11
- isOpen: boolean;
12
- onClose: () => void;
13
- onTaskCreated: (taskId: string) => void;
14
- }
15
-
16
- function CreateTaskDialog(
17
- { project, isOpen, onClose, onTaskCreated }: CreateTaskDialogProps,
18
- ) {
19
- const { createTask, getRecommendedTaskDescription } = useProjectTasks(
20
- project,
21
- );
22
-
23
- const [name, setName] = useState<string>("New task");
24
- const [description, setDescription] = useState<string>("");
25
- const [isProcessing, setIsProcessing] = useState<boolean>(false);
26
- const [isCreating, setIsCreating] = useState(false);
27
- const textAreaRef = useRef<HTMLTextAreaElement>(null);
28
-
29
- const handleChangeTaskName = useCallback(
30
- (e: ChangeEvent<HTMLInputElement>) => setName(e.target.value),
31
- [],
32
- );
33
-
34
- const handleChangeTaskDescription = useCallback(
35
- (e: ChangeEvent<HTMLTextAreaElement>) => setDescription(e.target.value),
36
- [],
37
- );
38
-
39
- const handleTaskDescriptionRecommendation = useCallback(async () => {
40
- setIsProcessing(true);
41
- const recommendedDescription = await getRecommendedTaskDescription(name);
42
- setDescription(recommendedDescription);
43
- setIsProcessing(false);
44
- }, [getRecommendedTaskDescription, name]);
45
-
46
- useEffect(() => {
47
- setName("New task");
48
- setDescription("");
49
- }, [isOpen]);
50
- useEffect(() => {
51
- if (textAreaRef.current) {
52
- const textArea = textAreaRef.current;
53
- textArea.style.height = "auto";
54
- textArea.style.height = `${textArea.scrollHeight}px`;
55
- }
56
- }, [description]);
57
-
58
- const handleSubmit = useCallback(async () => {
59
- setIsCreating(true);
60
- try {
61
- const taskId = await createTask(name, description);
62
- if (taskId != null) {
63
- onTaskCreated(taskId);
64
- }
65
- } finally {
66
- setIsCreating(false);
67
- onClose();
68
- }
69
- }, [onClose, createTask, onTaskCreated, name, description]);
70
-
71
- return (
72
- <>
73
- {isOpen && (
74
- <div className={css.dialogContainer}>
75
- <Dialog
76
- isOpen={isOpen}
77
- buttons={[
78
- <button
79
- disabled={isCreating}
80
- onClick={onClose}
81
- key="cancel"
82
- className={css.button}
83
- >
84
- Cancel
85
- </button>,
86
- <button
87
- disabled={isCreating}
88
- onClick={handleSubmit}
89
- key="create"
90
- className={css.button}
91
- >
92
- Create task
93
- </button>,
94
- ]}
95
- >
96
- <div className={css.task}>
97
- <label className={css.label}>
98
- Task name:{" "}
99
- </label>
100
- <input
101
- type="text"
102
- value={name}
103
- onChange={handleChangeTaskName}
104
- className={css.input}
105
- />
106
-
107
- <label className={css.label}>
108
- Task description:{" "}
109
- </label>
110
- <div className={css.container}>
111
- <textarea
112
- ref={textAreaRef}
113
- value={description}
114
- onChange={handleChangeTaskDescription}
115
- className={css.textArea}
116
- rows={2}
117
- />
118
- <button
119
- disabled={isProcessing}
120
- className={`${css.aip} ${isProcessing ? css.processing : ""}`}
121
- title="Click here to get AIP task description recommendation"
122
- type="button"
123
- onClick={handleTaskDescriptionRecommendation}
124
- >
125
- <img
126
- src={aipLogo}
127
- alt="AIP"
128
- className={css.image}
129
- />
130
- </button>
131
- </div>
132
- </div>
133
- </Dialog>
134
- </div>
135
- )}
136
- </>
137
- );
138
- }
139
-
140
- export default CreateTaskDialog;
@@ -1,3 +0,0 @@
1
- .button {
2
- border: 1px solid #ccc;
3
- }