fix(settings): small bug fixes

This commit is contained in:
trashtemp 2021-12-24 14:26:07 +01:00
parent cc76e78db8
commit bba9689e30
No known key found for this signature in database
GPG key ID: D1F0DB65081B0FC6
9 changed files with 97 additions and 37 deletions

2
external/lang vendored

@ -1 +1 @@
Subproject commit 026f884b54f515d3e47f2dbd410c2386b5fa68a9 Subproject commit 93ba149e7e4ad45438750d228c97bd320fbb4f6c

View file

@ -21,7 +21,7 @@ export default styled.button<Props>`
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 2px 16px; padding: 2px 16px;
font-size: 0.875rem; font-size: 0.8125rem;
font-family: inherit; font-family: inherit;
font-weight: 500; font-weight: 500;
flex-shrink: 0; flex-shrink: 0;

View file

@ -61,29 +61,63 @@ const ModalBase = styled.div`
} }
`; `;
const ModalContainer = styled.div` const ModalContainer = styled.div<
{
[key in "userProfile"]?: boolean;
}
>`
overflow: hidden; overflow: hidden;
max-width: calc(100vw - 20px); padding: 12px;
width: 100%;
max-width: 440px;
border-radius: var(--border-radius); border-radius: var(--border-radius);
animation-name: ${zoomIn}; animation-name: ${zoomIn};
animation-duration: 0.25s; animation-duration: 0.25s;
animation-timing-function: cubic-bezier(0.3, 0.3, 0.18, 1.1); animation-timing-function: cubic-bezier(0.3, 0.3, 0.18, 1.1);
${(props) =>
!props.userProfile &&
css`
max-width: max-content;
`}
`; `;
const ModalContent = styled.div< const ModalContent = styled.div<
{ [key in "attachment" | "noBackground" | "border" | "padding"]?: boolean } {
[key in
| "attachment"
| "noBackground"
| "border"
| "padding"
| "userProfile"]?: boolean;
}
>` >`
text-overflow: ellipsis; text-overflow: ellipsis;
border-radius: var(--border-radius); border-radius: var(--border-radius);
.title {
font-size: 14px;
text-decoration: underline;
}
h3 { h3 {
font-size: 14px;
text-transform: uppercase;
margin-top: 0; margin-top: 0;
} }
form { form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8px;
> div {
margin: 0;
color: var(--secondary-foreground);
font-size: 12px;
}
} }
${(props) => ${(props) =>
@ -95,7 +129,7 @@ const ModalContent = styled.div<
${(props) => ${(props) =>
props.padding && props.padding &&
css` css`
padding: 1.5em; padding: 1rem;
`} `}
${(props) => ${(props) =>
@ -117,7 +151,7 @@ const ModalActions = styled.div`
display: flex; display: flex;
flex-direction: row-reverse; flex-direction: row-reverse;
padding: 1em 1.5em; padding: 1rem;
background: var(--secondary-background); background: var(--secondary-background);
border-radius: 0 0 var(--border-radius) var(--border-radius); border-radius: 0 0 var(--border-radius) var(--border-radius);
`; `;
@ -131,6 +165,7 @@ interface Props {
children?: Children; children?: Children;
title?: Children; title?: Children;
userProfile?: boolean;
disallowClosing?: boolean; disallowClosing?: boolean;
noBackground?: boolean; noBackground?: boolean;
dontModal?: boolean; dontModal?: boolean;
@ -152,6 +187,7 @@ export default function Modal(props: Props) {
<ModalContent <ModalContent
attachment={!!props.actions} attachment={!!props.actions}
noBackground={props.noBackground} noBackground={props.noBackground}
userProfile={props.userProfile}
border={props.border} border={props.border}
padding={props.padding ?? !props.dontModal}> padding={props.padding ?? !props.dontModal}>
{props.title && <h3>{props.title}</h3>} {props.title && <h3>{props.title}</h3>}
@ -209,7 +245,9 @@ export default function Modal(props: Props) {
<ModalBase <ModalBase
className={animateClose ? "closing" : undefined} className={animateClose ? "closing" : undefined}
onClick={(!props.disallowClosing && props.onClose) || undefined}> onClick={(!props.disallowClosing && props.onClose) || undefined}>
<ModalContainer onClick={(e) => (e.cancelBubble = true)}> <ModalContainer
onClick={(e) => (e.cancelBubble = true)}
userProfile={false}>
{content} {content}
{props.actions && ( {props.actions && (
<ModalActions> <ModalActions>

View file

@ -146,7 +146,6 @@ export default function CategoryButton({
{icon} {icon}
<div class="content"> <div class="content">
<div className="title">{children}</div> <div className="title">{children}</div>
<div className="description">{description}</div> <div className="description">{description}</div>
</div> </div>
<div class="action"> <div class="action">

View file

@ -72,6 +72,7 @@
.small { .small {
display: flex; display: flex;
align-items: center;
font-size: 10px; font-size: 10px;
flex-direction: column; flex-direction: column;
color: var(--tertiary-foreground); color: var(--tertiary-foreground);

View file

@ -20,33 +20,39 @@ type BehaviourType =
| { behaviour: "ask"; onChange: (file: File) => void } | { behaviour: "ask"; onChange: (file: File) => void }
| { behaviour: "upload"; onUpload: (id: string) => Promise<void> } | { behaviour: "upload"; onUpload: (id: string) => Promise<void> }
| { | {
behaviour: "multi"; behaviour: "multi";
onChange: (files: File[]) => void; onChange: (files: File[]) => void;
append?: (files: File[]) => void; append?: (files: File[]) => void;
} };
type StyleType = type StyleType =
| { | {
style: "icon" | "banner"; style: "icon" | "banner";
width?: number; width?: number;
height?: number; height?: number;
previewURL?: string; previewURL?: string;
defaultPreview?: string; defaultPreview?: string;
desaturateDefault?: boolean desaturateDefault?: boolean;
} }
| { | {
style: "attachment"; style: "attachment";
attached: boolean; attached: boolean;
uploading: boolean; uploading: boolean;
cancel: () => void; cancel: () => void;
size?: number; size?: number;
} };
type Props = BehaviourType & StyleType & { type Props = BehaviourType &
fileType: "backgrounds" | "icons" | "avatars" | "attachments" | "banners"; StyleType & {
maxFileSize: number; fileType:
remove: () => Promise<void>; | "backgrounds"
} | "icons"
| "avatars"
| "attachments"
| "banners";
maxFileSize: number;
remove: () => Promise<void>;
};
export async function uploadFile( export async function uploadFile(
autumnURL: string, autumnURL: string,
@ -226,14 +232,19 @@ export function FileUploader(props: Props) {
})} })}
data-uploading={uploading}> data-uploading={uploading}>
<div <div
className={classNames(styles.image, props.desaturateDefault && previewURL == null && styles.desaturate)} className={classNames(
styles.image,
props.desaturateDefault &&
previewURL == null &&
styles.desaturate,
)}
style={{ style={{
backgroundImage: backgroundImage:
style === "icon" style === "icon"
? `url('${previewURL ?? defaultPreview}')` ? `url('${previewURL ?? defaultPreview}')`
: previewURL : previewURL
? `linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('${previewURL}')` ? `linear-gradient( rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url('${previewURL}')`
: "none", : "none",
width, width,
height, height,
}} }}

View file

@ -56,12 +56,13 @@ import { Sync } from "./panes/Sync";
import { ThemeShop } from "./panes/ThemeShop"; import { ThemeShop } from "./panes/ThemeShop";
const IndexHeader = styled.div` const IndexHeader = styled.div`
display: flex; /*display: flex;*/
background: var(--secondary-background); background: var(--secondary-background);
border-radius: var(--border-radius); border-radius: var(--border-radius);
padding: 20px; padding: 20px;
align-items: center; align-items: center;
gap: 10px; gap: 10px;
display: none;
`; `;
export default function Settings() { export default function Settings() {

View file

@ -232,7 +232,7 @@ export function Sessions() {
}}> }}>
<Text id="app.settings.pages.sessions.logout" /> <Text id="app.settings.pages.sessions.logout" />
</Button>*/} </Button>*/}
<hr />
<CategoryButton <CategoryButton
onClick={async () => { onClick={async () => {
// ! FIXME: add to rAuth // ! FIXME: add to rAuth

View file

@ -49,6 +49,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
flex-direction: row; flex-direction: row;
border-radius: var(--border-radius);
background: var(--secondary-background); background: var(--secondary-background);
span, span,
@ -76,6 +77,9 @@
} }
} }
.invite {
}
.member { .member {
cursor: pointer; cursor: pointer;
@ -95,12 +99,18 @@
.virtual { .virtual {
flex-grow: 1; flex-grow: 1;
> div > div > div {
display: flex;
flex-direction: column;
gap: 8px;
flex-grow: 1;
}
} }
} }
.roles { .roles {
gap: 12px; gap: 12px;
height: 100%; height: auto;
display: flex; display: flex;
.list { .list {