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
e76d3e72
Unverified
Commit
e76d3e72
authored
1 year ago
by
Ryu jongheon
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
refactor(fronted): setup syntax to menubar of Classic UI (#10474)
parent
19349b93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/frontend/src/ui/classic.header.vue
+36
-79
36 additions, 79 deletions
packages/frontend/src/ui/classic.header.vue
packages/frontend/src/ui/classic.sidebar.vue
+40
-90
40 additions, 90 deletions
packages/frontend/src/ui/classic.sidebar.vue
with
76 additions
and
169 deletions
packages/frontend/src/ui/classic.header.vue
+
36
−
79
View file @
e76d3e72
...
...
@@ -31,7 +31,7 @@
<button
v-click-anime
class=
"item _button account"
@
click=
"openAccountMenu"
>
<MkAvatar
:user=
"$i"
class=
"avatar"
/><MkAcct
class=
"acct"
:user=
"$i"
/>
</button>
<div
class=
"post"
@
click=
"post"
>
<div
class=
"post"
@
click=
"
os.
post
()
"
>
<MkButton
class=
"button"
gradate
full
rounded
>
<i
class=
"ti ti-pencil ti-fw"
></i>
</MkButton>
...
...
@@ -41,93 +41,50 @@
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineAsyncComponent
,
defineComponent
}
from
'
vue
'
;
<
script
lang=
"ts"
setup
>
import
{
computed
,
defineAsyncComponent
,
onMounted
}
from
'
vue
'
;
import
{
openInstanceMenu
}
from
'
./_common_/common
'
;
import
{
host
}
from
'
@/config
'
;
import
*
as
os
from
'
@/os
'
;
import
{
navbarItemDef
}
from
'
@/navbar
'
;
import
{
openAccountMenu
,
$i
}
from
'
@/account
'
;
import
{
openAccountMenu
as
openAccountMenu_
,
$i
}
from
'
@/account
'
;
import
MkButton
from
'
@/components/MkButton.vue
'
;
import
{
mainRouter
}
from
'
@/router
'
;
import
{
defaultStore
}
from
'
@/store
'
;
import
{
instance
}
from
'
@/instance
'
;
import
{
i18n
}
from
'
@/i18n
'
;
export
default
defineComponent
({
components
:
{
MkButton
,
},
data
()
{
return
{
host
:
host
,
accounts
:
[],
connection
:
null
,
navbarItemDef
:
navbarItemDef
,
settingsWindowed
:
false
,
defaultStore
,
instance
,
$i
,
i18n
,
};
},
computed
:
{
menu
():
string
[]
{
return
defaultStore
.
state
.
menu
;
},
otherNavItemIndicated
():
boolean
{
for
(
const
def
in
this
.
navbarItemDef
)
{
if
(
this
.
menu
.
includes
(
def
))
continue
;
if
(
this
.
navbarItemDef
[
def
].
indicated
)
return
true
;
}
return
false
;
},
},
watch
:
{
'
defaultStore.reactiveState.menuDisplay.value
'
()
{
this
.
calcViewState
();
},
},
created
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
calcViewState
);
this
.
calcViewState
();
},
methods
:
{
openInstanceMenu
,
calcViewState
()
{
this
.
settingsWindowed
=
(
window
.
innerWidth
>
1400
);
},
post
()
{
os
.
post
();
},
search
()
{
mainRouter
.
push
(
'
/search
'
);
},
more
(
ev
)
{
os
.
popup
(
defineAsyncComponent
(()
=>
import
(
'
@/components/MkLaunchPad.vue
'
)),
{
src
:
ev
.
currentTarget
??
ev
.
target
,
anchor
:
{
x
:
'
center
'
,
y
:
'
bottom
'
},
},
{
},
'
closed
'
);
},
openAccountMenu
:
(
ev
)
=>
{
openAccountMenu
({
withExtraOperation
:
true
,
},
ev
);
},
},
const
WINDOW_THRESHOLD
=
1400
;
let
settingsWindowed
=
$ref
(
window
.
innerWidth
>
WINDOW_THRESHOLD
);
let
menu
=
$ref
(
defaultStore
.
state
.
menu
);
// const menuDisplay = computed(defaultStore.makeGetterSetter('menuDisplay'));
let
otherNavItemIndicated
=
computed
<
boolean
>
(()
=>
{
for
(
const
def
in
navbarItemDef
)
{
if
(
menu
.
includes
(
def
))
continue
;
if
(
navbarItemDef
[
def
].
indicated
)
return
true
;
}
return
false
;
});
function
more
(
ev
:
MouseEvent
)
{
os
.
popup
(
defineAsyncComponent
(()
=>
import
(
'
@/components/MkLaunchPad.vue
'
)),
{
src
:
ev
.
currentTarget
??
ev
.
target
,
anchor
:
{
x
:
'
center
'
,
y
:
'
bottom
'
},
},
{
},
'
closed
'
);
}
function
openAccountMenu
(
ev
:
MouseEvent
)
{
openAccountMenu_
({
withExtraOperation
:
true
,
},
ev
);
}
onMounted
(()
=>
{
window
.
addEventListener
(
'
resize
'
,
()
=>
{
settingsWindowed
=
(
window
.
innerWidth
>=
WINDOW_THRESHOLD
);
},
{
passive
:
true
});
});
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
This diff is collapsed.
Click to expand it.
packages/frontend/src/ui/classic.sidebar.vue
+
40
−
90
View file @
e76d3e72
...
...
@@ -3,7 +3,7 @@
<button
v-click-anime
class=
"item _button account"
@
click=
"openAccountMenu"
>
<MkAvatar
:user=
"$i"
class=
"avatar"
/><MkAcct
class=
"text"
:user=
"$i"
/>
</button>
<div
class=
"post"
data-cy-open-post-form
@
click=
"post"
>
<div
class=
"post"
data-cy-open-post-form
@
click=
"
os.
post"
>
<MkButton
class=
"button"
gradate
full
rounded
>
<i
class=
"ti ti-pencil ti-fw"
></i><span
v-if=
"!iconOnly"
class=
"text"
>
{{
i18n
.
ts
.
note
}}
</span>
</MkButton>
...
...
@@ -40,109 +40,59 @@
</div>
</template>
<
script
lang=
"ts"
>
import
{
defineAsyncComponent
,
defineComponent
}
from
'
vue
'
;
<
script
lang=
"ts"
setup
>
import
{
defineAsyncComponent
,
onMounted
,
computed
,
watch
,
nextTick
}
from
'
vue
'
;
import
{
openInstanceMenu
}
from
'
./_common_/common
'
;
import
{
host
}
from
'
@/config
'
;
//
import { host } from '@/config';
import
*
as
os
from
'
@/os
'
;
import
{
navbarItemDef
}
from
'
@/navbar
'
;
import
{
openAccountMenu
,
$i
}
from
'
@/account
'
;
import
{
openAccountMenu
as
openAccountMenu_
,
$i
}
from
'
@/account
'
;
import
MkButton
from
'
@/components/MkButton.vue
'
;
import
{
StickySidebar
}
from
'
@/scripts/sticky-sidebar
'
;
import
{
mainRouter
}
from
'
@/router
'
;
//
import { StickySidebar } from '@/scripts/sticky-sidebar';
//
import { mainRouter } from '@/router';
//import MisskeyLogo from '@assets/client/misskey.svg';
import
{
defaultStore
}
from
'
@/store
'
;
import
{
instance
}
from
'
@/instance
'
;
import
{
i18n
}
from
'
@/i18n
'
;
export
default
defineComponent
({
components
:
{
MkButton
,
//MisskeyLogo,
},
const
WINDOW_THRESHOLD
=
1400
;
data
()
{
return
{
host
:
host
,
accounts
:
[],
connection
:
null
,
navbarItemDef
:
navbarItemDef
,
iconOnly
:
false
,
settingsWindowed
:
false
,
defaultStore
,
instance
,
$i
,
i18n
,
};
},
computed
:
{
menu
():
string
[]
{
return
this
.
defaultStore
.
state
.
menu
;
},
otherNavItemIndicated
():
boolean
{
for
(
const
def
in
this
.
navbarItemDef
)
{
if
(
this
.
menu
.
includes
(
def
))
continue
;
if
(
this
.
navbarItemDef
[
def
].
indicated
)
return
true
;
}
return
false
;
},
},
watch
:
{
'
defaultStore.reactiveState.menuDisplay.value
'
()
{
this
.
calcViewState
();
},
iconOnly
()
{
this
.
$nextTick
(()
=>
{
this
.
$emit
(
'
change-view-mode
'
);
});
},
},
created
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
calcViewState
);
this
.
calcViewState
();
},
mounted
()
{
const
sticky
=
new
StickySidebar
(
this
.
$el
.
parentElement
,
16
);
window
.
addEventListener
(
'
scroll
'
,
()
=>
{
sticky
.
calc
(
window
.
scrollY
);
},
{
passive
:
true
});
},
methods
:
{
openInstanceMenu
,
calcViewState
()
{
this
.
iconOnly
=
(
window
.
innerWidth
<=
1400
)
||
(
this
.
defaultStore
.
state
.
menuDisplay
===
'
sideIcon
'
);
this
.
settingsWindowed
=
(
window
.
innerWidth
>
1400
);
},
post
()
{
os
.
post
();
},
const
menu
=
$ref
(
defaultStore
.
state
.
menu
);
const
menuDisplay
=
computed
(
defaultStore
.
makeGetterSetter
(
'
menuDisplay
'
));
const
otherNavItemIndicated
=
computed
<
boolean
>
(()
=>
{
for
(
const
def
in
navbarItemDef
)
{
if
(
menu
.
includes
(
def
))
continue
;
if
(
navbarItemDef
[
def
].
indicated
)
return
true
;
}
return
false
;
});
let
el
=
$shallowRef
<
HTMLElement
>
();
// let accounts = $ref([]);
// let connection = $ref(null);
let
iconOnly
=
$ref
(
false
);
let
settingsWindowed
=
$ref
(
false
);
function
calcViewState
()
{
iconOnly
=
(
window
.
innerWidth
<=
WINDOW_THRESHOLD
)
||
(
menuDisplay
.
value
===
'
sideIcon
'
);
settingsWindowed
=
(
window
.
innerWidth
>
WINDOW_THRESHOLD
);
}
search
()
{
mainRouter
.
push
(
'
/search
'
);
},
function
more
(
ev
:
MouseEvent
)
{
os
.
popup
(
defineAsyncComponent
(()
=>
import
(
'
@/components/MkLaunchPad.vue
'
)),
{
src
:
ev
.
currentTarget
??
ev
.
target
,
},
{},
'
closed
'
);
}
more
(
ev
)
{
os
.
popup
(
defineAsyncComponent
(()
=>
import
(
'
@/components/MkLaunchPad.vue
'
)),
{
src
:
ev
.
currentTarget
??
ev
.
target
,
},
{},
'
closed
'
);
},
function
openAccountMenu
(
ev
:
MouseEvent
)
{
openAccountMenu_
(
{
withExtraOperation
:
true
,
},
ev
);
}
openAccountMenu
:
(
ev
)
=>
{
openAccountMenu
({
withExtraOperation
:
true
,
},
ev
);
},
},
watch
(
defaultStore
.
reactiveState
.
menuDisplay
,
()
=>
{
calcViewState
();
});
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
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