Skip to content

Commit 9e4bf4b

Browse files
authored
Merge pull request #315 from connect-foundation/cocode
Cocode 1.3.1 hotfix!
2 parents b35b0d1 + 171c695 commit 9e4bf4b

File tree

23 files changed

+278
-212
lines changed

23 files changed

+278
-212
lines changed

cocode/src/actions/Project.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
UPDATE_CODE,
44
UPDATE_CODE_FROM_FILE_ID,
55
FETCH_PROJECT,
6+
UPDATE_FILES,
67
SELECT_FILE,
78
UPDATE_FILE_NAME,
89
CREATE_FILE,
@@ -21,6 +22,10 @@ function fetchProjectActionCreator(payload) {
2122
return { type: FETCH_PROJECT, payload };
2223
}
2324

25+
function updateFilesActionCreator(payload) {
26+
return { type: UPDATE_FILES, payload };
27+
}
28+
2429
function updateCodeActionCreator(payload) {
2530
return { type: UPDATE_CODE, payload };
2631
}
@@ -65,6 +70,7 @@ export {
6570
updateCodeActionCreator,
6671
updateCodeFromFileIdActionCreator,
6772
fetchProjectActionCreator,
73+
updateFilesActionCreator,
6874
selectFileActionCreator,
6975
updateFileNameActionCreator,
7076
createFileActionCreator,

cocode/src/actions/types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const UPDATE_PROJECT_INFO = 'updateProjectInfo';
99
const UPDATE_CODE = 'updateCode';
1010
const UPDATE_CODE_FROM_FILE_ID = 'updateCodeFromFileId';
1111
const FETCH_PROJECT = 'fetchProject';
12+
const UPDATE_FILES = 'updateFiles';
1213
const SELECT_FILE = 'selectFile';
1314
const CREATE_FILE = 'createFile';
1415
const UPDATE_FILE_NAME = 'updateFileName';
@@ -38,6 +39,7 @@ export {
3839
UPDATE_CODE,
3940
UPDATE_CODE_FROM_FILE_ID,
4041
FETCH_PROJECT,
42+
UPDATE_FILES,
4143
SELECT_FILE,
4244
UPDATE_FILE_NAME,
4345
CREATE_FILE,

cocode/src/components/Common/GlobalStyle/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ const GlobalStyle = createGlobalStyle`
8181
div, span{
8282
user-select: none;
8383
}
84+
85+
.blink{
86+
animation: blink 1s step-start 0s infinite;
87+
}
88+
89+
@keyframes blink {
90+
50% { opacity: 0.0; }
91+
}
8492
`;
8593

8694
export default GlobalStyle;
-2.56 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Loading

cocode/src/components/Common/UserProfile/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import React from 'react';
22
import * as Styled from './style';
3+
34
import DropDownMenu from 'components/Common/DropDownMenu';
5+
import down from './down.svg';
46

57
function UserProfile({ username, avatar, menuItems }) {
68
return (
79
<Styled.UserProfile>
810
<Styled.UserName>{username}</Styled.UserName>
11+
<Styled.UserAvatar src={avatar} alt="프로필" />
912
<DropDownMenu menuItems={menuItems}>
10-
<Styled.UserAvatar src={avatar} alt="프로필" />
13+
<Styled.DownArrow src={down} />
1114
</DropDownMenu>
1215
</Styled.UserProfile>
1316
);

cocode/src/components/Common/UserProfile/style.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,21 @@ const UserAvatar = styled.img`
2020
width: 3rem;
2121
height: 3rem;
2222
border-radius: 0.5rem;
23-
cursor: pointer;
2423
}
2524
`;
2625

27-
export { UserProfile, UserName, UserAvatar };
26+
const DownArrow = styled.img`
27+
& {
28+
width: 1rem;
29+
height: 1rem;
30+
margin: auto 0 auto 1rem;
31+
cursor: pointer;
32+
filter: invert(0.3);
33+
}
34+
35+
&:hover {
36+
filter: invert(0);
37+
}
38+
`;
39+
40+
export { UserProfile, UserName, UserAvatar, DownArrow };

cocode/src/components/Project/BrowserV2/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import React, {
88
import { useParams } from 'react-router-dom';
99
import * as Styled from './style';
1010

11+
import open from './open.svg';
1112
import search from './search.svg';
1213
import addToast from 'components/Common/Toast';
1314

@@ -30,6 +31,7 @@ import { KEY_CODE_ENTER } from 'constants/keyCode';
3031
const MIN_WAIT_TIME = 1500;
3132
const UPDATE_PROJECT = 'updateProject';
3233
const PROTOCOLS = ['http://', 'https://'];
34+
const NEW_COCONUT = `${COCONUT_SERVER}/new`;
3335

3436
function BrowserV2({ ...props }) {
3537
const { projectId } = useParams();
@@ -137,6 +139,13 @@ function BrowserV2({ ...props }) {
137139
iframeReference.current.contentWindow.postMessage(data, '*');
138140
}, [project]);
139141

142+
const handleClickOpenTab = () => {
143+
const coconutUrl = addressReference.current.value;
144+
if (NEW_COCONUT === coconutUrl)
145+
return addToast.error(NOTIFICATION.NEED_TO_SAVE);
146+
window.open(coconutUrl, '_blank');
147+
};
148+
140149
useEffect(handleChangeCurrentURL, [projectId]);
141150
useEffect(handleUpdateDependency, [dependencyInstalling]);
142151
useEffect(handleUpdateFile, [files]);
@@ -154,6 +163,12 @@ function BrowserV2({ ...props }) {
154163
defaultValue={addressInputURL}
155164
onKeyUp={handleAddressInputKeyDown}
156165
/>
166+
<Styled.OpenIcon
167+
src={open}
168+
alt="Open New Tab"
169+
title="Open New Tab"
170+
onClick={handleClickOpenTab}
171+
/>
157172
</Styled.AddressContainer>
158173
<Styled.BrowserV2
159174
ref={iframeReference}
Lines changed: 4 additions & 0 deletions
Loading

cocode/src/components/Project/BrowserV2/style.js

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,6 @@ const BrowserV2 = styled.iframe`
1515
}
1616
`;
1717

18-
const LoadingOverlay = styled.section`
19-
& {
20-
position: fixed;
21-
top: 12vh;
22-
left: 0;
23-
z-index: 100;
24-
25-
height: 100vh;
26-
width: 100vw;
27-
28-
display: flex;
29-
flex-direction: column;
30-
justify-content: center;
31-
align-items: center;
32-
33-
background-color: ${BROWSER_THEME.loadingOverlayBGColor};
34-
35-
p {
36-
margin-top: 2rem;
37-
font-size: 3rem;
38-
font-weight: lighter;
39-
}
40-
}
41-
`;
42-
4318
const AddressContainer = styled.div`
4419
& {
4520
display: flex;
@@ -70,11 +45,20 @@ const SearchIcon = styled.img`
7045
}
7146
`;
7247

48+
const OpenIcon = styled.img`
49+
& {
50+
height: 100%;
51+
padding: 0.4rem 0;
52+
background: ${BROWSER_THEME.addressInputBGColor};
53+
cursor: pointer;
54+
}
55+
`;
56+
7357
export {
7458
Frame,
7559
BrowserV2,
76-
LoadingOverlay,
7760
AddressContainer,
7861
AddressInput,
79-
SearchIcon
62+
SearchIcon,
63+
OpenIcon
8064
};

0 commit comments

Comments
 (0)