Overhaul social card (again) #541
Reference in New Issue
Block a user
Delete Branch "kurt/overhaul-social-card"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Puts social-card and thumbnail capture into an editor tab, as well as making them "live" (perspective can be changed in the card). It's not perfect and will probably needs some follow up work but does resolve #517 for now.
https://user-images.githubusercontent.com/29681384/136670871-d8b3b6d4-269c-42ee-978f-6d70f28e632e.mov
Outstanding issues and other thoughts:
@franknoirot don't feel obligated to look through it at great lengths, but I did make a change to the tab names
looks smooth :) nice work
This is so clever @Irev-Dev ! Makes me think a lot about the tabs as a great interface for other stuff in the future like sharing or configuring an embed.
One question: does the image get updated when the tab is closed? That might be a little unclear to the user, not sure but may be worth having a Save or Update Image button in that area.
ofc, It's far from done.
I think I want there to be a say to save the thumbnail and the social-card separately
@@ -183,4 +189,4 @@<divclassName={`absolute inset-0 transition-opacity duration-500 ${isDragging ? 'opacity-25' : 'opacity-100'}`}Changes the IDE view so that it doesn't rely on state/context so that multiple can be used together, it can than be wrapped in a component that provides it with state for the main IDE case.
Got rid of the skybox, wasn't worth the perf hit, had to tweaking lighting for this.
Removing gizmo for view when in the social card etc
Removing Customizer for view when in the social card etc
Provides PureIdeViewer with state
@@ -41,3 +54,4 @@editorTabs: EditorTab[]currentModel: numberobjectData: {type: 'INIT' | ArtifactTypesI thought models was too vague of a name
@@ -34,0 +40,4 @@interface ComponentTab {type: 'component'label: stringComponent: React.FCAdded a tab type that will render a component.
@@ -354,0 +365,4 @@} else {dispatch({type: 'healthyRender',payload: {Similar to PureIdeViewer, I needed a render function that didn't automatically update state so the the PureIdeViewer's could update they're model (mostly important for OpenSCAD since it needs a new image with perspective change)
It can than be wrapped to automatically update state so functionally is the same for the normal IDE viewer.
Wraps RequestRenderArgsStateless to automatically update state.
@@ -194,0 +204,4 @@resolve(capturedImage)})}asyncHelper()This might have been more effort than what it was worth. The social image need to be captured at a rather large size 1200x630, so the aim here is to scale ti down by half so that for the viewer so that it's not dominating the UI.
However the three canvas can gets confused and ends up halving again, which is why you'll see the
canvasRatiosprinkled around to try and fix things.@@ -194,0 +210,4 @@loading: 'Saving Image',success: (finalImg: string) => (<div className="flex flex-col items-center"><b className="py-2">Image saved!</b>even though we're using the canvas directly (passed in through
LiveProjectViewer), this doesn't work when capturing withimport { toJpeg } from 'html-to-image'and so the canvas need to be captured, than the image inserted over the canvas viapartSnapShot64so that we can than usetoJpegsetTimeout without delayed used to put this at the end of the event loop so that component can re-render after
partSnapShot64Setter(useState) is called.Bundling a few steps in one promise so that we can use
toast.promiseReady for review now, I've updated the description.
@@ -194,0 +135,4 @@<divstyle={{ width: '500px', height: '375px' }}className="rounded-md shadow-ch border border-gray-400 overflow-hidden my-4">@Irev-Dev could this component be used for a /view endpoint?
@@ -183,4 +189,4 @@<divclassName={`absolute inset-0 transition-opacity duration-500 ${isDragging ? 'opacity-25' : 'opacity-100'}`}This is a great decoupling move!
@@ -41,3 +54,4 @@editorTabs: EditorTab[]currentModel: numberobjectData: {type: 'INIT' | ArtifactTypesTotally hear that, it's what Monaco calls their different "tab"-like things but this is better especially since there are like 6 things that could be called models in the context of this app lol.
@@ -194,0 +135,4 @@<divstyle={{ width: '500px', height: '375px' }}className="rounded-md shadow-ch border border-gray-400 overflow-hidden my-4">Yeah I suppose so 👍
@@ -41,3 +54,4 @@editorTabs: EditorTab[]currentModel: numberobjectData: {type: 'INIT' | ArtifactTypesOh right, I didn't think about the monaco connection, I think tabs is okay.