Skip to content

Commit e98ccf5

Browse files
christianalfoniSaraVieirasiddharthkp
authored
WIP: Comment glyphs (codesandbox#3726)
* initial stuff * initial glyph implementation * optimistic transposing * add active class to glyphs * WIP: add comment from context * handling optimistic thread * multi comments on line * favor active over multi icon * add numbers * copy changes from codesandbox#3729 * remove trigger check * remove react-draggable coz we have framer motino * open file and scroll to position * refactored most, continuing on laptop... * fix replies * glyph likes themes * oops that not supposed to be there * extract avatarblock * move edit comment out * use edit content in reply * add dialog positioning * always render even if position is not known * better fallback position * remove unused ref * add polling mechanism to active comment * change the fallback just a little more * optimistically set position * fix checking id in comment glyph boundary as well * remove optimistic trigger * improve moving comments * use currentTarget instead * set placeholder + animate from left in fallback * move position logic into a funktion * animate based on _file change_ * rename optimistic to newComment * add permalinks (codesandbox#3744) * add permalinks * remove query from effect * move copy to clipboard to effect * add defaults * create action for commenturl * yaay * Apply suggestions from code review Co-Authored-By: Christian Alfoni <[email protected]> * Update packages/app/src/app/pages/Sandbox/index.tsx Co-Authored-By: Christian Alfoni <[email protected]> * make action Co-authored-by: Christian Alfoni <[email protected]> * fixed add comment position and decorate line * redesign new comment * fix ... icon * pull out new comment component * rename to AddComment duh * move add reply to a component * pull out comment header * pull out comment body into a component * close dialog is lame * but i am lamer * leave a comment before i forget * add comment glyph * some fixes * window collisions - first draft * cheeky scale guessing * found the missing 48px :P * dont need to track animation state now * always div for unknown semantics * fix comment current target trigger * omg strings! * fix animations on comments * improve handling optimistic * use animate controller * add comments * Add times and move file name (codesandbox#3752) Co-authored-by: Christian Alfoni <[email protected]> * fix issue with moving from optimistic to existing comment * refactor to initial and end position * ensure we actually have a comments state for the sandbox * fix multi popup * auto focus on creating new comment * add permission checks on comments * drag handle!!! * improve dragging * style multi comments (codesandbox#3763) * style multi comments * use element * update lookup * fix ot typing * fixed types and defaulting to comments * fix typing * last fixes Co-authored-by: Sara Vieira <[email protected]> Co-authored-by: siddharthkp <[email protected]>
1 parent 414f01b commit e98ccf5

File tree

49 files changed

+2516
-1389
lines changed

Some content is hidden

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

49 files changed

+2516
-1389
lines changed

packages/@types/ot/index.d.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,16 @@ declare module 'ot' {
2121
toJSON(): SerializedTextOperation;
2222
}
2323

24-
export { TextOperation };
24+
interface Range {
25+
new (anchor: number, head: number): Range;
26+
transform(operation: TextOperation): Range;
27+
anchor: number;
28+
head: number;
29+
}
30+
31+
class Selection {
32+
static Range: Range;
33+
}
34+
35+
export { TextOperation, Selection };
2536
}

packages/app/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@
194194
"react-dnd": "^9.4.0",
195195
"react-dnd-html5-backend": "^9.4.0",
196196
"react-dom": "^16.9.0",
197-
"react-draggable": "^3.0.5",
198197
"react-error-overlay": "^1.0.10",
199198
"react-icons": "^2.2.7",
200199
"react-input-autosize": "^2.2.1",

packages/app/src/app/components/CreateNewSandbox/CreateSandbox/Import/Import.tsx

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,8 @@ import {
3131
const getFullGitHubUrl = (url: string) =>
3232
`${protocolAndHost()}${gitHubToSandboxUrl(url)}`;
3333

34-
const copyToClipboard = (str: string) => {
35-
const el = document.createElement('textarea');
36-
el.value = str;
37-
el.setAttribute('readonly', '');
38-
el.style.position = 'absolute';
39-
el.style.left = '-9999px';
40-
document.body.appendChild(el);
41-
el.select();
42-
document.execCommand('copy');
43-
document.body.removeChild(el);
44-
};
45-
4634
export const Import = () => {
47-
const { state, actions } = useOvermind();
35+
const { state, actions, effects } = useOvermind();
4836
const [error, setError] = useState(null);
4937
const [transformedUrl, setTransformedUrl] = useState('');
5038
const [url, setUrl] = useState('');
@@ -117,9 +105,7 @@ export const Import = () => {
117105
<Button
118106
small
119107
style={{ fontSize: 11 }}
120-
onClick={() => {
121-
copyToClipboard(transformedUrl);
122-
}}
108+
onClick={() => effects.browser.copyToClipboard(transformedUrl)}
123109
disabled={!transformedUrl}
124110
>
125111
Copy Link

packages/app/src/app/graphql/introspection-result.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ const result: IntrospectionResultData = {
2525
},
2626
],
2727
},
28+
{
29+
kind: 'UNION',
30+
name: 'ReferenceMetadata',
31+
possibleTypes: [
32+
{
33+
name: 'CodeReferenceMetadata',
34+
},
35+
],
36+
},
2837
],
2938
},
3039
};

0 commit comments

Comments
 (0)