Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
tianyazhichiC
algorithm-visualizer
提交
26949548
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看板
提交
26949548
编写于
4月 14, 2018
作者:
J
Jason Park
提交者:
Jason
4月 30, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactoring workspace for further use
上级
52963f85
变更
39
隐藏空白更改
内联
并排
Showing
39 changed file
with
570 addition
and
501 deletion
+570
-501
src/frontend/common/stylesheet/dimensions.scss
src/frontend/common/stylesheet/dimensions.scss
+0
-1
src/frontend/common/util.js
src/frontend/common/util.js
+0
-12
src/frontend/components/App/index.jsx
src/frontend/components/App/index.jsx
+30
-40
src/frontend/components/App/stylesheet.scss
src/frontend/components/App/stylesheet.scss
+4
-98
src/frontend/components/BasicSection/index.jsx
src/frontend/components/BasicSection/index.jsx
+18
-0
src/frontend/components/BasicSection/stylesheet.scss
src/frontend/components/BasicSection/stylesheet.scss
+7
-0
src/frontend/components/CodeEditor/index.jsx
src/frontend/components/CodeEditor/index.jsx
+14
-37
src/frontend/components/CodeEditor/stylesheet.scss
src/frontend/components/CodeEditor/stylesheet.scss
+26
-0
src/frontend/components/DescriptionViewer/stylesheet.scss
src/frontend/components/DescriptionViewer/stylesheet.scss
+1
-0
src/frontend/components/Divider/index.jsx
src/frontend/components/Divider/index.jsx
+4
-3
src/frontend/components/Divider/stylesheet.scss
src/frontend/components/Divider/stylesheet.scss
+44
-14
src/frontend/components/EditorSection/stylesheet.scss
src/frontend/components/EditorSection/stylesheet.scss
+0
-61
src/frontend/components/ExpandableListItem/index.jsx
src/frontend/components/ExpandableListItem/index.jsx
+4
-6
src/frontend/components/ExpandableListItem/stylesheet.scss
src/frontend/components/ExpandableListItem/stylesheet.scss
+2
-3
src/frontend/components/ListItem/index.jsx
src/frontend/components/ListItem/index.jsx
+3
-2
src/frontend/components/ListItem/stylesheet.scss
src/frontend/components/ListItem/stylesheet.scss
+4
-0
src/frontend/components/Navigator/index.jsx
src/frontend/components/Navigator/index.jsx
+5
-23
src/frontend/components/Navigator/stylesheet.scss
src/frontend/components/Navigator/stylesheet.scss
+4
-13
src/frontend/components/RendererContainer/stylesheet.scss
src/frontend/components/RendererContainer/stylesheet.scss
+0
-1
src/frontend/components/Section/index.jsx
src/frontend/components/Section/index.jsx
+17
-0
src/frontend/components/Section/stylesheet.scss
src/frontend/components/Section/stylesheet.scss
+10
-0
src/frontend/components/SectionContainer/index.jsx
src/frontend/components/SectionContainer/index.jsx
+18
-0
src/frontend/components/SectionContainer/stylesheet.scss
src/frontend/components/SectionContainer/stylesheet.scss
+7
-0
src/frontend/components/TabBar/index.jsx
src/frontend/components/TabBar/index.jsx
+0
-36
src/frontend/components/TabBar/stylesheet.scss
src/frontend/components/TabBar/stylesheet.scss
+0
-47
src/frontend/components/TabSection/index.jsx
src/frontend/components/TabSection/index.jsx
+51
-0
src/frontend/components/TabSection/stylesheet.scss
src/frontend/components/TabSection/stylesheet.scss
+52
-0
src/frontend/components/ViewerSection/index.jsx
src/frontend/components/ViewerSection/index.jsx
+0
-44
src/frontend/components/ViewerSection/stylesheet.scss
src/frontend/components/ViewerSection/stylesheet.scss
+0
-24
src/frontend/components/WikiViewer/index.jsx
src/frontend/components/WikiViewer/index.jsx
+2
-3
src/frontend/components/WikiViewer/stylesheet.scss
src/frontend/components/WikiViewer/stylesheet.scss
+6
-8
src/frontend/components/index.js
src/frontend/components/index.js
+5
-3
src/frontend/core/Workspace.js
src/frontend/core/Workspace.js
+219
-0
src/frontend/core/index.js
src/frontend/core/index.js
+2
-1
src/frontend/core/renderers/Renderer/index.jsx
src/frontend/core/renderers/Renderer/index.jsx
+2
-1
src/frontend/core/renderers/Renderer/stylesheet.scss
src/frontend/core/renderers/Renderer/stylesheet.scss
+3
-3
src/frontend/index.jsx
src/frontend/index.jsx
+1
-0
src/frontend/reducers/env.js
src/frontend/reducers/env.js
+2
-7
src/frontend/reducers/toast.js
src/frontend/reducers/toast.js
+3
-10
未找到文件。
src/frontend/common/stylesheet/dimensions.scss
浏览文件 @
26949548
$line-height
:
32px
;
$line-height
:
32px
;
$resizeable-min
:
20px
;
$font-size-normal
:
12px
;
$font-size-normal
:
12px
;
$font-size-large
:
14px
;
$font-size-large
:
14px
;
\ No newline at end of file
src/frontend/common/util.js
浏览文件 @
26949548
const
classes
=
(...
arr
)
=>
arr
.
filter
(
v
=>
v
).
join
(
'
'
);
const
classes
=
(...
arr
)
=>
arr
.
filter
(
v
=>
v
).
join
(
'
'
);
const
calculatePercentageWidth
=
(
element
,
x
)
=>
{
const
{
offsetWidth
,
offsetLeft
}
=
element
;
return
((
x
-
offsetLeft
)
/
offsetWidth
*
100
).
toFixed
(
1
)
+
'
%
'
;
};
const
calculatePercentageHeight
=
(
element
,
y
)
=>
{
const
{
offsetHeight
,
offsetTop
}
=
element
;
return
((
y
-
offsetTop
)
/
offsetHeight
*
100
).
toFixed
(
1
)
+
'
%
'
;
};
const
serialize
=
object
=>
JSON
.
parse
(
JSON
.
stringify
(
object
));
const
serialize
=
object
=>
JSON
.
parse
(
JSON
.
stringify
(
object
));
const
distance
=
(
a
,
b
)
=>
{
const
distance
=
(
a
,
b
)
=>
{
...
@@ -20,8 +10,6 @@ const distance = (a, b) => {
...
@@ -20,8 +10,6 @@ const distance = (a, b) => {
export
{
export
{
classes
,
classes
,
calculatePercentageWidth
,
calculatePercentageHeight
,
serialize
,
serialize
,
distance
,
distance
,
};
};
\ No newline at end of file
src/frontend/components/App/index.jsx
浏览文件 @
26949548
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
loadProgressBar
}
from
'
axios-progress-bar
'
import
{
loadProgressBar
}
from
'
axios-progress-bar
'
import
{
Divider
,
EditorSection
,
Header
,
Navigator
,
ToastContainer
,
ViewerSection
}
from
'
/components
'
;
import
{
CodeEditor
,
DescriptionViewer
,
Header
,
Navigator
,
RendererContainer
,
ToastContainer
,
WikiViewer
}
from
'
/components
'
;
import
{
actions
as
toastActions
}
from
'
/reducers/toast
'
;
import
{
actions
as
toastActions
}
from
'
/reducers/toast
'
;
import
{
actions
as
envActions
}
from
'
/reducers/env
'
;
import
{
actions
as
envActions
}
from
'
/reducers/env
'
;
import
{
calculatePercentageWidth
}
from
'
/common/util
'
;
import
{
DirectoryApi
}
from
'
/apis
'
;
import
{
DirectoryApi
}
from
'
/apis
'
;
import
{
tracerManager
}
from
'
/core
'
;
import
{
tracerManager
,
Workspace
}
from
'
/core
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
'
axios-progress-bar/dist/nprogress.css
'
import
'
axios-progress-bar/dist/nprogress.css
'
...
@@ -25,11 +32,14 @@ class App extends React.Component {
...
@@ -25,11 +32,14 @@ class App extends React.Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
this
.
state
=
{
this
.
workspace
=
new
Workspace
();
navigatorOpened
:
true
,
this
.
navigator
=
this
.
workspace
.
addBasicSection
(
Navigator
,
2
);
navigatorWidth
:
'
16%
'
,
const
leftTabSection
=
this
.
workspace
.
addTabSection
(
5
);
viewerSectionWidth
:
'
50%
'
,
leftTabSection
.
addTab
(
'
Visualization
'
,
RendererContainer
);
}
leftTabSection
.
addTab
(
'
Description
'
,
DescriptionViewer
);
leftTabSection
.
addTab
(
'
Tracer API
'
,
WikiViewer
);
const
rightTabSection
=
this
.
workspace
.
addTabSection
(
5
);
rightTabSection
.
addTab
(
'
code.js
'
,
CodeEditor
);
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -45,6 +55,12 @@ class App extends React.Component {
...
@@ -45,6 +55,12 @@ class App extends React.Component {
});
});
tracerManager
.
setOnError
(
error
=>
this
.
props
.
showErrorToast
(
error
.
message
));
tracerManager
.
setOnError
(
error
=>
this
.
props
.
showErrorToast
(
error
.
message
));
this
.
workspace
.
setOnChange
(()
=>
this
.
forceUpdate
());
}
componentWillUnmount
()
{
tracerManager
.
setOnError
(
null
);
this
.
workspace
.
setOnChange
(
null
);
}
}
componentWillReceiveProps
(
nextProps
)
{
componentWillReceiveProps
(
nextProps
)
{
...
@@ -53,47 +69,21 @@ class App extends React.Component {
...
@@ -53,47 +69,21 @@ class App extends React.Component {
}
}
}
}
componentWillUnmount
()
{
tracerManager
.
setOnError
(
null
);
}
updateDirectory
({
categoryKey
=
null
,
algorithmKey
=
null
})
{
updateDirectory
({
categoryKey
=
null
,
algorithmKey
=
null
})
{
this
.
props
.
setDirectory
(
categoryKey
,
algorithmKey
);
this
.
props
.
setDirectory
(
categoryKey
,
algorithmKey
);
}
}
toggleNavigator
(
navigatorOpened
=
!
this
.
state
.
navigatorOpened
)
{
this
.
setState
({
navigatorOpened
});
}
handleResizeNavigator
(
x
,
y
)
{
const
navigatorWidth
=
calculatePercentageWidth
(
this
.
elMain
,
x
);
this
.
setState
({
navigatorWidth
});
}
handleResizeViewerSection
(
x
,
y
)
{
const
viewerSectionWidth
=
calculatePercentageWidth
(
this
.
elWorkspace
,
x
);
this
.
setState
({
viewerSectionWidth
});
}
render
()
{
render
()
{
const
{
navigatorOpened
,
navigatorWidth
,
viewerSectionWidth
}
=
this
.
state
;
const
{
categories
,
categoryKey
,
algorithmKey
}
=
this
.
props
.
env
;
const
{
categories
,
categoryKey
,
algorithmKey
}
=
this
.
props
.
env
;
const
navigatorOpened
=
this
.
navigator
.
isVisible
();
return
categories
&&
categoryKey
&&
algorithmKey
&&
(
return
categories
&&
categoryKey
&&
algorithmKey
&&
(
<
div
className
=
{
styles
.
app
}
>
<
div
className
=
{
styles
.
app
}
>
<
Header
onClickTitleBar
=
{
()
=>
this
.
toggleNavigator
()
}
navigatorOpened
=
{
navigatorOpened
}
/>
<
Header
onClickTitleBar
=
{
()
=>
this
.
navigator
.
setVisible
(
!
navigatorOpened
)
}
navigatorOpened
=
{
navigatorOpened
}
/>
<
main
className
=
{
styles
.
main
}
ref
=
{
ref
=>
this
.
elMain
=
ref
}
>
{
{
this
.
workspace
.
render
({
className
:
styles
.
workspace
})
navigatorOpened
&&
}
<
Navigator
className
=
{
styles
.
navigator
}
style
=
{
{
width
:
navigatorWidth
}
}
/>
}
<
Divider
vertical
onResize
=
{
(
x
,
y
)
=>
this
.
handleResizeNavigator
(
x
,
y
)
}
/>
<
div
className
=
{
styles
.
workspace
}
ref
=
{
ref
=>
this
.
elWorkspace
=
ref
}
>
<
ViewerSection
className
=
{
styles
.
viewer_section
}
style
=
{
{
width
:
viewerSectionWidth
}
}
/>
<
Divider
vertical
onResize
=
{
(
x
,
y
)
=>
this
.
handleResizeViewerSection
(
x
,
y
)
}
/>
<
EditorSection
className
=
{
styles
.
editor_section
}
/>
</
div
>
</
main
>
<
ToastContainer
className
=
{
styles
.
toast_container
}
/>
<
ToastContainer
className
=
{
styles
.
toast_container
}
/>
</
div
>
</
div
>
);
);
...
...
src/frontend/components/App/stylesheet.scss
浏览文件 @
26949548
...
@@ -37,41 +37,10 @@ input {
...
@@ -37,41 +37,10 @@ input {
align-items
:
stretch
;
align-items
:
stretch
;
height
:
100%
;
height
:
100%
;
.loading_slider
{
.workspace
{
position
:
absolute
;
top
:
0
;
left
:
0
;
right
:
0
;
}
.main
{
flex
:
1
;
flex
:
1
;
display
:
flex
;
background-color
:
$theme-dark
;
align-items
:
stretch
;
border-top
:
1px
solid
$theme-light
;
.navigator
{
min-width
:
$resizeable-min
;
}
.workspace
{
flex
:
1
;
display
:
flex
;
align-items
:
stretch
;
background-color
:
$theme-dark
;
min-width
:
$resizeable-min
*
2
;
.viewer_section
{
border
:
1px
solid
$theme-light
;
min-width
:
$resizeable-min
;
}
.editor_section
{
flex
:
1
;
margin-left
:
-1px
;
border
:
1px
solid
$theme-light
;
min-width
:
$resizeable-min
;
}
}
}
}
.toast_container
{
.toast_container
{
...
@@ -80,67 +49,4 @@ input {
...
@@ -80,67 +49,4 @@ input {
right
:
0
;
right
:
0
;
z-index
:
99
;
z-index
:
99
;
}
}
}
}
\ No newline at end of file
//----!!!
.fa-spin-faster
{
animation
:
fa-spin
1s
infinite
ease-in-out
;
}
.mchrt-chart
{
width
:
100%
;
height
:
100%
;
}
//------???
.buttonContainer
{
width
:
75px
;
height
:
25px
;
display
:
block
;
position
:
relative
;
z-index
:
100
;
background-color
:
white
;
}
.inputField
{
width
:
25px
;
border
:
0
;
}
.sb-button
{
border
:
1px
solid
$theme-light
;
height
:
25px
;
margin
:
0
auto
;
}
.auto-gen
{
top
:
30px
;
height
:
100%
;
width
:
100%
;
text-align
:
center
;
background-color
:
$theme-dark
;
align-items
:
center
;
}
.inputs
{
display
:
inline-block
;
border
:
0
;
background-color
:
$theme-light
;
height
:
25px
;
width
:
75px
;
}
.grid
{
width
:
50%
;
height
:
50%
;
float
:
left
;
-webkit-box-sizing
:
border-box
;
-moz-box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
.fields
{
margin-top
:
5px
;
margin-bottom
:
5px
;
}
src/frontend/components/BasicSection/index.jsx
0 → 100644
浏览文件 @
26949548
import
React
from
'
react
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
Section
}
from
'
/components
'
;
import
styles
from
'
./stylesheet.scss
'
;
class
BasicSection
extends
React
.
Component
{
render
()
{
const
{
className
,
Component
,
style
,
relativeWeight
}
=
this
.
props
;
return
(
<
Section
className
=
{
classes
(
styles
.
basic_section
,
className
)
}
style
=
{
style
}
>
<
Component
className
=
{
styles
.
component
}
relativeWeight
=
{
relativeWeight
}
/>
</
Section
>
);
}
}
export
default
BasicSection
;
src/frontend/components/BasicSection/stylesheet.scss
0 → 100644
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
.basic_section
{
.component
{
flex
:
1
;
}
}
\ No newline at end of file
src/frontend/components/
EditorSection
/index.jsx
→
src/frontend/components/
CodeEditor
/index.jsx
浏览文件 @
26949548
...
@@ -3,13 +3,10 @@ import { connect } from 'react-redux';
...
@@ -3,13 +3,10 @@ import { connect } from 'react-redux';
import
AceEditor
from
'
react-ace
'
;
import
AceEditor
from
'
react-ace
'
;
import
'
brace/mode/javascript
'
;
import
'
brace/mode/javascript
'
;
import
'
brace/theme/tomorrow_night_eighties
'
;
import
'
brace/theme/tomorrow_night_eighties
'
;
import
FontAwesomeIcon
from
'
@fortawesome/react-fontawesome
'
import
faInfoCircle
from
'
@fortawesome/fontawesome-free-solid/faInfoCircle
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
Ellipsis
,
TabBar
}
from
'
/components
'
;
import
{
actions
as
envActions
}
from
'
/reducers/env
'
;
import
{
actions
as
envActions
}
from
'
/reducers/env
'
;
import
{
tracerManager
}
from
'
/core
'
;
import
{
tracerManager
}
from
'
/core
'
;
import
{
DirectoryApi
}
from
'
/apis
'
;
import
{
DirectoryApi
}
from
'
/apis
'
;
import
{
classes
}
from
'
/common/util
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
@
connect
(
@
connect
(
...
@@ -19,7 +16,7 @@ import styles from './stylesheet.scss';
...
@@ -19,7 +16,7 @@ import styles from './stylesheet.scss';
...
envActions
,
...
envActions
,
}
}
)
)
class
EditorSection
extends
React
.
Component
{
class
CodeEditor
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
);
super
(
props
);
...
@@ -79,42 +76,22 @@ class EditorSection extends React.Component {
...
@@ -79,42 +76,22 @@ class EditorSection extends React.Component {
render
()
{
render
()
{
const
{
lineMarker
,
code
}
=
this
.
state
;
const
{
lineMarker
,
code
}
=
this
.
state
;
const
{
className
}
=
this
.
props
;
const
{
className
,
relativeWeight
}
=
this
.
props
;
const
{
categories
,
categoryKey
,
algorithmKey
}
=
this
.
props
.
env
;
const
category
=
categories
.
find
(
category
=>
category
.
key
===
categoryKey
);
const
algorithm
=
category
.
algorithms
.
find
(
algorithm
=>
algorithm
.
key
===
algorithmKey
);
const
tabs
=
[
'
code.js
'
].
map
(
fileName
=>
({
title
:
fileName
,
props
:
{
to
:
`/
${
category
.
key
}
/
${
algorithm
.
key
}
`
},
}));
const
tabIndex
=
0
;
// TODO
const
fileInfo
=
''
;
// TODO
return
(
return
(
<
section
className
=
{
classes
(
styles
.
editor_section
,
className
)
}
>
<
AceEditor
<
TabBar
tabs
=
{
tabs
}
tabIndex
=
{
tabIndex
}
/>
className
=
{
classes
(
styles
.
code_editor
,
className
)
}
<
div
className
=
{
styles
.
info_container
}
>
mode
=
"javascript"
<
FontAwesomeIcon
fixedWidth
icon
=
{
faInfoCircle
}
className
=
{
styles
.
info_icon
}
/>
theme
=
"tomorrow_night_eighties"
<
Ellipsis
className
=
{
styles
.
info_text
}
>
{
fileInfo
}
</
Ellipsis
>
name
=
"code_editor"
</
div
>
editorProps
=
{
{
$blockScrolling
:
true
}
}
<
div
className
=
{
styles
.
content
}
>
onChange
=
{
value
=>
this
.
handleChangeCode
(
value
)
}
<
AceEditor
markers
=
{
lineMarker
?
[
lineMarker
]
:
[]
}
className
=
{
styles
.
editor
}
value
=
{
code
}
mode
=
"javascript"
width
=
{
relativeWeight
}
/>
// trick to update on resize
theme
=
"tomorrow_night_eighties"
name
=
"code_editor"
editorProps
=
{
{
$blockScrolling
:
true
}
}
onChange
=
{
value
=>
this
.
handleChangeCode
(
value
)
}
markers
=
{
lineMarker
?
[
lineMarker
]
:
[]
}
value
=
{
code
}
/>
</
div
>
</
section
>
);
);
}
}
}
}
export
default
EditorSection
;
export
default
CodeEditor
;
src/frontend/components/CodeEditor/stylesheet.scss
0 → 100644
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
.code_editor
{
width
:
100%
!
important
;
height
:
100%
!
important
;
min-width
:
0
!
important
;
min-height
:
0
!
important
;
.current_line_marker
{
background
:
rgba
(
#29d
,
0
.4
);
border
:
1px
solid
#29d
;
position
:
absolute
;
width
:
100%
!
important
;
animation
:
line_highlight
.1s
;
}
@keyframes
line_highlight
{
from
{
background
:
rgba
(
#29d
,
0
.1
);
}
to
{
background
:
rgba
(
#29d
,
0
.4
);
}
}
}
\ No newline at end of file
src/frontend/components/DescriptionViewer/stylesheet.scss
浏览文件 @
26949548
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
align-items
:
stretch
;
align-items
:
stretch
;
padding
:
16px
;
padding
:
16px
;
font-size
:
$font-size-large
;
font-size
:
$font-size-large
;
overflow-y
:
scroll
;
li
{
li
{
margin
:
10px
0px
;
margin
:
10px
0px
;
...
...
src/frontend/components/Divider/index.jsx
浏览文件 @
26949548
...
@@ -12,13 +12,14 @@ class Divider extends React.Component {
...
@@ -12,13 +12,14 @@ class Divider extends React.Component {
}
}
handleMouseDown
(
e
)
{
handleMouseDown
(
e
)
{
this
.
target
=
e
.
target
;
document
.
addEventListener
(
'
mousemove
'
,
this
.
handleMouseMove
);
document
.
addEventListener
(
'
mousemove
'
,
this
.
handleMouseMove
);
document
.
addEventListener
(
'
mouseup
'
,
this
.
handleMouseUp
);
document
.
addEventListener
(
'
mouseup
'
,
this
.
handleMouseUp
);
}
}
handleMouseMove
(
e
)
{
handleMouseMove
(
e
)
{
const
{
onResize
}
=
this
.
props
;
const
{
onResize
}
=
this
.
props
;
onResize
(
e
.
clientX
,
e
.
clientY
);
onResize
(
this
.
target
,
e
.
clientX
,
e
.
clientY
);
}
}
handleMouseUp
(
e
)
{
handleMouseUp
(
e
)
{
...
@@ -27,11 +28,11 @@ class Divider extends React.Component {
...
@@ -27,11 +28,11 @@ class Divider extends React.Component {
}
}
render
()
{
render
()
{
const
{
className
,
vertical
,
horizontal
}
=
this
.
props
;
const
{
className
,
horizontal
}
=
this
.
props
;
return
(
return
(
<
div
<
div
className
=
{
classes
(
styles
.
divider
,
vertical
&&
styles
.
vertical
,
horizontal
&&
styles
.
horizont
al
,
className
)
}
className
=
{
classes
(
styles
.
divider
,
horizontal
?
styles
.
horizontal
:
styles
.
vertic
al
,
className
)
}
onMouseDown
=
{
this
.
handleMouseDown
}
/>
onMouseDown
=
{
this
.
handleMouseDown
}
/>
);
);
}
}
...
...
src/frontend/components/Divider/stylesheet.scss
浏览文件 @
26949548
...
@@ -4,23 +4,53 @@
...
@@ -4,23 +4,53 @@
position
:
relative
;
position
:
relative
;
z-index
:
99
;
z-index
:
99
;
&
.vertical
:after
{
&
:before
{
position
:
absolute
;
background-color
:
$theme-light
;
content
:
''
;
top
:
0
;
bottom
:
0
;
left
:
-3px
;
width
:
6px
;
cursor
:
ew-resize
;
}
}
&
.horizontal
:after
{
&
:before
,
&
:after
{
position
:
absolute
;
position
:
absolute
;
content
:
''
;
content
:
''
;
left
:
0
;
}
right
:
0
;
top
:
-3px
;
&
.horizontal
{
height
:
6px
;
&
:before
,
cursor
:
ns-resize
;
&
:after
{
top
:
0
;
bottom
:
0
;
}
&
:before
{
width
:
1px
;
}
&
:after
{
left
:
-3px
;
width
:
6px
;
cursor
:
ew-resize
;
}
}
&
.vertical
{
&
:before
,
&
:after
{
left
:
0
;
right
:
0
;
}
&
:before
{
height
:
1px
;
}
&
:after
{
top
:
-3px
;
height
:
6px
;
cursor
:
ns-resize
;
}
}
&
:last-child
{
display
:
none
;
}
}
}
}
\ No newline at end of file
src/frontend/components/EditorSection/stylesheet.scss
已删除
100644 → 0
浏览文件 @
52963f85
@import
"~/common/stylesheet/index"
;
.editor_section
{
display
:
flex
;
flex-direction
:
column
;
.info_container
{
display
:
flex
;
align-items
:
center
;
padding
:
8px
;
&
:hover
{
position
:
relative
;
z-index
:
99
;
height
:
auto
;
bottom
:
auto
;
box-shadow
:
0
8px
8px
-8px
$color-shadow
;
.info_text
{
white-space
:
normal
;
}
}
.info_icon
{
margin-right
:
8px
;
}
.info_text
{
display
:
block
;
}
}
.content
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
.editor
{
width
:
100%
!
important
;
height
:
100%
!
important
;
.current_line_marker
{
background
:
rgba
(
#29d
,
0
.4
);
border
:
1px
solid
#29d
;
position
:
absolute
;
width
:
100%
!
important
;
animation
:
line_highlight
.1s
;
}
@keyframes
line_highlight
{
from
{
background
:
rgba
(
#29d
,
0
.1
);
}
to
{
background
:
rgba
(
#29d
,
0
.4
);
}
}
}
}
}
\ No newline at end of file
src/frontend/components/ExpandableListItem/index.jsx
浏览文件 @
26949548
...
@@ -3,25 +3,23 @@ import FontAwesomeIcon from '@fortawesome/react-fontawesome'
...
@@ -3,25 +3,23 @@ import FontAwesomeIcon from '@fortawesome/react-fontawesome'
import
faCaretDown
from
'
@fortawesome/fontawesome-free-solid/faCaretDown
'
;
import
faCaretDown
from
'
@fortawesome/fontawesome-free-solid/faCaretDown
'
;
import
faCaretRight
from
'
@fortawesome/fontawesome-free-solid/faCaretRight
'
;
import
faCaretRight
from
'
@fortawesome/fontawesome-free-solid/faCaretRight
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
{
Ellipsis
,
ListItem
}
from
'
/components
'
;
import
{
ListItem
}
from
'
/components
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
classes
}
from
'
/common/util
'
;
class
ExpandableListItem
extends
React
.
Component
{
class
ExpandableListItem
extends
React
.
Component
{
render
()
{
render
()
{
const
{
className
,
children
,
label
,
opened
,
...
props
}
=
this
.
props
;
const
{
className
,
children
,
opened
,
...
props
}
=
this
.
props
;
return
opened
?
(
return
opened
?
(
<
div
className
=
{
classes
(
styles
.
expandable_list_item
,
className
)
}
>
<
div
className
=
{
classes
(
styles
.
expandable_list_item
,
className
)
}
>
<
ListItem
className
=
{
styles
.
category
}
{
...
props
}
>
<
ListItem
className
=
{
styles
.
category
}
{
...
props
}
>
<
Ellipsis
className
=
{
styles
.
label
}
>
{
label
}
</
Ellipsis
>
<
FontAwesomeIcon
className
=
{
styles
.
icon
}
fixedWidth
icon
=
{
faCaretDown
}
/>
<
FontAwesomeIcon
fixedWidth
icon
=
{
faCaretDown
}
/>
</
ListItem
>
</
ListItem
>
{
children
}
{
children
}
</
div
>
</
div
>
)
:
(
)
:
(
<
ListItem
className
=
{
classes
(
styles
.
category
,
className
)
}
{
...
props
}
>
<
ListItem
className
=
{
classes
(
styles
.
category
,
className
)
}
{
...
props
}
>
<
Ellipsis
className
=
{
styles
.
label
}
>
{
label
}
</
Ellipsis
>
<
FontAwesomeIcon
className
=
{
styles
.
icon
}
fixedWidth
icon
=
{
faCaretRight
}
/>
<
FontAwesomeIcon
fixedWidth
icon
=
{
faCaretRight
}
/>
</
ListItem
>
</
ListItem
>
);
);
}
}
...
...
src/frontend/components/ExpandableListItem/stylesheet.scss
浏览文件 @
26949548
...
@@ -3,9 +3,8 @@
...
@@ -3,9 +3,8 @@
.category
{
.category
{
justify-content
:
space-between
;
justify-content
:
space-between
;
.label
{
.icon
{
flex
:
1
;
margin-left
:
4px
;
margin-right
:
4px
;
}
}
}
}
...
...
src/frontend/components/ListItem/index.jsx
浏览文件 @
26949548
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
Button
}
from
'
/components
'
;
import
{
Button
,
Ellipsis
}
from
'
/components
'
;
class
ListItem
extends
React
.
Component
{
class
ListItem
extends
React
.
Component
{
render
()
{
render
()
{
const
{
className
,
children
,
indent
,
...
props
}
=
this
.
props
;
const
{
className
,
children
,
indent
,
label
,
...
props
}
=
this
.
props
;
return
(
return
(
<
Button
className
=
{
classes
(
styles
.
list_item
,
indent
&&
styles
.
indent
,
className
)
}
{
...
props
}
>
<
Button
className
=
{
classes
(
styles
.
list_item
,
indent
&&
styles
.
indent
,
className
)
}
{
...
props
}
>
<
Ellipsis
className
=
{
styles
.
label
}
>
{
label
}
</
Ellipsis
>
{
children
}
{
children
}
</
Button
>
</
Button
>
);
);
...
...
src/frontend/components/ListItem/stylesheet.scss
浏览文件 @
26949548
...
@@ -3,6 +3,10 @@
...
@@ -3,6 +3,10 @@
.list_item
{
.list_item
{
height
:
$line-height
;
height
:
$line-height
;
.label
{
flex
:
1
;
}
&
.indent
{
&
.indent
{
padding-left
:
24px
;
padding-left
:
24px
;
}
}
...
...
src/frontend/components/Navigator/index.jsx
浏览文件 @
26949548
...
@@ -5,10 +5,9 @@ import faSearch from '@fortawesome/fontawesome-free-solid/faSearch';
...
@@ -5,10 +5,9 @@ import faSearch from '@fortawesome/fontawesome-free-solid/faSearch';
import
faCode
from
'
@fortawesome/fontawesome-free-solid/faCode
'
;
import
faCode
from
'
@fortawesome/fontawesome-free-solid/faCode
'
;
import
faBook
from
'
@fortawesome/fontawesome-free-solid/faBook
'
;
import
faBook
from
'
@fortawesome/fontawesome-free-solid/faBook
'
;
import
faGithub
from
'
@fortawesome/fontawesome-free-brands/faGithub
'
;
import
faGithub
from
'
@fortawesome/fontawesome-free-brands/faGithub
'
;
import
{
E
llipsis
,
E
xpandableListItem
,
ListItem
}
from
'
/components
'
;
import
{
ExpandableListItem
,
ListItem
}
from
'
/components
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
actions
as
envActions
}
from
'
/reducers/env
'
;
import
{
actions
as
envActions
}
from
'
/reducers/env
'
;
import
'
github-fork-ribbon-css/gh-fork-ribbon.css
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
@
connect
(
@
connect
(
...
@@ -93,9 +92,7 @@ class Navigator extends React.Component {
...
@@ -93,9 +92,7 @@ class Navigator extends React.Component {
const
selected
=
category
.
key
===
selectedCategoryKey
&&
algorithm
.
key
===
selectedAlgorithmKey
;
const
selected
=
category
.
key
===
selectedCategoryKey
&&
algorithm
.
key
===
selectedAlgorithmKey
;
return
(
return
(
<
ListItem
indent
key
=
{
algorithm
.
key
}
selected
=
{
selected
}
<
ListItem
indent
key
=
{
algorithm
.
key
}
selected
=
{
selected
}
to
=
{
`/
${
category
.
key
}
/
${
algorithm
.
key
}
`
}
>
to
=
{
`/
${
category
.
key
}
/
${
algorithm
.
key
}
`
}
label
=
{
algorithm
.
name
}
/>
<
Ellipsis
>
{
algorithm
.
name
}
</
Ellipsis
>
</
ListItem
>
)
)
})
})
}
}
...
@@ -105,25 +102,10 @@ class Navigator extends React.Component {
...
@@ -105,25 +102,10 @@ class Navigator extends React.Component {
}
}
</
div
>
</
div
>
<
div
className
=
{
styles
.
footer
}
>
<
div
className
=
{
styles
.
footer
}
>
<
ListItem
className
=
{
styles
.
scratch_paper
}
icon
=
{
faCode
}
>
Scratch Paper
</
ListItem
>
<
ListItem
icon
=
{
faCode
}
label
=
"Scratch Paper"
/>
<
ListItem
className
=
{
styles
.
documentation
}
icon
=
{
faBook
}
>
Tracer API
</
ListItem
>
<
ListItem
icon
=
{
faBook
}
label
=
"Tracer API"
/>
<
ExpandableListItem
icon
=
{
faGithub
}
onClick
=
{
()
=>
this
.
togglePoweredBy
()
}
label
=
"Powered by ..."
<
ListItem
icon
=
{
faGithub
}
label
=
"Fork me on GitHub"
href
=
"https://github.com/parkjs814/AlgorithmVisualizer"
/>
opened
=
{
poweredByOpened
}
>
<
ListItem
indent
href
=
"https://github.com/jquery/jquery"
>
jquery/jquery
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/ajaxorg/ace"
>
ajaxorg/ace
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/jacomyal/sigma.js"
>
jacomyal/sigma.js
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/chartjs/Chart.js"
>
chartjs/Chart.js
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/Daniel15/babel-standalone"
>
Daniel15/babel-standalone
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/showdownjs/showdown"
>
showdownjs/showdown
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/FortAwesome/Font-Awesome"
>
FortAwesome/Font-Awesome
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/simonwhitaker/github-fork-ribbon-css"
>
simonwhitaker/github-fork-ribbon-css
</
ListItem
>
<
ListItem
indent
href
=
"https://github.com/mathjax/MathJax"
>
mathjax/MathJax
</
ListItem
>
</
ExpandableListItem
>
</
div
>
</
div
>
<
a
className
=
{
classes
(
'
github-fork-ribbon
'
,
'
right-bottom
'
)
}
href
=
"http://github.com/parkjs814/AlgorithmVisualizer"
data
-
ribbon
=
"Fork me on GitHub"
title
=
"Fork me on GitHub"
>
Fork me on GitHub
</
a
>
</
nav
>
</
nav
>
);
);
}
}
...
...
src/frontend/components/Navigator/stylesheet.scss
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
@import
"~/common/stylesheet/index"
;
.navigator
{
.navigator
{
position
:
relative
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
background-color
:
$theme-normal
;
.search_bar_container
{
.search_bar_container
{
height
:
$line-height
;
height
:
$line-height
;
padding
:
0
8px
;
padding
:
0
8px
;
display
:
flex
;
display
:
flex
;
align-items
:
stretch
;
align-items
:
stretch
;
border-
top
:
1px
solid
$theme-light
;
border-
bottom
:
1px
solid
$theme-light
;
&
:focus-within
{
&
:focus-within
{
background-color
:
$color-overlay
;
background-color
:
$color-overlay
;
...
@@ -27,24 +27,15 @@
...
@@ -27,24 +27,15 @@
background
:
none
;
background
:
none
;
border
:
none
;
border
:
none
;
outline
:
none
;
outline
:
none
;
overflow
:
hidden
;
}
}
}
}
.algorithm_list
{
.algorithm_list
{
flex
:
1
;
flex
:
1
;
border-bottom
:
1px
solid
$theme-light
;
overflow-y
:
scroll
;
overflow-y
:
scroll
;
border-top
:
1px
solid
$theme-light
;
}
}
:global
(
.github-fork-ribbon
)
{
.footer
{
&
:before
{
border-top
:
1px
solid
$theme-light
;
background-color
:
$theme-normal
;
}
&
:after
{
color
:
$color-font
;
}
}
}
}
}
\ No newline at end of file
src/frontend/components/RendererContainer/stylesheet.scss
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
@import
"~/common/stylesheet/index"
;
.renderer_container
{
.renderer_container
{
flex
:
1
;
display
:
flex
;
display
:
flex
;
align-items
:
stretch
;
align-items
:
stretch
;
flex-direction
:
column
;
flex-direction
:
column
;
...
...
src/frontend/components/Section/index.jsx
0 → 100644
浏览文件 @
26949548
import
React
from
'
react
'
;
import
{
classes
}
from
'
/common/util
'
;
import
styles
from
'
./stylesheet.scss
'
;
class
Section
extends
React
.
Component
{
render
()
{
const
{
className
,
children
,
style
}
=
this
.
props
;
return
(
<
section
className
=
{
classes
(
styles
.
section
,
className
)
}
style
=
{
style
}
>
{
children
}
</
section
>
);
}
}
export
default
Section
;
src/frontend/components/Section/stylesheet.scss
0 → 100644
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
.section
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
stretch
;
min-width
:
0
;
min-height
:
0
;
overflow
:
hidden
;
}
\ No newline at end of file
src/frontend/components/SectionContainer/index.jsx
0 → 100644
浏览文件 @
26949548
import
React
from
'
react
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
Section
}
from
'
/components
'
;
import
styles
from
'
./stylesheet.scss
'
;
class
SectionContainer
extends
React
.
Component
{
render
()
{
const
{
className
,
children
,
horizontal
,
style
}
=
this
.
props
;
return
(
<
Section
className
=
{
classes
(
styles
.
section_container
,
horizontal
&&
styles
.
horizontal
,
className
)
}
style
=
{
style
}
>
{
children
}
</
Section
>
);
}
}
export
default
SectionContainer
;
src/frontend/components/SectionContainer/stylesheet.scss
0 → 100644
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
.section_container
{
&
.horizontal
{
flex-direction
:
row
;
}
}
\ No newline at end of file
src/frontend/components/TabBar/index.jsx
已删除
100644 → 0
浏览文件 @
52963f85
import
React
from
'
react
'
;
import
faAngleLeft
from
'
@fortawesome/fontawesome-free-solid/faAngleLeft
'
;
import
faAngleRight
from
'
@fortawesome/fontawesome-free-solid/faAngleRight
'
;
import
{
Button
}
from
'
/components
'
;
import
{
classes
}
from
'
/common/util
'
;
import
styles
from
'
./stylesheet.scss
'
;
class
TabBar
extends
React
.
Component
{
render
()
{
const
{
className
,
tabs
,
tabIndex
}
=
this
.
props
;
const
prevIndex
=
(
tabIndex
-
1
+
tabs
.
length
)
%
tabs
.
length
;
const
nextIndex
=
(
tabIndex
+
1
)
%
tabs
.
length
;
return
(
<
div
className
=
{
classes
(
styles
.
tab_bar
,
className
)
}
>
<
Button
className
=
{
styles
.
tab
}
icon
=
{
faAngleLeft
}
{
...
tabs
[
prevIndex
].
props
}
/>
<
div
className
=
{
styles
.
wrapper
}
>
{
tabs
.
map
((
tab
,
i
)
=>
{
const
{
title
,
props
}
=
tab
;
const
selected
=
tabIndex
===
i
;
return
(
<
Button
className
=
{
classes
(
styles
.
tab
,
selected
&&
styles
.
selected
)
}
key
=
{
i
}
{
...
props
}
>
{
title
}
</
Button
>
)
})
}
</
div
>
<
Button
className
=
{
styles
.
tab
}
icon
=
{
faAngleRight
}
{
...
tabs
[
nextIndex
].
props
}
/>
</
div
>
);
}
}
export
default
TabBar
;
src/frontend/components/TabBar/stylesheet.scss
已删除
100644 → 0
浏览文件 @
52963f85
@import
"~/common/stylesheet/index"
;
.tab_bar
{
position
:
relative
;
display
:
flex
;
align-items
:
stretch
;
height
:
$line-height
;
background-color
:
$theme-normal
;
&
:before
{
content
:
''
;
position
:
absolute
;
bottom
:
0
;
left
:
0
;
right
:
0
;
height
:
1px
;
background-color
:
$theme-light
;
}
.wrapper
{
position
:
relative
;
flex
:
1
;
display
:
flex
;
overflow-x
:
scroll
;
white-space
:
nowrap
;
.tab
{
&
.selected
{
border-left
:
1px
solid
$theme-light
;
border-right
:
1px
solid
$theme-light
;
background-color
:
$theme-dark
;
}
}
&
.shadow-left
{
box-shadow
:
inset
16px
0
16px
-16px
$color-shadow
;
}
&
.shadow-right
{
box-shadow
:
inset
-16px
0
16px
-16px
$color-shadow
;
}
&
.shadow-left.shadow-right
{
box-shadow
:
inset
16px
0
16px
-16px
$color-shadow
,
inset
-16px
0
16px
-16px
$color-shadow
;
}
}
}
\ No newline at end of file
src/frontend/components/TabSection/index.jsx
0 → 100644
浏览文件 @
26949548
import
React
from
'
react
'
;
import
faAngleLeft
from
'
@fortawesome/fontawesome-free-solid/faAngleLeft
'
;
import
faAngleRight
from
'
@fortawesome/fontawesome-free-solid/faAngleRight
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
Button
,
Section
}
from
'
/components
'
;
import
styles
from
'
./stylesheet.scss
'
;
class
TabSection
extends
React
.
Component
{
render
()
{
const
{
className
,
tabs
,
tabIndex
,
onChangeTabIndex
,
style
,
relativeWeight
}
=
this
.
props
;
const
prevIndex
=
(
tabIndex
-
1
+
tabs
.
length
)
%
tabs
.
length
;
const
nextIndex
=
(
tabIndex
+
1
)
%
tabs
.
length
;
return
(
<
Section
className
=
{
classes
(
styles
.
tab_section
,
className
)
}
style
=
{
style
}
>
<
div
className
=
{
styles
.
tab_bar
}
>
<
Button
className
=
{
styles
.
tab
}
icon
=
{
faAngleLeft
}
onClick
=
{
()
=>
onChangeTabIndex
(
prevIndex
)
}
/>
<
div
className
=
{
styles
.
wrapper
}
>
{
tabs
.
map
((
tab
,
i
)
=>
{
const
{
id
,
title
}
=
tab
;
const
selected
=
tabIndex
===
i
;
return
(
<
Button
className
=
{
classes
(
styles
.
title
,
selected
&&
styles
.
selected
)
}
key
=
{
id
}
onClick
=
{
()
=>
onChangeTabIndex
(
i
)
}
>
{
title
}
</
Button
>
)
})
}
</
div
>
<
Button
className
=
{
styles
.
tab
}
icon
=
{
faAngleRight
}
onClick
=
{
()
=>
onChangeTabIndex
(
nextIndex
)
}
/>
</
div
>
<
div
className
=
{
styles
.
content
}
data
-
tab_index
=
{
tabIndex
}
>
{
tabs
.
map
((
tab
,
i
)
=>
{
const
{
id
,
Component
}
=
tab
;
const
selected
=
tabIndex
===
i
;
return
<
Component
key
=
{
id
}
className
=
{
classes
(
styles
.
tab
,
selected
&&
styles
.
selected
)
}
relativeWeight
=
{
relativeWeight
}
/>;
})
}
</
div
>
</
Section
>
);
}
}
export
default
TabSection
;
src/frontend/components/TabSection/stylesheet.scss
0 → 100644
浏览文件 @
26949548
@import
"~/common/stylesheet/index"
;
.tab_section
{
.tab_bar
{
position
:
relative
;
display
:
flex
;
align-items
:
stretch
;
height
:
$line-height
;
background-color
:
$theme-normal
;
&
:before
{
content
:
''
;
position
:
absolute
;
bottom
:
0
;
left
:
0
;
right
:
0
;
height
:
1px
;
background-color
:
$theme-light
;
}
.wrapper
{
position
:
relative
;
flex
:
1
;
display
:
flex
;
overflow-x
:
scroll
;
white-space
:
nowrap
;
.title
{
&
.selected
{
border-left
:
1px
solid
$theme-light
;
border-right
:
1px
solid
$theme-light
;
background-color
:
$theme-dark
;
}
}
}
}
.content
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
.tab
{
flex
:
1
;
display
:
none
;
&
.selected
{
display
:
flex
;
}
}
}
}
\ No newline at end of file
src/frontend/components/ViewerSection/index.jsx
已删除
100644 → 0
浏览文件 @
52963f85
import
React
from
'
react
'
;
import
{
classes
}
from
'
/common/util
'
;
import
{
DescriptionViewer
,
RendererContainer
,
TabBar
,
WikiViewer
}
from
'
/components
'
;
import
styles
from
'
./stylesheet.scss
'
;
class
ViewerSection
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
tabIndex
:
0
,
};
}
setTabIndex
(
tabIndex
)
{
this
.
setState
({
tabIndex
});
}
render
()
{
const
{
className
,
style
}
=
this
.
props
;
const
{
tabIndex
}
=
this
.
state
;
const
tabs
=
[
'
Visualization
'
,
'
Description
'
,
'
Tracer API
'
].
map
((
title
,
i
)
=>
({
title
,
props
:
{
onClick
:
()
=>
this
.
setTabIndex
(
i
)
},
}));
return
(
<
section
className
=
{
classes
(
styles
.
viewer_section
,
className
)
}
style
=
{
style
}
>
<
TabBar
tabs
=
{
tabs
}
tabIndex
=
{
tabIndex
}
/>
<
div
className
=
{
styles
.
content
}
data
-
tab_index
=
{
tabIndex
}
>
<
RendererContainer
className
=
{
styles
.
tab
}
/>
<
DescriptionViewer
className
=
{
styles
.
tab
}
/>
<
WikiViewer
className
=
{
styles
.
tab
}
/>
</
div
>
</
section
>
);
}
}
export
default
ViewerSection
;
src/frontend/components/ViewerSection/stylesheet.scss
已删除
100644 → 0
浏览文件 @
52963f85
@import
"~/common/stylesheet/index"
;
.viewer_section
{
display
:
flex
;
flex-direction
:
column
;
align-items
:
stretch
;
.content
{
flex
:
1
;
display
:
flex
;
flex-direction
:
column
;
overflow-y
:
scroll
;
.tab
{
display
:
none
;
}
&
[
data-tab_index
=
'0'
]
.tab
:nth-child
(
1
),
&
[
data-tab_index
=
'1'
]
.tab
:nth-child
(
2
),
&
[
data-tab_index
=
'2'
]
.tab
:nth-child
(
3
)
{
display
:
flex
;
}
}
}
\ No newline at end of file
src/frontend/components/WikiViewer/index.jsx
浏览文件 @
26949548
...
@@ -35,9 +35,8 @@ class WikiViewer extends React.Component {
...
@@ -35,9 +35,8 @@ class WikiViewer extends React.Component {
};
};
return
(
return
(
<
div
className
=
{
classes
(
styles
.
wiki_viewer
,
className
)
}
>
<
ReactMarkdown
className
=
{
classes
(
styles
.
wiki_viewer
,
className
)
}
source
=
{
wiki
}
renderers
=
{
{
link
:
InnerLink
}
}
>
<
ReactMarkdown
className
=
{
styles
.
markdown
}
source
=
{
wiki
}
renderers
=
{
{
link
:
InnerLink
}
}
/>
</
ReactMarkdown
>
</
div
>
);
);
}
}
}
}
...
...
src/frontend/components/WikiViewer/stylesheet.scss
浏览文件 @
26949548
...
@@ -4,14 +4,12 @@
...
@@ -4,14 +4,12 @@
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
stretch
;
align-items
:
stretch
;
padding
:
16px
;
font-size
:
$font-size-large
;
overflow-y
:
scroll
;
.markdown
{
a
{
padding
:
16px
;
text-decoration
:
underline
;
font-size
:
$font-size-large
;
cursor
:
pointer
;
a
{
text-decoration
:
underline
;
cursor
:
pointer
;
}
}
}
}
}
\ No newline at end of file
src/frontend/components/index.js
浏览文件 @
26949548
export
{
default
as
App
}
from
'
./App
'
;
export
{
default
as
App
}
from
'
./App
'
;
export
{
default
as
BasicSection
}
from
'
./BasicSection
'
;
export
{
default
as
Button
}
from
'
./Button
'
;
export
{
default
as
Button
}
from
'
./Button
'
;
export
{
default
as
CodeEditor
}
from
'
./CodeEditor
'
;
export
{
default
as
DescriptionViewer
}
from
'
./DescriptionViewer
'
;
export
{
default
as
DescriptionViewer
}
from
'
./DescriptionViewer
'
;
export
{
default
as
Divider
}
from
'
./Divider
'
;
export
{
default
as
Divider
}
from
'
./Divider
'
;
export
{
default
as
EditorSection
}
from
'
./EditorSection
'
;
export
{
default
as
Ellipsis
}
from
'
./Ellipsis
'
;
export
{
default
as
Ellipsis
}
from
'
./Ellipsis
'
;
export
{
default
as
ExpandableListItem
}
from
'
./ExpandableListItem
'
;
export
{
default
as
ExpandableListItem
}
from
'
./ExpandableListItem
'
;
export
{
default
as
Header
}
from
'
./Header
'
;
export
{
default
as
Header
}
from
'
./Header
'
;
export
{
default
as
ListItem
}
from
'
./ListItem
'
;
export
{
default
as
ListItem
}
from
'
./ListItem
'
;
export
{
default
as
Navigator
}
from
'
./Navigator
'
;
export
{
default
as
Navigator
}
from
'
./Navigator
'
;
export
{
default
as
RendererContainer
}
from
'
./RendererContainer
'
;
export
{
default
as
RendererContainer
}
from
'
./RendererContainer
'
;
export
{
default
as
TabBar
}
from
'
./TabBar
'
;
export
{
default
as
Section
}
from
'
./Section
'
;
export
{
default
as
SectionContainer
}
from
'
./SectionContainer
'
;
export
{
default
as
TabSection
}
from
'
./TabSection
'
;
export
{
default
as
ToastContainer
}
from
'
./ToastContainer
'
;
export
{
default
as
ToastContainer
}
from
'
./ToastContainer
'
;
export
{
default
as
ViewerSection
}
from
'
./ViewerSection
'
;
export
{
default
as
WikiViewer
}
from
'
./WikiViewer
'
;
export
{
default
as
WikiViewer
}
from
'
./WikiViewer
'
;
src/frontend/core/Workspace.js
0 → 100644
浏览文件 @
26949548
import
uuid
from
'
uuid
'
;
import
React
from
'
react
'
;
import
{
BasicSection
,
Divider
,
SectionContainer
,
TabSection
}
from
'
/components
'
;
const
minSize
=
20
;
class
UISection
{
constructor
(
parent
=
null
,
weight
=
1
,
visible
=
true
)
{
this
.
id
=
uuid
.
v4
();
this
.
parent
=
parent
;
this
.
weight
=
weight
;
this
.
visible
=
visible
;
}
setVisible
(
visible
)
{
this
.
visible
=
visible
;
this
.
change
();
}
isVisible
()
{
return
this
.
visible
;
}
handleResize
(
target
,
clientX
,
clientY
)
{
const
{
offsetLeft
,
offsetTop
,
offsetWidth
,
offsetHeight
}
=
target
.
parentElement
;
let
position
,
size
;
if
(
this
.
parent
.
horizontal
)
{
position
=
clientX
-
offsetLeft
;
size
=
offsetWidth
;
}
else
{
position
=
clientY
-
offsetTop
;
size
=
offsetHeight
;
}
const
visibleSections
=
this
.
parent
.
sections
.
filter
(
section
=>
section
.
visible
);
const
index
=
visibleSections
.
findIndex
(
section
=>
section
===
this
);
const
weights
=
visibleSections
.
map
(
section
=>
section
.
weight
);
const
totalWeight
=
weights
.
reduce
((
sumWeight
,
weight
)
=>
sumWeight
+
weight
,
0
);
const
startWeight
=
weights
.
slice
(
0
,
index
).
reduce
((
sumWeight
,
weight
)
=>
sumWeight
+
weight
,
0
);
const
endWeight
=
position
/
size
*
totalWeight
;
const
oldWeight
=
weights
[
index
];
const
newWeight
=
endWeight
-
startWeight
;
const
oldScale
=
totalWeight
-
startWeight
-
oldWeight
;
const
newScale
=
totalWeight
-
startWeight
-
newWeight
;
const
ratio
=
newScale
/
oldScale
;
weights
[
index
]
=
newWeight
;
for
(
let
i
=
index
+
1
;
i
<
weights
.
length
;
i
++
)
{
weights
[
i
]
*=
ratio
;
}
for
(
let
i
=
index
;
i
<
weights
.
length
;
i
++
)
{
if
(
weights
[
i
]
/
totalWeight
*
size
<
minSize
)
return
;
}
for
(
let
i
=
index
;
i
<
visibleSections
.
length
;
i
++
)
{
visibleSections
[
i
].
weight
=
weights
[
i
];
}
this
.
change
();
}
render
(
props
)
{
return
null
;
}
renderDivider
(
props
)
{
return
(
<
Divider
{...
props
}
onResize
=
{(
target
,
x
,
y
)
=>
this
.
handleResize
(
target
,
x
,
y
)}
/
>
);
}
change
()
{
if
(
this
.
parent
)
this
.
parent
.
change
();
}
}
class
UIBasicSection
extends
UISection
{
constructor
(
parent
,
Component
,
weight
,
visible
)
{
super
(
parent
,
weight
,
visible
);
this
.
Component
=
Component
;
}
render
(
props
)
{
return
(
<
BasicSection
{...
props
}
Component
=
{
this
.
Component
}
/
>
);
}
}
class
UITabSection
extends
UISection
{
constructor
(
parent
,
weight
,
visible
)
{
super
(
parent
,
weight
,
visible
);
this
.
tabs
=
[];
this
.
tabIndex
=
0
;
}
addTab
(
title
,
Component
)
{
const
tab
=
{
id
:
uuid
.
v4
(),
title
,
Component
};
this
.
tabs
.
push
(
tab
);
this
.
change
();
return
tab
;
}
setTabIndex
(
tabIndex
)
{
this
.
tabIndex
=
tabIndex
;
this
.
change
();
}
render
(
props
)
{
return
(
<
TabSection
{...
props
}
tabs
=
{
this
.
tabs
}
tabIndex
=
{
this
.
tabIndex
}
onChangeTabIndex
=
{
tabIndex
=>
this
.
setTabIndex
(
tabIndex
)}
/
>
);
}
}
class
UIContainer
extends
UISection
{
constructor
(
parent
,
horizontal
=
true
,
weight
,
visible
)
{
super
(
parent
,
weight
,
visible
);
this
.
horizontal
=
horizontal
;
this
.
sections
=
[];
}
setHorizontal
(
horizontal
)
{
this
.
horizontal
=
horizontal
;
this
.
change
();
}
addBasicSection
(
Component
,
weight
)
{
const
section
=
new
UIBasicSection
(
this
,
Component
,
weight
);
this
.
sections
.
push
(
section
);
this
.
change
();
return
section
;
}
addTabSection
(
weight
)
{
const
section
=
new
UITabSection
(
this
,
weight
);
this
.
sections
.
push
(
section
);
this
.
change
();
return
section
;
}
addContainer
(
horizontal
,
weight
)
{
const
container
=
new
UIContainer
(
this
,
horizontal
,
weight
);
this
.
sections
.
push
(
container
);
this
.
change
();
return
container
;
}
render
(
props
)
{
const
visibleSections
=
this
.
sections
.
filter
(
section
=>
section
.
visible
);
const
weights
=
visibleSections
.
map
(
section
=>
section
.
weight
);
const
totalWeight
=
weights
.
reduce
((
sumWeight
,
weight
)
=>
sumWeight
+
weight
,
0
);
return
(
<
SectionContainer
{...
props
}
horizontal
=
{
this
.
horizontal
}
>
{
visibleSections
.
map
(
section
=>
{
const
relativeWeight
=
section
.
weight
/
totalWeight
;
return
[
section
.
render
({
key
:
section
.
id
,
style
:
{
flex
:
relativeWeight
},
relativeWeight
,
}),
section
.
renderDivider
({
key
:
`divider-
${
section
.
id
}
`
,
horizontal
:
this
.
horizontal
}),
];
}).
reduce
((
flat
,
toFlatten
)
=>
flat
.
concat
(
toFlatten
),
[])
}
<
/SectionContainer
>
);
}
}
class
Workspace
{
constructor
(
horizontal
)
{
this
.
rootContainer
=
new
UIContainer
(
this
,
horizontal
);
this
.
onChange
=
null
;
}
getRootContainer
()
{
return
this
.
rootContainer
;
}
setHorizontal
(
horizontal
)
{
this
.
rootContainer
.
setHorizontal
(
horizontal
);
}
addBasicSection
(
Component
,
weight
)
{
return
this
.
rootContainer
.
addBasicSection
(
Component
,
weight
);
}
addTabSection
(
weight
)
{
return
this
.
rootContainer
.
addTabSection
(
weight
);
}
addContainer
(
horizontal
,
weight
)
{
return
this
.
rootContainer
.
addContainer
(
horizontal
,
weight
);
}
render
(
props
)
{
return
this
.
rootContainer
.
render
(
props
);
}
setOnChange
(
onChange
)
{
this
.
onChange
=
onChange
;
this
.
change
();
}
change
()
{
if
(
this
.
onChange
)
this
.
onChange
(
this
.
rootContainer
);
}
}
export
default
Workspace
;
\ No newline at end of file
src/frontend/core/index.js
浏览文件 @
26949548
...
@@ -2,4 +2,5 @@ export { default as datas } from './datas';
...
@@ -2,4 +2,5 @@ export { default as datas } from './datas';
export
{
default
as
tracers
}
from
'
./tracers
'
;
export
{
default
as
tracers
}
from
'
./tracers
'
;
export
{
default
as
renderers
}
from
'
./renderers
'
;
export
{
default
as
renderers
}
from
'
./renderers
'
;
export
{
default
as
Seed
}
from
'
./Seed
'
;
export
{
default
as
Seed
}
from
'
./Seed
'
;
export
{
default
as
tracerManager
}
from
'
./tracerManager
'
;
export
{
default
as
tracerManager
}
from
'
./tracerManager
'
;
\ No newline at end of file
export
{
default
as
Workspace
}
from
'
./Workspace
'
;
\ No newline at end of file
src/frontend/core/renderers/Renderer/index.jsx
浏览文件 @
26949548
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
styles
from
'
./stylesheet.scss
'
;
import
{
Ellipsis
}
from
'
/components
'
;
class
Renderer
extends
React
.
Component
{
class
Renderer
extends
React
.
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -100,7 +101,7 @@ class Renderer extends React.Component {
...
@@ -100,7 +101,7 @@ class Renderer extends React.Component {
return
(
return
(
<
div
className
=
{
styles
.
renderer
}
onMouseDown
=
{
this
.
handleMouseDown
}
onWheel
=
{
this
.
handleWheel
}
>
<
div
className
=
{
styles
.
renderer
}
onMouseDown
=
{
this
.
handleMouseDown
}
onWheel
=
{
this
.
handleWheel
}
>
<
span
className
=
{
styles
.
title
}
>
{
title
}
</
span
>
<
Ellipsis
className
=
{
styles
.
title
}
>
{
title
}
</
Ellipsis
>
{
{
this
.
renderData
()
this
.
renderData
()
}
}
...
...
src/frontend/core/renderers/Renderer/stylesheet.scss
浏览文件 @
26949548
...
@@ -8,11 +8,11 @@
...
@@ -8,11 +8,11 @@
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
overflow
:
hidden
;
overflow
:
hidden
;
border-
bottom
:
1px
solid
$theme-light
;
border-
top
:
1px
solid
$theme-light
;
font-family
:
'Roboto Mono'
,
monospace
;
font-family
:
'Roboto Mono'
,
monospace
;
&
:
la
st-child
{
&
:
fir
st-child
{
border-
bottom
:
none
;
border-
top
:
none
;
}
}
.title
{
.title
{
...
...
src/frontend/index.jsx
浏览文件 @
26949548
...
@@ -17,6 +17,7 @@ const render = (Component) => {
...
@@ -17,6 +17,7 @@ const render = (Component) => {
<
BrowserRouter
>
<
BrowserRouter
>
<
Switch
>
<
Switch
>
<
Route
exact
path
=
"/:categoryKey/:algorithmKey"
component
=
{
Component
}
/>
<
Route
exact
path
=
"/:categoryKey/:algorithmKey"
component
=
{
Component
}
/>
<
Route
exact
path
=
"/:categoryKey"
component
=
{
Component
}
/>
<
Route
path
=
"/"
component
=
{
Component
}
/>
<
Route
path
=
"/"
component
=
{
Component
}
/>
</
Switch
>
</
Switch
>
</
BrowserRouter
>
</
BrowserRouter
>
...
...
src/frontend/reducers/env.js
浏览文件 @
26949548
...
@@ -13,9 +13,7 @@ export const actions = {
...
@@ -13,9 +13,7 @@ export const actions = {
setDirectory
,
setDirectory
,
};
};
const
immutables
=
{};
const
defaultState
=
{
const
mutables
=
{
categories
:
null
,
categories
:
null
,
categoryKey
:
null
,
categoryKey
:
null
,
algorithmKey
:
null
,
algorithmKey
:
null
,
...
@@ -29,7 +27,4 @@ export default handleActions({
...
@@ -29,7 +27,4 @@ export default handleActions({
...
state
,
...
state
,
...
payload
,
...
payload
,
}),
}),
},
{
},
defaultState
);
...
immutables
,
...
mutables
,
});
src/frontend/reducers/toast.js
浏览文件 @
26949548
...
@@ -13,9 +13,7 @@ export const actions = {
...
@@ -13,9 +13,7 @@ export const actions = {
hideToast
,
hideToast
,
};
};
const
immutables
=
{};
const
defaultState
=
{
const
mutables
=
{
toasts
:
[],
toasts
:
[],
};
};
...
@@ -38,9 +36,7 @@ export default handleActions({
...
@@ -38,9 +36,7 @@ export default handleActions({
toasts
,
toasts
,
};
};
},
},
[
combineActions
(
[
hideToast
]:
(
state
,
{
payload
})
=>
{
hideToast
,
)]:
(
state
,
{
payload
})
=>
{
const
{
id
}
=
payload
;
const
{
id
}
=
payload
;
const
toasts
=
state
.
toasts
.
filter
(
toast
=>
toast
.
id
!==
id
);
const
toasts
=
state
.
toasts
.
filter
(
toast
=>
toast
.
id
!==
id
);
return
{
return
{
...
@@ -48,7 +44,4 @@ export default handleActions({
...
@@ -48,7 +44,4 @@ export default handleActions({
toasts
,
toasts
,
};
};
},
},
},
{
},
defaultState
);
...
immutables
,
...
mutables
,
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录