Skip to content

Commit 3ccda0c

Browse files
authored
Add Canvases (#34)
* add knip to CI * add preview deployments * fix site url env var * fix site_url for preview deps, also move e2e to separate job * attempt fix env var issue * remove duplicate comment * add back comment, move tooltip * add manual dispatch option to e2e test * improve preview deployments * prevent duplicate deployments to prod * fix sub-sub-domain issue * fix hardcoded url * fixes * add github repo env var * fix order of operations * attempt env var fix * fix * resolve type issue * Note yjs (#30) * add yjs live collab for notes * optimize collab performance * remove unused dep * fix missing env var * add yet another missing env var for preview * improvements * fix viewer strict mode issue * add tests, fix small issues * address comments * fixes * fix strict mode issue * fixes * resolve nits * add redo test * re-use convex preview * fix depreciated flag * add missing env var * fix env var handling * fix comments and undo bug * add canvases (#33) * add xy-flow * add live canvas features * add free-hand drawing * fix stroke impl, add more modes * add undo/redo * add color picker and selection improvements * add better zoom controls * refactor * selection fixes + minimap adjustment * improve multi select indicator * fix sidebar layout issue * improve color picker * add basic embedding and dnd * add resizing * add embedded content * add better prveiews with client side image generation for notes * add convex eslint plugin * fix ssr issue * add preview generation * fixes * improve canvas embeds * address comments * fixes * explicitly pass auth secret * fixes * more fixes * improvements * improvements * fix pre-mature throw * fix test * add resize awareness and fix canvas external file drop * address comments * fix flakey test * address comments again * fix claim token in tests * attempt fix env var issue * fix * add resend api key to preview dep
1 parent d7b6257 commit 3ccda0c

168 files changed

Lines changed: 14029 additions & 1358 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coderabbit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ early_access: false
44
enable_free_tier: true
55
inheritance: false
66
reviews:
7-
profile: chill
7+
profile: assertive
88
request_changes_workflow: false
99
high_level_summary: true
1010
high_level_summary_instructions: ''

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
cache: pnpm
2727
- run: pnpm install --frozen-lockfile
2828
- name: Deploy Convex
29-
run: npx convex deploy --cmd-url-env-var-name VITE_CONVEX_URL
29+
run: npx convex deploy
3030
env:
3131
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_DEPLOY_KEY }}'
3232
- name: Deploy Cloudflare Workers

.github/workflows/preview.yml

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030
cache: pnpm
3131
- run: pnpm install --frozen-lockfile
3232

33-
- name: Deploy Convex Preview
33+
- name: Deploy Convex Preview (Create on Open)
34+
if: github.event.action == 'opened'
3435
run: |
3536
npx convex deploy \
3637
--preview-create "pr-${{ github.event.pull_request.number }}" \
@@ -44,12 +45,33 @@ jobs:
4445
VITE_PR_NUMBER: ${{ github.event.pull_request.number }}
4546
VITE_GITHUB_REPOSITORY: ${{ github.repository }}
4647

47-
- name: Set Convex Preview Env Vars
48+
- name: Deploy Convex Preview (Update Existing)
49+
if: github.event.action != 'opened' && github.event.action != 'closed'
4850
run: |
49-
PREVIEW="pr-${{ github.event.pull_request.number }}"
50-
npx convex env set SITE_URL "${{ env.PREVIEW_URL }}" --preview-name "$PREVIEW"
51-
npx convex env set GOOGLE_CLIENT_ID "${{ secrets.GOOGLE_CLIENT_ID }}" --preview-name "$PREVIEW"
52-
npx convex env set GOOGLE_CLIENT_SECRET "${{ secrets.GOOGLE_CLIENT_SECRET }}" --preview-name "$PREVIEW"
51+
npx convex deploy \
52+
--preview-create "pr-${{ github.event.pull_request.number }}" \
53+
--cmd 'npx vite build' \
54+
--cmd-url-env-var-name VITE_CONVEX_URL
55+
env:
56+
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_PREVIEW_DEPLOY_KEY }}'
57+
VITE_CONVEX_SITE_URL: ${{ secrets.VITE_CONVEX_SITE_URL }}
58+
VITE_SITE_URL: ${{ env.PREVIEW_URL }}
59+
VITE_IS_PREVIEW: 'true'
60+
VITE_PR_NUMBER: ${{ github.event.pull_request.number }}
61+
VITE_GITHUB_REPOSITORY: ${{ github.repository }}
62+
63+
- name: Set Preview Environment Variables
64+
run: |
65+
npx convex env set BETTER_AUTH_SECRET "${{ secrets.BETTER_AUTH_SECRET }}" \
66+
--preview-name "pr-${{ github.event.pull_request.number }}"
67+
npx convex env set SITE_URL "${{ env.PREVIEW_URL }}" \
68+
--preview-name "pr-${{ github.event.pull_request.number }}"
69+
npx convex env set GOOGLE_CLIENT_ID "${{ secrets.GOOGLE_CLIENT_ID }}" \
70+
--preview-name "pr-${{ github.event.pull_request.number }}"
71+
npx convex env set GOOGLE_CLIENT_SECRET "${{ secrets.GOOGLE_CLIENT_SECRET }}" \
72+
--preview-name "pr-${{ github.event.pull_request.number }}"
73+
npx convex env set RESEND_API_KEY "${{ secrets.RESEND_API_KEY }}" \
74+
--preview-name "pr-${{ github.event.pull_request.number }}"
5375
env:
5476
CONVEX_DEPLOY_KEY: '${{ secrets.CONVEX_PREVIEW_DEPLOY_KEY }}'
5577

convex/_generated/api.d.ts

Lines changed: 38 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ import type * as campaigns_mutations from "../campaigns/mutations.js";
5151
import type * as campaigns_queries from "../campaigns/queries.js";
5252
import type * as campaigns_types from "../campaigns/types.js";
5353
import type * as campaigns_validation from "../campaigns/validation.js";
54+
import type * as canvases_baseSchema from "../canvases/baseSchema.js";
55+
import type * as canvases_functions_createCanvas from "../canvases/functions/createCanvas.js";
56+
import type * as canvases_functions_enhanceCanvas from "../canvases/functions/enhanceCanvas.js";
57+
import type * as canvases_functions_updateCanvas from "../canvases/functions/updateCanvas.js";
58+
import type * as canvases_mutations from "../canvases/mutations.js";
59+
import type * as canvases_types from "../canvases/types.js";
5460
import type * as common_constants from "../common/constants.js";
5561
import type * as common_logger from "../common/logger.js";
5662
import type * as common_slug from "../common/slug.js";
@@ -101,13 +107,11 @@ import type * as notes_functions_createNote from "../notes/functions/createNote.
101107
import type * as notes_functions_enhanceNote from "../notes/functions/enhanceNote.js";
102108
import type * as notes_functions_getNote from "../notes/functions/getNote.js";
103109
import type * as notes_functions_updateNote from "../notes/functions/updateNote.js";
104-
import type * as notes_functions_updateNoteContent from "../notes/functions/updateNoteContent.js";
105110
import type * as notes_mutations from "../notes/mutations.js";
106111
import type * as notes_queries from "../notes/queries.js";
107112
import type * as notes_types from "../notes/types.js";
108113
import type * as permissions_hasAtLeastPermissionLevel from "../permissions/hasAtLeastPermissionLevel.js";
109114
import type * as permissions_types from "../permissions/types.js";
110-
import type * as prosemirrorSync from "../prosemirrorSync.js";
111115
import type * as sessions_functions_endCurrentSession from "../sessions/functions/endCurrentSession.js";
112116
import type * as sessions_functions_getCurrentSession from "../sessions/functions/getCurrentSession.js";
113117
import type * as sessions_functions_getSession from "../sessions/functions/getSession.js";
@@ -120,6 +124,7 @@ import type * as sessions_queries from "../sessions/queries.js";
120124
import type * as sessions_types from "../sessions/types.js";
121125
import type * as sidebarItems_functions_applyToDependents from "../sidebarItems/functions/applyToDependents.js";
122126
import type * as sidebarItems_functions_applyToTree from "../sidebarItems/functions/applyToTree.js";
127+
import type * as sidebarItems_functions_claimPreviewGeneration from "../sidebarItems/functions/claimPreviewGeneration.js";
123128
import type * as sidebarItems_functions_collectDescendants from "../sidebarItems/functions/collectDescendants.js";
124129
import type * as sidebarItems_functions_defaultItemName from "../sidebarItems/functions/defaultItemName.js";
125130
import type * as sidebarItems_functions_emptyTrashBin from "../sidebarItems/functions/emptyTrashBin.js";
@@ -132,6 +137,7 @@ import type * as sidebarItems_functions_hardDeleteItem from "../sidebarItems/fun
132137
import type * as sidebarItems_functions_moveSidebarItem from "../sidebarItems/functions/moveSidebarItem.js";
133138
import type * as sidebarItems_functions_permanentlyDeleteSidebarItem from "../sidebarItems/functions/permanentlyDeleteSidebarItem.js";
134139
import type * as sidebarItems_functions_purgeExpiredTrash from "../sidebarItems/functions/purgeExpiredTrash.js";
140+
import type * as sidebarItems_functions_setPreviewImage from "../sidebarItems/functions/setPreviewImage.js";
135141
import type * as sidebarItems_internalMutations from "../sidebarItems/internalMutations.js";
136142
import type * as sidebarItems_mutations from "../sidebarItems/mutations.js";
137143
import type * as sidebarItems_queries from "../sidebarItems/queries.js";
@@ -173,6 +179,17 @@ import type * as users_mutations from "../users/mutations.js";
173179
import type * as users_queries from "../users/queries.js";
174180
import type * as users_types from "../users/types.js";
175181
import type * as users_validation from "../users/validation.js";
182+
import type * as yjsSync_constants from "../yjsSync/constants.js";
183+
import type * as yjsSync_functions_checkYjsAccess from "../yjsSync/functions/checkYjsAccess.js";
184+
import type * as yjsSync_functions_compactUpdates from "../yjsSync/functions/compactUpdates.js";
185+
import type * as yjsSync_functions_createYjsDocument from "../yjsSync/functions/createYjsDocument.js";
186+
import type * as yjsSync_functions_deleteYjsDocument from "../yjsSync/functions/deleteYjsDocument.js";
187+
import type * as yjsSync_functions_reconstructYDoc from "../yjsSync/functions/reconstructYDoc.js";
188+
import type * as yjsSync_functions_types from "../yjsSync/functions/types.js";
189+
import type * as yjsSync_functions_uint8ToArrayBuffer from "../yjsSync/functions/uint8ToArrayBuffer.js";
190+
import type * as yjsSync_internalMutations from "../yjsSync/internalMutations.js";
191+
import type * as yjsSync_mutations from "../yjsSync/mutations.js";
192+
import type * as yjsSync_queries from "../yjsSync/queries.js";
176193

177194
import type {
178195
ApiFromModules,
@@ -224,6 +241,12 @@ declare const fullApi: ApiFromModules<{
224241
"campaigns/queries": typeof campaigns_queries;
225242
"campaigns/types": typeof campaigns_types;
226243
"campaigns/validation": typeof campaigns_validation;
244+
"canvases/baseSchema": typeof canvases_baseSchema;
245+
"canvases/functions/createCanvas": typeof canvases_functions_createCanvas;
246+
"canvases/functions/enhanceCanvas": typeof canvases_functions_enhanceCanvas;
247+
"canvases/functions/updateCanvas": typeof canvases_functions_updateCanvas;
248+
"canvases/mutations": typeof canvases_mutations;
249+
"canvases/types": typeof canvases_types;
227250
"common/constants": typeof common_constants;
228251
"common/logger": typeof common_logger;
229252
"common/slug": typeof common_slug;
@@ -274,13 +297,11 @@ declare const fullApi: ApiFromModules<{
274297
"notes/functions/enhanceNote": typeof notes_functions_enhanceNote;
275298
"notes/functions/getNote": typeof notes_functions_getNote;
276299
"notes/functions/updateNote": typeof notes_functions_updateNote;
277-
"notes/functions/updateNoteContent": typeof notes_functions_updateNoteContent;
278300
"notes/mutations": typeof notes_mutations;
279301
"notes/queries": typeof notes_queries;
280302
"notes/types": typeof notes_types;
281303
"permissions/hasAtLeastPermissionLevel": typeof permissions_hasAtLeastPermissionLevel;
282304
"permissions/types": typeof permissions_types;
283-
prosemirrorSync: typeof prosemirrorSync;
284305
"sessions/functions/endCurrentSession": typeof sessions_functions_endCurrentSession;
285306
"sessions/functions/getCurrentSession": typeof sessions_functions_getCurrentSession;
286307
"sessions/functions/getSession": typeof sessions_functions_getSession;
@@ -293,6 +314,7 @@ declare const fullApi: ApiFromModules<{
293314
"sessions/types": typeof sessions_types;
294315
"sidebarItems/functions/applyToDependents": typeof sidebarItems_functions_applyToDependents;
295316
"sidebarItems/functions/applyToTree": typeof sidebarItems_functions_applyToTree;
317+
"sidebarItems/functions/claimPreviewGeneration": typeof sidebarItems_functions_claimPreviewGeneration;
296318
"sidebarItems/functions/collectDescendants": typeof sidebarItems_functions_collectDescendants;
297319
"sidebarItems/functions/defaultItemName": typeof sidebarItems_functions_defaultItemName;
298320
"sidebarItems/functions/emptyTrashBin": typeof sidebarItems_functions_emptyTrashBin;
@@ -305,6 +327,7 @@ declare const fullApi: ApiFromModules<{
305327
"sidebarItems/functions/moveSidebarItem": typeof sidebarItems_functions_moveSidebarItem;
306328
"sidebarItems/functions/permanentlyDeleteSidebarItem": typeof sidebarItems_functions_permanentlyDeleteSidebarItem;
307329
"sidebarItems/functions/purgeExpiredTrash": typeof sidebarItems_functions_purgeExpiredTrash;
330+
"sidebarItems/functions/setPreviewImage": typeof sidebarItems_functions_setPreviewImage;
308331
"sidebarItems/internalMutations": typeof sidebarItems_internalMutations;
309332
"sidebarItems/mutations": typeof sidebarItems_mutations;
310333
"sidebarItems/queries": typeof sidebarItems_queries;
@@ -346,6 +369,17 @@ declare const fullApi: ApiFromModules<{
346369
"users/queries": typeof users_queries;
347370
"users/types": typeof users_types;
348371
"users/validation": typeof users_validation;
372+
"yjsSync/constants": typeof yjsSync_constants;
373+
"yjsSync/functions/checkYjsAccess": typeof yjsSync_functions_checkYjsAccess;
374+
"yjsSync/functions/compactUpdates": typeof yjsSync_functions_compactUpdates;
375+
"yjsSync/functions/createYjsDocument": typeof yjsSync_functions_createYjsDocument;
376+
"yjsSync/functions/deleteYjsDocument": typeof yjsSync_functions_deleteYjsDocument;
377+
"yjsSync/functions/reconstructYDoc": typeof yjsSync_functions_reconstructYDoc;
378+
"yjsSync/functions/types": typeof yjsSync_functions_types;
379+
"yjsSync/functions/uint8ToArrayBuffer": typeof yjsSync_functions_uint8ToArrayBuffer;
380+
"yjsSync/internalMutations": typeof yjsSync_internalMutations;
381+
"yjsSync/mutations": typeof yjsSync_mutations;
382+
"yjsSync/queries": typeof yjsSync_queries;
349383
}>;
350384

351385
/**
@@ -375,82 +409,6 @@ export declare const internal: FilterApi<
375409
>;
376410

377411
export declare const components: {
378-
prosemirrorSync: {
379-
lib: {
380-
deleteDocument: FunctionReference<
381-
"mutation",
382-
"internal",
383-
{ id: string },
384-
null
385-
>;
386-
deleteSnapshots: FunctionReference<
387-
"mutation",
388-
"internal",
389-
{ afterVersion?: number; beforeVersion?: number; id: string },
390-
null
391-
>;
392-
deleteSteps: FunctionReference<
393-
"mutation",
394-
"internal",
395-
{
396-
afterVersion?: number;
397-
beforeTs: number;
398-
deleteNewerThanLatestSnapshot?: boolean;
399-
id: string;
400-
},
401-
null
402-
>;
403-
getSnapshot: FunctionReference<
404-
"query",
405-
"internal",
406-
{ id: string; version?: number },
407-
{ content: null } | { content: string; version: number }
408-
>;
409-
getSteps: FunctionReference<
410-
"query",
411-
"internal",
412-
{ id: string; version: number },
413-
{
414-
clientIds: Array<string | number>;
415-
steps: Array<string>;
416-
version: number;
417-
}
418-
>;
419-
latestVersion: FunctionReference<
420-
"query",
421-
"internal",
422-
{ id: string },
423-
null | number
424-
>;
425-
submitSnapshot: FunctionReference<
426-
"mutation",
427-
"internal",
428-
{
429-
content: string;
430-
id: string;
431-
pruneSnapshots?: boolean;
432-
version: number;
433-
},
434-
null
435-
>;
436-
submitSteps: FunctionReference<
437-
"mutation",
438-
"internal",
439-
{
440-
clientId: string | number;
441-
id: string;
442-
steps: Array<string>;
443-
version: number;
444-
},
445-
| {
446-
clientIds: Array<string | number>;
447-
status: "needs-rebase";
448-
steps: Array<string>;
449-
}
450-
| { status: "synced" }
451-
>;
452-
};
453-
};
454412
betterAuth: {
455413
adapter: {
456414
create: FunctionReference<

0 commit comments

Comments
 (0)