mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
improve search for mobile (not fix)
This commit is contained in:
parent
156c3e4220
commit
ef27900934
@ -180,6 +180,7 @@ class ComtyApp extends React.Component {
|
|||||||
sessionController: this.sessionController,
|
sessionController: this.sessionController,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
fillEnd: true,
|
||||||
bodyStyle: {
|
bodyStyle: {
|
||||||
height: "100%",
|
height: "100%",
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// © Jack Hanford https://github.com/hanford/react-drag-drawer
|
// © Jack Hanford https://github.com/hanford/react-drag-drawer
|
||||||
import React, { Component } from "react"
|
import React, { Component } from "react"
|
||||||
import { Motion, spring, presets } from "react-motion"
|
import { Motion, spring, presets } from "react-motion"
|
||||||
|
import classnames from "classnames"
|
||||||
import PropTypes from "prop-types"
|
import PropTypes from "prop-types"
|
||||||
import document from "global/document"
|
import document from "global/document"
|
||||||
import Observer from "react-intersection-observer"
|
import Observer from "react-intersection-observer"
|
||||||
@ -329,8 +330,13 @@ export default class DraggableDrawer extends Component {
|
|||||||
id={id}
|
id={id}
|
||||||
style={containerStyle}
|
style={containerStyle}
|
||||||
onMouseDown={this.onClickOutside}
|
onMouseDown={this.onClickOutside}
|
||||||
className="draggable-drawer"
|
|
||||||
ref={getContainerRef}
|
ref={getContainerRef}
|
||||||
|
className={classnames(
|
||||||
|
"draggable-drawer",
|
||||||
|
{
|
||||||
|
["fill-end"]: this.props.fillEnd
|
||||||
|
}
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
<Observer
|
<Observer
|
||||||
className={HaveWeScrolled}
|
className={HaveWeScrolled}
|
||||||
|
@ -15,12 +15,15 @@
|
|||||||
z-index: 40;
|
z-index: 40;
|
||||||
|
|
||||||
transition: background-color 0.2s linear;
|
transition: background-color 0.2s linear;
|
||||||
|
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
overscroll-behavior: none;
|
overscroll-behavior: none;
|
||||||
|
|
||||||
.draggable-drawer_body {
|
.draggable-drawer_body {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
|
z-index: 50;
|
||||||
|
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -29,20 +32,21 @@
|
|||||||
height: fit-content;
|
height: fit-content;
|
||||||
max-height: 90%;
|
max-height: 90%;
|
||||||
|
|
||||||
padding: 30px 10px 10px 10px;
|
|
||||||
|
|
||||||
background-color: var(--background-color-primary);
|
background-color: var(--background-color-primary);
|
||||||
|
|
||||||
|
padding: 30px 10px 10px 10px;
|
||||||
|
|
||||||
border-top-left-radius: 8px;
|
border-top-left-radius: 8px;
|
||||||
border-top-right-radius: 8px;
|
border-top-right-radius: 8px;
|
||||||
z-index: 50;
|
|
||||||
|
|
||||||
.dragger-area {
|
.dragger-area {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 50px;
|
height: 50px;
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|
||||||
@ -59,12 +63,14 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.draggable-drawer_body {
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
|
|
||||||
display: block;
|
display: block;
|
||||||
position: fixed;
|
position: absolute;
|
||||||
|
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@ -79,4 +85,27 @@
|
|||||||
transform: translateY(95%);
|
transform: translateY(95%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.fill-end {
|
||||||
|
.draggable-drawer_body {
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
height: 120px;
|
||||||
|
|
||||||
|
z-index: 45;
|
||||||
|
|
||||||
|
background-color: var(--background-color-primary);
|
||||||
|
|
||||||
|
transform: translateY(95%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -154,7 +154,9 @@ export default (props) => {
|
|||||||
if (typeof props.model === "function") {
|
if (typeof props.model === "function") {
|
||||||
result = await props.model(value)
|
result = await props.model(value)
|
||||||
} else {
|
} else {
|
||||||
result = await SearchModel.search(value)
|
result = await SearchModel.search(value, {
|
||||||
|
limit_per_section: app.isMobile ? 3 : 5
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof props.onSearchResult === "function") {
|
if (typeof props.onSearchResult === "function") {
|
||||||
|
@ -1,3 +1,53 @@
|
|||||||
|
html {
|
||||||
|
&.mobile {
|
||||||
|
.searcher {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
.searcher_results {
|
||||||
|
display: flex;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
overflow-y: scroll;
|
||||||
|
|
||||||
|
.searcher_results_category {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
gap: 5px;
|
||||||
|
|
||||||
|
.searcher_results_category_header {
|
||||||
|
font-size: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.searcher_results_category_suggestions {
|
||||||
|
padding: 0 15px;
|
||||||
|
|
||||||
|
&#playlists {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.playlistItem {
|
||||||
|
width: 100%;
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.searcher {
|
.searcher {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
@ -14,6 +64,8 @@
|
|||||||
.results {
|
.results {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
overflow-y: overlay;
|
overflow-y: overlay;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ export default {
|
|||||||
route: "/",
|
route: "/",
|
||||||
middlewares: ["withOptionalAuthentication"],
|
middlewares: ["withOptionalAuthentication"],
|
||||||
fn: async (req, res) => {
|
fn: async (req, res) => {
|
||||||
const { keywords = "" } = req.query
|
const { keywords = "", params } = req.query
|
||||||
|
|
||||||
let suggestions = {}
|
let suggestions = {}
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ export default {
|
|||||||
{ fullName: { $regex: keywords, $options: "i" } },
|
{ fullName: { $regex: keywords, $options: "i" } },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
limit: 5,
|
limit: params.limit_per_section ?? 5,
|
||||||
select: "username fullName avatar verified",
|
select: "username fullName avatar verified",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -31,7 +31,7 @@ export default {
|
|||||||
{ title: { $regex: keywords, $options: "i" } },
|
{ title: { $regex: keywords, $options: "i" } },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
limit: 5,
|
limit: params.limit_per_section ?? 5,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "tracks",
|
id: "tracks",
|
||||||
@ -43,7 +43,7 @@ export default {
|
|||||||
{ album: { $regex: keywords, $options: "i" } },
|
{ album: { $regex: keywords, $options: "i" } },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
limit: 5,
|
limit: params.limit_per_section ?? 5,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user