Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jobily
Questdb
提交
70c8af78
Q
Questdb
项目概览
jobily
/
Questdb
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
Questdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
70c8af78
编写于
3月 31, 2022
作者:
A
Arijus Šukys
提交者:
GitHub
3月 31, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(ui): add red dot indicator on "Example Queries" button (#1993)
上级
639a3eb1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
39 addition
and
3 deletion
+39
-3
ui/src/providers/LocalStorageProvider/index.tsx
ui/src/providers/LocalStorageProvider/index.tsx
+11
-0
ui/src/providers/LocalStorageProvider/types.ts
ui/src/providers/LocalStorageProvider/types.ts
+1
-0
ui/src/scenes/Editor/Menu/index.tsx
ui/src/scenes/Editor/Menu/index.tsx
+26
-3
ui/src/utils/localStorage/types.ts
ui/src/utils/localStorage/types.ts
+1
-0
未找到文件。
ui/src/providers/LocalStorageProvider/index.tsx
浏览文件 @
70c8af78
...
...
@@ -45,6 +45,7 @@ const defaultConfig: LocalConfig = {
queryText
:
""
,
editorSplitterBasis
:
350
,
resultsSplitterBasis
:
350
,
exampleQueriesVisited
:
false
,
}
type
ContextProps
=
{
...
...
@@ -57,6 +58,7 @@ type ContextProps = {
editorSplitterBasis
:
number
resultsSplitterBasis
:
number
updateSettings
:
(
key
:
StoreKey
,
value
:
SettingsType
)
=>
void
exampleQueriesVisited
:
boolean
}
const
defaultValues
:
ContextProps
=
{
...
...
@@ -69,6 +71,7 @@ const defaultValues: ContextProps = {
editorSplitterBasis
:
350
,
resultsSplitterBasis
:
350
,
updateSettings
:
(
key
:
StoreKey
,
value
:
SettingsType
)
=>
undefined
,
exampleQueriesVisited
:
false
,
}
export
const
LocalStorageContext
=
createContext
<
ContextProps
>
(
defaultValues
)
...
...
@@ -113,6 +116,10 @@ export const LocalStorageProvider = ({
),
)
const
[
exampleQueriesVisited
,
setExampleQueriesVisited
]
=
useState
<
boolean
>
(
getValue
(
StoreKey
.
EXAMPLE_QUERIES_VISITED
)
===
"
true
"
,
)
const
updateSettings
=
(
key
:
StoreKey
,
value
:
SettingsType
)
=>
{
setValue
(
key
,
value
.
toString
())
refreshSettings
(
key
)
...
...
@@ -130,6 +137,9 @@ export const LocalStorageProvider = ({
case
StoreKey
.
EDITOR_LINE
:
setEditorLine
(
parseInteger
(
value
,
defaultConfig
.
editorLine
))
break
case
StoreKey
.
EXAMPLE_QUERIES_VISITED
:
setExampleQueriesVisited
(
value
===
"
true
"
)
break
case
StoreKey
.
NOTIFICATION_ENABLED
:
setIsNotificationEnabled
(
parseBoolean
(
value
,
defaultConfig
.
isNotificationEnabled
),
...
...
@@ -168,6 +178,7 @@ export const LocalStorageProvider = ({
editorSplitterBasis
,
resultsSplitterBasis
,
updateSettings
,
exampleQueriesVisited
,
}
}
>
{
children
}
...
...
ui/src/providers/LocalStorageProvider/types.ts
浏览文件 @
70c8af78
...
...
@@ -33,4 +33,5 @@ export type LocalConfig = {
queryText
:
string
editorSplitterBasis
:
number
resultsSplitterBasis
:
number
exampleQueriesVisited
:
boolean
}
ui/src/scenes/Editor/Menu/index.tsx
浏览文件 @
70c8af78
...
...
@@ -78,9 +78,25 @@ const DocsearchInput = styled(Input)`
white-space: nowrap;
`
const
QueryPickerButton
=
styled
(
SecondaryButton
)
`
const
QueryPickerButton
=
styled
(
SecondaryButton
)
<
{
firstTimeVisitor
:
boolean
}
>
`
position: relative;
margin: 0 1rem;
flex: 0 0 auto;
${({
firstTimeVisitor
})
=>
firstTimeVisitor
&&
`&:after {
border-radius: 50%;
content: "";
background: #dc4949;
width: 8px;
height: 8px;
position: absolute;
top: -3px;
right: -3px;
}`
}
`
const
MenuIcon
=
styled
(
_MenuIcon
)
`
...
...
@@ -155,12 +171,19 @@ const Menu = () => {
const
running
=
useSelector
(
selectors
.
query
.
getRunning
)
const
opened
=
useSelector
(
selectors
.
console
.
getSideMenuOpened
)
const
{
sm
}
=
useScreenSize
()
const
{
resultsSplitterBasis
,
updateSettings
}
=
useLocalStorage
()
const
{
resultsSplitterBasis
,
exampleQueriesVisited
,
updateSettings
,
}
=
useLocalStorage
()
const
handleClick
=
useCallback
(()
=>
{
dispatch
(
actions
.
query
.
toggleRunning
())
},
[
dispatch
])
const
handleToggle
=
useCallback
((
active
)
=>
{
if
(
!
exampleQueriesVisited
&&
active
)
{
updateSettings
(
StoreKey
.
EXAMPLE_QUERIES_VISITED
,
true
)
}
setPopperActive
(
active
)
},
[])
const
handleHidePicker
=
useCallback
(()
=>
{
...
...
@@ -238,7 +261,7 @@ const Menu = () => {
active
=
{
popperActive
}
onToggle
=
{
handleToggle
}
trigger
=
{
<
QueryPickerButton
onClick
=
{
handleClick
}
>
<
QueryPickerButton
firstTimeVisitor
=
{
!
exampleQueriesVisited
}
>
<
Add
size
=
"18px"
/>
<
span
>
Example queries
</
span
>
</
QueryPickerButton
>
...
...
ui/src/utils/localStorage/types.ts
浏览文件 @
70c8af78
...
...
@@ -27,6 +27,7 @@ export enum StoreKey {
QUERY_TEXT
=
"
query.text
"
,
EDITOR_LINE
=
"
editor.line
"
,
EDITOR_COL
=
"
editor.col
"
,
EXAMPLE_QUERIES_VISITED
=
"
editor.exampleQueriesVisited
"
,
NOTIFICATION_ENABLED
=
"
notification.enabled
"
,
NOTIFICATION_DELAY
=
"
notification.delay
"
,
EDITOR_SPLITTER_BASIS
=
"
splitter.editor.basis
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录