Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dima Krasner
Sharkey
Commits
a07037af
Unverified
Commit
a07037af
authored
3 years ago
by
MeiMei
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
テーマ選択から重複要素を排除するように (#8385)
parent
9b8dc4c4
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/client/src/pages/settings/theme.vue
+2
-2
2 additions, 2 deletions
packages/client/src/pages/settings/theme.vue
packages/client/src/scripts/array.ts
+11
-0
11 additions, 0 deletions
packages/client/src/scripts/array.ts
with
13 additions
and
2 deletions
packages/client/src/pages/settings/theme.vue
+
2
−
2
View file @
a07037af
...
@@ -101,7 +101,7 @@ import { ColdDeviceStorage } from '@/store';
...
@@ -101,7 +101,7 @@ import { ColdDeviceStorage } from '@/store';
import
{
i18n
}
from
'
@/i18n
'
;
import
{
i18n
}
from
'
@/i18n
'
;
import
{
defaultStore
}
from
'
@/store
'
;
import
{
defaultStore
}
from
'
@/store
'
;
import
{
instance
}
from
'
@/instance
'
;
import
{
instance
}
from
'
@/instance
'
;
import
{
concat
}
from
'
@/scripts/array
'
;
import
{
concat
,
uniqueBy
}
from
'
@/scripts/array
'
;
import
{
fetchThemes
,
getThemes
}
from
'
@/theme-store
'
;
import
{
fetchThemes
,
getThemes
}
from
'
@/theme-store
'
;
import
*
as
symbols
from
'
@/symbols
'
;
import
*
as
symbols
from
'
@/symbols
'
;
...
@@ -128,7 +128,7 @@ export default defineComponent({
...
@@ -128,7 +128,7 @@ export default defineComponent({
const
instanceThemes
=
[];
const
instanceThemes
=
[];
if
(
instance
.
defaultLightTheme
!=
null
)
instanceThemes
.
push
(
JSON5
.
parse
(
instance
.
defaultLightTheme
));
if
(
instance
.
defaultLightTheme
!=
null
)
instanceThemes
.
push
(
JSON5
.
parse
(
instance
.
defaultLightTheme
));
if
(
instance
.
defaultDarkTheme
!=
null
)
instanceThemes
.
push
(
JSON5
.
parse
(
instance
.
defaultDarkTheme
));
if
(
instance
.
defaultDarkTheme
!=
null
)
instanceThemes
.
push
(
JSON5
.
parse
(
instance
.
defaultDarkTheme
));
const
themes
=
computed
(()
=>
instanceThemes
.
concat
(
builtinThemes
.
concat
(
installedThemes
.
value
)));
const
themes
=
computed
(()
=>
uniqueBy
(
instanceThemes
.
concat
(
builtinThemes
.
concat
(
installedThemes
.
value
))
,
theme
=>
theme
.
id
)
);
const
darkThemes
=
computed
(()
=>
themes
.
value
.
filter
(
t
=>
t
.
base
===
'
dark
'
||
t
.
kind
===
'
dark
'
));
const
darkThemes
=
computed
(()
=>
themes
.
value
.
filter
(
t
=>
t
.
base
===
'
dark
'
||
t
.
kind
===
'
dark
'
));
const
lightThemes
=
computed
(()
=>
themes
.
value
.
filter
(
t
=>
t
.
base
===
'
light
'
||
t
.
kind
===
'
light
'
));
const
lightThemes
=
computed
(()
=>
themes
.
value
.
filter
(
t
=>
t
.
base
===
'
light
'
||
t
.
kind
===
'
light
'
));
const
darkTheme
=
ColdDeviceStorage
.
ref
(
'
darkTheme
'
);
const
darkTheme
=
ColdDeviceStorage
.
ref
(
'
darkTheme
'
);
...
...
This diff is collapsed.
Click to expand it.
packages/client/src/scripts/array.ts
+
11
−
0
View file @
a07037af
...
@@ -52,6 +52,17 @@ export function unique<T>(xs: T[]): T[] {
...
@@ -52,6 +52,17 @@ export function unique<T>(xs: T[]): T[] {
return
[...
new
Set
(
xs
)];
return
[...
new
Set
(
xs
)];
}
}
export
function
uniqueBy
<
TValue
,
TKey
>
(
values
:
TValue
[],
keySelector
:
(
value
:
TValue
)
=>
TKey
):
TValue
[]
{
const
map
=
new
Map
<
TKey
,
TValue
>
();
for
(
const
value
of
values
)
{
const
key
=
keySelector
(
value
);
if
(
!
map
.
has
(
key
))
map
.
set
(
key
,
value
);
}
return
[...
map
.
values
()];
}
export
function
sum
(
xs
:
number
[]):
number
{
export
function
sum
(
xs
:
number
[]):
number
{
return
xs
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
return
xs
.
reduce
((
a
,
b
)
=>
a
+
b
,
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment