@osdk/create-app 0.17.0-beta.0 → 0.17.0-beta.2

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 (65) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/browser/index.js +8 -2
  3. package/build/browser/index.js.map +1 -1
  4. package/build/cjs/index.cjs +8 -2
  5. package/build/cjs/index.cjs.map +1 -1
  6. package/build/esm/index.js +8 -2
  7. package/build/esm/index.js.map +1 -1
  8. package/build/esm/templates.d.ts.map +1 -1
  9. package/package.json +2 -2
  10. package/templates/template-tutorial-todo-aip-app/.eslintrc.cjs +18 -0
  11. package/templates/template-tutorial-todo-aip-app/README.md.hbs +34 -0
  12. package/templates/template-tutorial-todo-aip-app/index.html +15 -0
  13. package/templates/template-tutorial-todo-aip-app/package.json.hbs +31 -0
  14. package/templates/template-tutorial-todo-aip-app/public/aip-icon.svg +3 -0
  15. package/templates/template-tutorial-todo-aip-app/public/todo-aip-app.svg +19 -0
  16. package/templates/template-tutorial-todo-aip-app/src/AuthCallback.tsx +24 -0
  17. package/templates/template-tutorial-todo-aip-app/src/AuthenticatedRoute.tsx +33 -0
  18. package/templates/template-tutorial-todo-aip-app/src/CreateProjectButton.module.css +3 -0
  19. package/templates/template-tutorial-todo-aip-app/src/CreateProjectButton.tsx +36 -0
  20. package/templates/template-tutorial-todo-aip-app/src/CreateProjectDialog.module.css +15 -0
  21. package/templates/template-tutorial-todo-aip-app/src/CreateProjectDialog.tsx +74 -0
  22. package/templates/template-tutorial-todo-aip-app/src/CreateTaskButton.module.css +3 -0
  23. package/templates/template-tutorial-todo-aip-app/src/CreateTaskButton.tsx +38 -0
  24. package/templates/template-tutorial-todo-aip-app/src/CreateTaskDialog.module.css +66 -0
  25. package/templates/template-tutorial-todo-aip-app/src/CreateTaskDialog.tsx +140 -0
  26. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectButton.module.css +3 -0
  27. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectButton.tsx +37 -0
  28. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectDialog.module.css +3 -0
  29. package/templates/template-tutorial-todo-aip-app/src/DeleteProjectDialog.tsx +57 -0
  30. package/templates/template-tutorial-todo-aip-app/src/Dialog.module.css +11 -0
  31. package/templates/template-tutorial-todo-aip-app/src/Dialog.tsx +19 -0
  32. package/templates/template-tutorial-todo-aip-app/src/Home.module.css +80 -0
  33. package/templates/template-tutorial-todo-aip-app/src/Home.tsx +135 -0
  34. package/templates/template-tutorial-todo-aip-app/src/Layout.module.css +16 -0
  35. package/templates/template-tutorial-todo-aip-app/src/Layout.tsx +23 -0
  36. package/templates/template-tutorial-todo-aip-app/src/Login.module.css +5 -0
  37. package/templates/template-tutorial-todo-aip-app/src/Login.tsx +44 -0
  38. package/templates/template-tutorial-todo-aip-app/src/ProjectSelect.tsx +40 -0
  39. package/templates/template-tutorial-todo-aip-app/src/TaskList.module.css +7 -0
  40. package/templates/template-tutorial-todo-aip-app/src/TaskList.tsx +44 -0
  41. package/templates/template-tutorial-todo-aip-app/src/TaskListItem.module.css +35 -0
  42. package/templates/template-tutorial-todo-aip-app/src/TaskListItem.tsx +58 -0
  43. package/templates/template-tutorial-todo-aip-app/src/client.ts.hbs +31 -0
  44. package/templates/template-tutorial-todo-aip-app/src/index.css +75 -0
  45. package/templates/template-tutorial-todo-aip-app/src/main.tsx +36 -0
  46. package/templates/template-tutorial-todo-aip-app/src/mocks.ts +187 -0
  47. package/templates/template-tutorial-todo-aip-app/src/useProjectTasks.ts +75 -0
  48. package/templates/template-tutorial-todo-aip-app/src/useProjects.ts +58 -0
  49. package/templates/template-tutorial-todo-aip-app/src/vite-env.d.ts +1 -0
  50. package/templates/template-tutorial-todo-aip-app/tsconfig.json +25 -0
  51. package/templates/template-tutorial-todo-aip-app/tsconfig.node.json +10 -0
  52. package/templates/template-tutorial-todo-aip-app/vite.config.ts.hbs +19 -0
  53. package/templates/template-tutorial-todo-app/README.md.hbs +1 -1
  54. package/templates/template-tutorial-todo-app/src/CreateProjectDialog.tsx +3 -3
  55. package/templates/template-tutorial-todo-app/src/CreateTaskDialog.tsx +3 -3
  56. package/templates/template-tutorial-todo-app/src/DeleteProjectDialog.tsx +3 -3
  57. package/templates/template-tutorial-todo-app/src/Dialog.module.css +5 -0
  58. package/templates/template-tutorial-todo-app/src/Dialog.tsx +1 -1
  59. package/templates/template-tutorial-todo-app/src/Home.module.css +1 -2
  60. package/templates/template-tutorial-todo-app/src/Home.tsx +4 -3
  61. package/templates/template-tutorial-todo-app/src/TaskListItem.module.css +10 -0
  62. package/templates/template-tutorial-todo-app/src/TaskListItem.tsx +11 -8
  63. package/templates/template-tutorial-todo-app/src/index.css +0 -5
  64. package/templates/template-tutorial-todo-app/src/mocks.ts +3 -3
  65. package/templates/template-tutorial-todo-app/src/useProjectTasks.ts +5 -0
@@ -35,12 +35,12 @@ function CreateTaskDialog({ project, isOpen, onClose }: CreateTaskDialogProps) {
35
35
  <Dialog
36
36
  isOpen={isOpen}
37
37
  buttons={[
38
- <button disabled={isCreating} onClick={handleSubmit} key="create">
39
- Create task
40
- </button>,
41
38
  <button disabled={isCreating} onClick={onClose} key="cancel">
42
39
  Cancel
43
40
  </button>,
41
+ <button disabled={isCreating} onClick={handleSubmit} key="create">
42
+ Create task
43
+ </button>,
44
44
  ]}
45
45
  >
46
46
  <label>
@@ -31,12 +31,12 @@ function DeleteProjectDialog({
31
31
  <Dialog
32
32
  isOpen={isOpen}
33
33
  buttons={[
34
- <button disabled={isDeleting} onClick={handleSubmit} key="delete">
35
- Delete
36
- </button>,
37
34
  <button disabled={isDeleting} onClick={onClose} key="cancel">
38
35
  Cancel
39
36
  </button>,
37
+ <button disabled={isDeleting} onClick={handleSubmit} key="delete">
38
+ Delete
39
+ </button>,
40
40
  ]}
41
41
  >
42
42
  Are you sure you want to delete this project?
@@ -3,3 +3,8 @@
3
3
  gap: 1em;
4
4
  margin-top: 1em;
5
5
  }
6
+
7
+ .dialog {
8
+ border: 1px solid black;
9
+ border-radius: 10px;
10
+ }
@@ -8,7 +8,7 @@ interface DialogProps {
8
8
 
9
9
  function Dialog({ children, isOpen, buttons }: PropsWithChildren<DialogProps>) {
10
10
  return (
11
- <dialog open={isOpen}>
11
+ <dialog open={isOpen} className={css.dialog}>
12
12
  {children}
13
13
  {buttons != null && buttons.length > 0 && (
14
14
  <div className={css.buttons}>{buttons}</div>
@@ -6,8 +6,7 @@
6
6
  .tutorialBanner {
7
7
  flex: 1;
8
8
  width: 0;
9
- background: #646cff;
10
- color: #ffffff;
9
+ background: hsl(35, 100%, 70%);
11
10
  border-radius: 1em;
12
11
  padding: 1em;
13
12
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
@@ -30,11 +30,12 @@ function Home() {
30
30
  <div className={css.tutorialBannerWrapper}>
31
31
  <div className={css.tutorialBanner}>
32
32
  <p className={css.tutorialBannerTitle}>
33
- 💡 Welcome to this tutorial!
33
+ 💡 Welcome to To Do app tutorial!
34
34
  </p>
35
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?
36
+ The To Do App is implemented with mock in-memory data.
37
+ <br />Can you solve how to switch it to use the Ontology SDK
38
+ instead?
38
39
  </p>
39
40
  </div>
40
41
  </div>
@@ -1,3 +1,13 @@
1
1
  .label {
2
2
  margin-left: 0.5em;
3
3
  }
4
+
5
+ .checked {
6
+ text-decoration: line-through;
7
+ }
8
+
9
+ .delete {
10
+ border: 1px solid #ccc;
11
+ padding: 2px;
12
+ }
13
+
@@ -20,14 +20,17 @@ function TaskListItem({ task, deleteTask }: TaskListItemProps) {
20
20
 
21
21
  return (
22
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}`}>
23
+ <label
24
+ className={`${css.label} ${isDeleting ? css.checked : ""}`}
25
+ htmlFor={`${task.id}`}
26
+ >
27
+ <input
28
+ type="checkbox"
29
+ onChange={handleClick}
30
+ checked={isDeleting}
31
+ className={css.delete}
32
+ title="Delete task"
33
+ />
31
34
  {task.title}
32
35
  </label>
33
36
  </li>
@@ -3,10 +3,6 @@
3
3
  line-height: 1.5;
4
4
  font-weight: 400;
5
5
 
6
- color-scheme: light dark;
7
- color: rgba(255, 255, 255, 0.87);
8
- background-color: #242424;
9
-
10
6
  font-synthesis: none;
11
7
  text-rendering: optimizeLegibility;
12
8
  -webkit-font-smoothing: antialiased;
@@ -54,7 +50,6 @@ button {
54
50
  font-size: 1em;
55
51
  font-weight: 500;
56
52
  font-family: inherit;
57
- background-color: #1a1a1a;
58
53
  cursor: pointer;
59
54
  transition: border-color 0.25s;
60
55
  }
@@ -18,7 +18,7 @@ const projects: MockProject[] = [
18
18
  $apiName: "MockProject",
19
19
  $primaryKey: "1",
20
20
  id: "1",
21
- name: "Fake Project",
21
+ name: "Mock project",
22
22
  tasks: [
23
23
  {
24
24
  $apiName: "MockTask",
@@ -44,7 +44,7 @@ const projects: MockProject[] = [
44
44
  $apiName: "MockProject",
45
45
  $primaryKey: "2",
46
46
  id: "2",
47
- name: "Yet Another Fake Project",
47
+ name: "Yet another mock project",
48
48
  tasks: [
49
49
  {
50
50
  $apiName: "MockTask",
@@ -78,7 +78,7 @@ async function createProject({
78
78
  name,
79
79
  }: {
80
80
  name: string;
81
- }): Promise<MockTask["$primaryKey"]> {
81
+ }): Promise<MockProject["$primaryKey"]> {
82
82
  await delay();
83
83
  const id = randomId();
84
84
  projects.push({
@@ -37,6 +37,7 @@ export function useProjectTasks(project: MockProject | undefined) {
37
37
  if (project == null) {
38
38
  return;
39
39
  }
40
+ await sleep(1000);
40
41
  // Try to implement this with the Ontology SDK!
41
42
  await Mocks.deleteTask(task.$primaryKey);
42
43
  await mutate();
@@ -53,3 +54,7 @@ export function useProjectTasks(project: MockProject | undefined) {
53
54
  deleteTask,
54
55
  };
55
56
  }
57
+
58
+ function sleep(ms: number) {
59
+ return new Promise(resolve => setTimeout(resolve, ms));
60
+ }