mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
Merge pull request #81 from ragestudio/floating-sidebar
Floating sidebar
This commit is contained in:
commit
9fd62e41be
@ -15,6 +15,7 @@
|
|||||||
"postCard_expansible_actions": true,
|
"postCard_expansible_actions": true,
|
||||||
"feed_max_fetch": 20,
|
"feed_max_fetch": 20,
|
||||||
"style.compactMode": false,
|
"style.compactMode": false,
|
||||||
|
"sidebar.floating": false,
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"sidebarKeys": [
|
"sidebarKeys": [
|
||||||
"home",
|
"home",
|
||||||
|
@ -16,6 +16,16 @@ export default [
|
|||||||
"experimental": true,
|
"experimental": true,
|
||||||
"storaged": true
|
"storaged": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "sidebar.floating",
|
||||||
|
"title": "Floating Sidebar",
|
||||||
|
"description": "Make the sidebar floats over layout content.",
|
||||||
|
"component": "Switch",
|
||||||
|
"icon": "MdOutlineLastPage",
|
||||||
|
"group": "layout",
|
||||||
|
"emitEvent": "app.softReload",
|
||||||
|
"storaged": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "reduceAnimations",
|
"id": "reduceAnimations",
|
||||||
"storaged": true,
|
"storaged": true,
|
||||||
|
@ -123,6 +123,15 @@ class App extends React.Component {
|
|||||||
window.electron.ipcRenderer.invoke("app.minimize")
|
window.electron.ipcRenderer.invoke("app.minimize")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"app.reload": () => {
|
||||||
|
window.location.reload()
|
||||||
|
},
|
||||||
|
"app.softReload": () => {
|
||||||
|
this.forceUpdate()
|
||||||
|
|
||||||
|
app.eventBus.emit("layout.forceUpdate")
|
||||||
|
app.eventBus.emit("router.forceUpdate")
|
||||||
|
},
|
||||||
"app.openSearcher": () => {
|
"app.openSearcher": () => {
|
||||||
App.publicMethods.openSearcher()
|
App.publicMethods.openSearcher()
|
||||||
},
|
},
|
||||||
|
@ -227,6 +227,7 @@ export default class Sidebar extends React.Component {
|
|||||||
classnames(
|
classnames(
|
||||||
"app_sidebar",
|
"app_sidebar",
|
||||||
{
|
{
|
||||||
|
["floating"]: window.app?.settings.get("sidebar.floating"),
|
||||||
["collapsed"]: this.state.visible && this.state.collapsed,
|
["collapsed"]: this.state.visible && this.state.collapsed,
|
||||||
["elevated"]: this.state.visible && this.state.elevated,
|
["elevated"]: this.state.visible && this.state.elevated,
|
||||||
["hidden"]: !this.state.visible,
|
["hidden"]: !this.state.visible,
|
||||||
|
@ -25,6 +25,10 @@
|
|||||||
border-radius: 0 @app_sidebar_borderRadius @app_sidebar_borderRadius 0;
|
border-radius: 0 @app_sidebar_borderRadius @app_sidebar_borderRadius 0;
|
||||||
border: 1px solid var(--sidebar-background-color);
|
border: 1px solid var(--sidebar-background-color);
|
||||||
|
|
||||||
|
&.floating {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
&.collapsed {
|
&.collapsed {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
|
@ -224,7 +224,12 @@ export default class SidedrawerController extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div
|
return <div
|
||||||
className="sidedrawers-wrapper"
|
className={classnames(
|
||||||
|
"sidedrawers-wrapper",
|
||||||
|
{
|
||||||
|
["floating-sidebar"]: window.app?.settings.get("sidebar.floating")
|
||||||
|
}
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{this.state.drawers}
|
{this.state.drawers}
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,6 +3,12 @@
|
|||||||
.sidedrawers-wrapper {
|
.sidedrawers-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
|
||||||
|
&.floating-sidebar {
|
||||||
|
z-index: 950;
|
||||||
|
position: absolute;
|
||||||
|
margin-left: @app_sidebar_collapsed_width;
|
||||||
|
}
|
||||||
|
|
||||||
.sidedrawer {
|
.sidedrawer {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -49,6 +49,7 @@
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: "DM Mono", monospace;
|
font-family: "DM Mono", monospace;
|
||||||
align-self: start;
|
align-self: start;
|
||||||
|
font-size: 1rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,10 @@ const SettingItem = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.storaged) {
|
||||||
|
await window.app.settings.set(item.id, updateValue)
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof item.emitEvent === "string") {
|
if (typeof item.emitEvent === "string") {
|
||||||
let emissionPayload = updateValue
|
let emissionPayload = updateValue
|
||||||
|
|
||||||
@ -105,10 +109,6 @@ const SettingItem = (props) => {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.storaged) {
|
|
||||||
await window.app.settings.set(item.id, updateValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.debounced) {
|
if (item.debounced) {
|
||||||
setDelayedValue(null)
|
setDelayedValue(null)
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,9 @@ export default class Layout extends React.PureComponent {
|
|||||||
"app.initialization.finish": () => {
|
"app.initialization.finish": () => {
|
||||||
app.eventBus.emit("layout.render.unlock")
|
app.eventBus.emit("layout.render.unlock")
|
||||||
},
|
},
|
||||||
|
"layout.forceUpdate": () => {
|
||||||
|
this.forceUpdate()
|
||||||
|
},
|
||||||
"layout.render.lock": () => {
|
"layout.render.lock": () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
renderLock: true,
|
renderLock: true,
|
||||||
|
@ -12,13 +12,18 @@ export default (props) => {
|
|||||||
<Drawer />
|
<Drawer />
|
||||||
<Sidebar user={props.user} />
|
<Sidebar user={props.user} />
|
||||||
<Sidedrawer />
|
<Sidedrawer />
|
||||||
<Layout className="content_layout">
|
<Layout.Content className={
|
||||||
<Layout.Content className={classnames("layout_page", ...props.layoutPageModesClassnames ?? [])}>
|
classnames(
|
||||||
<div id="transitionLayer" className="fade-transverse-active">
|
"content_layout",
|
||||||
{React.cloneElement(props.children, props)}
|
...props.contentClassnames ?? [],
|
||||||
</div>
|
{
|
||||||
</Layout.Content>
|
["floating-sidebar"]: window.app?.settings.get("sidebar.floating")
|
||||||
</Layout>
|
}
|
||||||
|
)}>
|
||||||
|
<div id="transitionLayer" className="fade-transverse-active">
|
||||||
|
{React.cloneElement(props.children, props)}
|
||||||
|
</div>
|
||||||
|
</Layout.Content>
|
||||||
</Layout>
|
</Layout>
|
||||||
</>
|
</>
|
||||||
}
|
}
|
@ -160,30 +160,29 @@ html {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-layout,
|
|
||||||
.content_layout {
|
.content_layout {
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
max-height: 100vh;
|
|
||||||
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout_page {
|
|
||||||
position: relative;
|
position: relative;
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
max-height: 100vh;
|
||||||
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: overlay;
|
overflow-y: overlay;
|
||||||
|
|
||||||
transition: all 150ms ease-in-out;
|
transition: all 150ms ease-in-out;
|
||||||
|
|
||||||
margin: var(--layoutMargin);
|
margin: var(--layoutMargin);
|
||||||
padding: var(--layoutPadding);
|
padding: var(--layoutPadding);
|
||||||
|
|
||||||
|
background-color: transparent;
|
||||||
|
|
||||||
|
&.floating-sidebar {
|
||||||
|
margin-left: @app_sidebar_collapsed_width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.app_background_decorator {
|
.app_background_decorator {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user