Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianyazhichiC
algorithm-visualizer
提交
48ae5636
A
algorithm-visualizer
项目概览
tianyazhichiC
/
algorithm-visualizer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
algorithm-visualizer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
48ae5636
编写于
7月 19, 2018
作者:
J
Jason Park
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Put "(Unsaved)" in front of title if not saved
上级
6e810e6b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
12 deletion
+14
-12
src/frontend/components/App/index.jsx
src/frontend/components/App/index.jsx
+12
-2
src/frontend/components/Header/index.jsx
src/frontend/components/Header/index.jsx
+2
-10
未找到文件。
src/frontend/components/App/index.jsx
浏览文件 @
48ae5636
...
...
@@ -210,10 +210,20 @@ class App extends React.Component {
this
.
setState
({
navigatorOpened
});
}
isGistSaved
()
{
const
{
titles
,
files
,
lastTitles
,
lastFiles
}
=
this
.
props
.
current
;
const
serializeTitles
=
titles
=>
JSON
.
stringify
(
titles
);
const
serializeFiles
=
files
=>
JSON
.
stringify
(
files
.
map
(({
name
,
content
})
=>
({
name
,
content
})));
return
serializeTitles
(
titles
)
===
serializeTitles
(
lastTitles
)
&&
serializeFiles
(
files
)
===
serializeFiles
(
lastFiles
);
}
render
()
{
const
{
navigatorOpened
,
workspaceWeights
,
viewerTabIndex
,
editorTabIndex
}
=
this
.
state
;
const
{
titles
,
files
}
=
this
.
props
.
current
;
const
gistSaved
=
this
.
isGistSaved
();
const
readmeFile
=
files
.
find
(
file
=>
file
.
name
===
'
README.md
'
)
||
{
name
:
'
README.md
'
,
content
:
`#
${
titles
[
1
]}
\nREADME.md not found`
,
...
...
@@ -236,13 +246,13 @@ class App extends React.Component {
return
(
<
div
className
=
{
styles
.
app
}
>
<
Helmet
>
<
title
>
{
titles
.
join
(
'
-
'
)
}
</
title
>
<
title
>
{
gistSaved
?
''
:
'
(Unsaved)
'
}{
titles
.
join
(
'
-
'
)
}
</
title
>
<
meta
name
=
"description"
content
=
{
description
}
/>
</
Helmet
>
<
Header
className
=
{
styles
.
header
}
onClickTitleBar
=
{
()
=>
this
.
toggleNavigatorOpened
()
}
navigatorOpened
=
{
navigatorOpened
}
loadScratchPapers
=
{
()
=>
this
.
loadScratchPapers
()
}
loadAlgorithm
=
{
params
=>
this
.
loadAlgorithm
(
params
)
}
onAction
=
{
()
=>
this
.
handleChangeViewerTabIndex
(
1
)
}
/>
onAction
=
{
()
=>
this
.
handleChangeViewerTabIndex
(
1
)
}
gistSaved
=
{
gistSaved
}
/>
<
ResizableContainer
className
=
{
styles
.
workspace
}
horizontal
weights
=
{
workspaceWeights
}
visibles
=
{
[
navigatorOpened
,
true
,
true
]
}
onChangeWeights
=
{
weights
=>
this
.
handleChangeWorkspaceWeights
(
weights
)
}
>
...
...
src/frontend/components/Header/index.jsx
浏览文件 @
48ae5636
...
...
@@ -97,17 +97,9 @@ class Header extends React.Component {
.
catch
(
this
.
props
.
showErrorToast
);
}
isGistSaved
()
{
const
{
titles
,
files
,
lastTitles
,
lastFiles
}
=
this
.
props
.
current
;
const
serializeTitles
=
titles
=>
JSON
.
stringify
(
titles
);
const
serializeFiles
=
files
=>
JSON
.
stringify
(
files
.
map
(({
name
,
content
})
=>
({
name
,
content
})));
return
serializeTitles
(
titles
)
===
serializeTitles
(
lastTitles
)
&&
serializeFiles
(
files
)
===
serializeFiles
(
lastFiles
);
}
render
()
{
const
{
interval
,
paused
,
started
}
=
this
.
state
;
const
{
className
,
onClickTitleBar
,
navigatorOpened
,
onAction
}
=
this
.
props
;
const
{
className
,
onClickTitleBar
,
navigatorOpened
,
onAction
,
gistSaved
}
=
this
.
props
;
const
{
gistId
,
titles
}
=
this
.
props
.
current
;
const
{
ext
,
user
}
=
this
.
props
.
env
;
...
...
@@ -131,7 +123,7 @@ class Header extends React.Component {
</
Button
>
</
div
>
<
div
className
=
{
styles
.
section
}
>
<
Button
icon
=
{
faSave
}
primary
disabled
=
{
!
gistId
||
this
.
isGistSaved
()
}
<
Button
icon
=
{
faSave
}
primary
disabled
=
{
!
gistId
||
gistSaved
}
onClick
=
{
()
=>
this
.
saveGist
()
}
>
Save
</
Button
>
<
Button
icon
=
{
faTrashAlt
}
primary
disabled
=
{
!
gistId
}
onClick
=
{
()
=>
this
.
deleteGist
()
}
confirmNeeded
>
Delete
</
Button
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录