feat: add column element

This commit is contained in:
Paul Makles 2022-05-30 16:15:52 +01:00
parent 906f15f103
commit 81bf325990
7 changed files with 140 additions and 122 deletions

View file

@ -90,7 +90,7 @@
"@hcaptcha/react-hcaptcha": "^0.3.6",
"@insertish/vite-plugin-babel-macros": "^1.0.5",
"@preact/preset-vite": "^2.0.0",
"@revoltchat/ui": "1.0.35",
"@revoltchat/ui": "1.0.36",
"@rollup/plugin-replace": "^2.4.2",
"@styled-icons/boxicons-logos": "^10.38.0",
"@styled-icons/boxicons-regular": "^10.38.0",

View file

@ -3,8 +3,9 @@ import { observer } from "mobx-react-lite";
import styles from "./Panes.module.scss";
import { Text } from "preact-i18n";
import CollapsibleSection from "../../../components/common/CollapsibleSection";
import { Column } from "@revoltchat/ui";
import CollapsibleSection from "../../../components/common/CollapsibleSection";
import {
ThemeBaseSelectorShim,
ThemeShopShim,
@ -37,8 +38,10 @@ export const Appearance = observer(() => {
<h3>
<Text id="app.settings.pages.appearance.theme_options.title" />
</h3>
<Column>
<DisplayTransparencyShim />
<DisplaySeasonalShim />
</Column>
<hr />
<DisplayFontShim />
<DisplayLigaturesShim />

View file

@ -3,7 +3,7 @@ import { observer } from "mobx-react-lite";
import styles from "./Panes.module.scss";
import { Text } from "preact-i18n";
import { Checkbox } from "@revoltchat/ui";
import { Checkbox, Column } from "@revoltchat/ui";
import { useApplicationState } from "../../../mobx/State";
import {
@ -19,15 +19,19 @@ export const ExperimentsPage = observer(() => {
<h3>
<Text id="app.settings.pages.experiments.features" />
</h3>
<Column>
{AVAILABLE_EXPERIMENTS.map((key) => (
<Checkbox
key={key}
value={experiments.isEnabled(key)}
onChange={(enabled) => experiments.setEnabled(key, enabled)}
onChange={(enabled) =>
experiments.setEnabled(key, enabled)
}
description={EXPERIMENTS[key].description}
title={EXPERIMENTS[key].title}
/>
))}
</Column>
{AVAILABLE_EXPERIMENTS.length === 0 && (
<div className={styles.empty}>
<Text id="app.settings.pages.experiments.not_available" />

View file

@ -4,7 +4,7 @@ import styles from "./Panes.module.scss";
import { Text } from "preact-i18n";
import { useContext, useEffect, useState } from "preact/hooks";
import { Checkbox } from "@revoltchat/ui";
import { Checkbox, Column } from "@revoltchat/ui";
import { urlBase64ToUint8Array } from "../../../lib/conversion";
@ -36,6 +36,7 @@ export const Notifications = observer(() => {
<h3>
<Text id="app.settings.pages.notifications.push_notifications" />
</h3>
<Column>
<Checkbox
disabled={!("Notification" in window)}
value={settings.get("notifications:desktop", false)!}
@ -76,12 +77,15 @@ export const Notifications = observer(() => {
await navigator.serviceWorker?.getRegistration();
if (reg) {
if (pushEnabled) {
const sub = await reg.pushManager.subscribe({
const sub = await reg.pushManager.subscribe(
{
userVisibleOnly: true,
applicationServerKey: urlBase64ToUint8Array(
applicationServerKey:
urlBase64ToUint8Array(
client.configuration!.vapid,
),
});
},
);
// tell the server we just subscribed
const json = sub.toJSON();
@ -109,9 +113,11 @@ export const Notifications = observer(() => {
}
}}
/>
</Column>
<h3>
<Text id="app.settings.pages.notifications.sounds" />
</h3>
<Column>
{settings.sounds.getState().map(({ id, enabled }) => (
<Checkbox
key={id}
@ -126,6 +132,7 @@ export const Notifications = observer(() => {
}
/>
))}
</Column>
</div>
);
});

View file

@ -481,6 +481,8 @@
border-radius: var(--border-radius);
margin-top: 0;
transition: 0.1s ease background-color;
&:hover {
background: var(--secondary-background);
}

View file

@ -3,7 +3,7 @@ import { observer } from "mobx-react-lite";
import styles from "./Panes.module.scss";
import { Text } from "preact-i18n";
import { Checkbox } from "@revoltchat/ui";
import { Checkbox, Column } from "@revoltchat/ui";
import { useApplicationState } from "../../../mobx/State";
import { SyncKeys } from "../../../mobx/stores/Sync";
@ -20,6 +20,7 @@ export const Sync = observer(() => {
<h3>
<Text id="app.settings.pages.sync.categories" />
</h3>
<Column>
{(
[
["appearance", "appearance.title"],
@ -40,6 +41,7 @@ export const Sync = observer(() => {
onChange={() => sync.toggle(key)}
/>
))}
</Column>
{/*<h5 style={{ marginTop: "20px", color: "grey" }}>
Last sync at 12:00
</h5>*/}

View file

@ -2220,9 +2220,9 @@ __metadata:
languageName: node
linkType: hard
"@revoltchat/ui@npm:1.0.35":
version: 1.0.35
resolution: "@revoltchat/ui@npm:1.0.35"
"@revoltchat/ui@npm:1.0.36":
version: 1.0.36
resolution: "@revoltchat/ui@npm:1.0.36"
dependencies:
"@styled-icons/boxicons-logos": ^10.38.0
"@styled-icons/boxicons-regular": ^10.38.0
@ -2235,7 +2235,7 @@ __metadata:
react-device-detect: "*"
react-virtuoso: "*"
revolt.js: "*"
checksum: 39831a463f030b1361401270b8d1d10c18b28c964b878083784544902e62682ddee0634fe087af99437963d24b585ac680d8b7c2df0d298bffb3bddc140a52ac
checksum: 97eee93df28f2ca826c7cb1493e3c0efe0ab83d3ef8ea3d3ec013ff3b527f2692193ef50c8e44d144f96d49457c4d290a4dc708a38ab527f3a4290e0d05b41b5
languageName: node
linkType: hard
@ -3521,7 +3521,7 @@ __metadata:
"@hcaptcha/react-hcaptcha": ^0.3.6
"@insertish/vite-plugin-babel-macros": ^1.0.5
"@preact/preset-vite": ^2.0.0
"@revoltchat/ui": 1.0.35
"@revoltchat/ui": 1.0.36
"@rollup/plugin-replace": ^2.4.2
"@styled-icons/boxicons-logos": ^10.38.0
"@styled-icons/boxicons-regular": ^10.38.0