Skip to content

Commit 214f5d6

Browse files
committed
✨ make unsaved changes dot on project name
1 parent a28a4a5 commit 214f5d6

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

client/components/mobile/Header.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ const HeaderDiv = styled.div`
3535
}
3636
3737
& svg path { fill: ${textColor} !important; }
38+
39+
.editor__unsaved-changes svg {
40+
width: ${remSize(16)};
41+
padding: 0px;
42+
vertical-align: top
43+
}
3844
`;
3945

4046
const IconContainer = styled.div`

client/modules/IDE/pages/MobileIDEView.jsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { getHTMLFile } from '../reducers/files';
2121
// Local Imports
2222
import Editor from '../components/Editor';
2323
import { PlayIcon, MoreIcon } from '../../../common/icons';
24+
import UnsavedChangesDotIcon from '../../../images/unsaved-changes-dot.svg';
2425

2526
import IconButton from '../../../components/mobile/IconButton';
2627
import Header from '../../../components/mobile/Header';
@@ -38,6 +39,16 @@ import Dropdown from '../../../components/Dropdown';
3839
const isUserOwner = ({ project, user }) =>
3940
project.owner && project.owner.id === user.id;
4041

42+
const getTitle = (title, unsavedChanges = false) => (
43+
<span>
44+
{title}
45+
<span className="editor__unsaved-changes">
46+
{unsavedChanges &&
47+
<UnsavedChangesDotIcon role="img" aria-label="Sketch has unsaved changes" focusable="false" />}
48+
</span>
49+
</span>
50+
);
51+
4152
const Expander = styled.div`
4253
height: ${props => (props.expanded ? remSize(160) : remSize(27))};
4354
`;
@@ -65,7 +76,7 @@ const MobileIDEView = (props) => {
6576
const {
6677
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
6778
selectedFile, updateFileContent, files, user, params,
68-
closeEditorOptions, showEditorOptions,
79+
closeEditorOptions, showEditorOptions, unsavedChanges,
6980
startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
7081
showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch, getProject, clearPersistedState
7182
} = props;
@@ -99,7 +110,7 @@ const MobileIDEView = (props) => {
99110
return (
100111
<Screen fullscreen>
101112
<Header
102-
title={project.name}
113+
title={getTitle(project.name, unsavedChanges)}
103114
subtitle={selectedFile.name}
104115
>
105116
<NavItem>
@@ -273,6 +284,8 @@ MobileIDEView.propTypes = {
273284
project_id: PropTypes.string,
274285
username: PropTypes.string
275286
}).isRequired,
287+
288+
unsavedChanges: PropTypes.bool.isRequired
276289
};
277290

278291
function mapStateToProps(state) {

0 commit comments

Comments
 (0)