Skip to content

Commit 437ad85

Browse files
move components and fix adding comment on existing (codesandbox#3785)
* move components and fix adding comment on existing * move back profile
1 parent 9993e78 commit 437ad85

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

packages/app/src/app/overmind/effects/vscode/ModelsHandler.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
UserSelection,
77
} from '@codesandbox/common/lib/types';
88
import { getTextOperation } from '@codesandbox/common/lib/utils/diff';
9-
import { hasPermission } from '@codesandbox/common/lib/utils/permission';
109
import { COMMENTS } from '@codesandbox/common/lib/utils/feature-flags';
10+
import { hasPermission } from '@codesandbox/common/lib/utils/permission';
1111
import { indexToLineAndColumn } from 'app/overmind/utils/common';
1212
import { actions, dispatch } from 'codesandbox-api';
1313
import { css } from 'glamor';
@@ -729,7 +729,8 @@ export class ModelsHandler {
729729
}, {});
730730

731731
const initialDecorations: any[] =
732-
currentLineNumber === -1
732+
currentLineNumber === -1 ||
733+
currentLineNumber in commentDecorationsByLineNumber
733734
? []
734735
: [
735736
{

packages/app/src/app/overmind/effects/vscode/icons.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@
3939
color: #242424;
4040
}
4141

42-
.editor-comments-add:before {
43-
content: '+';
44-
font-size: 10px;
45-
font-weight: bold;
46-
top: 0;
47-
left: 8px;
48-
}
49-
5042
.editor-comments-multi-2:before {
5143
content: '2';
5244
top: 0px;
@@ -96,3 +88,11 @@
9688
opacity: 1;
9789
background-image: url('data:image/svg+xml,%3Csvg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M0 5C0 7.76142 2.23858 10 5 10C7.76142 10 10 7.76142 10 5C10 2.23858 7.76142 0 5 0C2.23858 0 0 2.23858 0 5Z" fill="%230971F1"/%3E%3Cpath d="M5 5H0V10H5V5Z" fill="%230971F1"/%3E%3C/svg%3E%0A');
9890
}
91+
92+
.editor-comments-add:before {
93+
content: '+';
94+
font-size: 10px;
95+
font-weight: bold;
96+
top: 0;
97+
left: 8px;
98+
}

packages/app/src/app/pages/Sandbox/Editor/Workspace/index.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { NotOwnedSandboxInfo } from './items/NotOwnedSandboxInfo';
3030
import { ProjectInfo } from './items/ProjectInfo';
3131
import { Server } from './items/Server';
3232
import { Comments } from './screens/Comments';
33+
import { MultiComment } from './screens/Comments/components/MultiComment';
34+
import { CommentDialog } from './screens/Comments/Dialog';
3335
import { ConfigurationFiles as ConfigurationFilesNew } from './screens/ConfigurationFiles';
3436
import { Deployment as DeploymentNew } from './screens/Deployment/index';
3537
import { Explorer } from './screens/Explorer';
@@ -112,6 +114,11 @@ export const WorkspaceComponent = ({ theme }) => {
112114
{NEW_SIDEBAR &&
113115
!(isPatron || (currentSandbox && currentSandbox.owned)) &&
114116
!(isLive && roomInfo.chatEnabled) && <Advertisement />}
117+
118+
{state.comments.currentCommentId && <CommentDialog />}
119+
{state.comments.multiCommentsSelector && (
120+
<MultiComment {...state.comments.multiCommentsSelector} />
121+
)}
115122
</>
116123
</WorkspaceWrapper>
117124

packages/app/src/app/pages/Sandbox/Editor/Workspace/screens/Comments/index.tsx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CommentsFilterOption } from '@codesandbox/common/lib/types';
2-
32
import {
43
Icon,
54
List,
@@ -14,17 +13,13 @@ import React from 'react';
1413

1514
import { AddComment } from './AddComment';
1615
import { Comment } from './Comment';
17-
import { CommentDialog } from './Dialog';
18-
import { MultiComment } from './components/MultiComment';
1916

2017
export const Comments: React.FC = () => {
2118
const {
2219
state: {
2320
comments: {
2421
selectedCommentsFilter,
2522
currentComments,
26-
currentCommentId,
27-
multiCommentsSelector,
2823
currentCommentsByDate,
2924
},
3025
},
@@ -139,8 +134,6 @@ export const Comments: React.FC = () => {
139134
</div>
140135
{currentComments.length ? null : <Empty />}
141136
<AddComment />
142-
{currentCommentId && <CommentDialog />}
143-
{multiCommentsSelector && <MultiComment {...multiCommentsSelector} />}
144137
</Stack>
145138
);
146139
};

0 commit comments

Comments
 (0)