Improved share modal

This commit is contained in:
Prozilla 2024-05-01 17:25:18 +02:00
parent c8f3993238
commit b16690d317
No known key found for this signature in database
GPG key ID: 5858DFE71CAF31EE
5 changed files with 36 additions and 5 deletions

View file

@ -171,6 +171,8 @@ export function TextEditor({ file, setTitle, setIconUrl, close, mode, app, modal
"Zoom In": ["Control", "+"], "Zoom In": ["Control", "+"],
"Zoom Out": ["Control", "-"], "Zoom Out": ["Control", "-"],
"Reset Zoom": ["Control", "0"], "Reset Zoom": ["Control", "0"],
"Edit mode": ["Control v"],
"Preview mode": ["Control v"],
} }
}} }}
/> />

View file

@ -7,6 +7,9 @@ import AppsManager from "../../../features/apps/appsManager.js";
import utilStyles from "../../../styles/utils.module.css"; import utilStyles from "../../../styles/utils.module.css";
import { Button } from "../../_utils/button/Button.jsx"; import { Button } from "../../_utils/button/Button.jsx";
import Option from "./Option.jsx"; import Option from "./Option.jsx";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faSquare } from "@fortawesome/free-regular-svg-icons";
import { faSquareCheck } from "@fortawesome/free-solid-svg-icons";
const APP_OPTIONS = { const APP_OPTIONS = {
"terminal": [ "terminal": [
@ -94,10 +97,16 @@ export function Share({ modal, params, ...props }) {
)} )}
</select> </select>
</label> </label>
<label className={styles.Label}> {appId !== "" ? <label className={styles.Label}>
<p>Fullscreen:</p> <p>Fullscreen:</p>
<input className={styles.Input} name="fullscreen" type="checkbox" checked={fullscreen} value={fullscreen} onChange={onFullscreenChange}/> <input className={styles.Input} name="fullscreen" type="checkbox" checked={fullscreen} value={fullscreen} onChange={onFullscreenChange}/>
</label> <div className={styles.Checkbox}>
{fullscreen
? <FontAwesomeIcon icon={faSquareCheck}/>
: <FontAwesomeIcon icon={faSquare}/>
}
</div>
</label> : null}
{APP_OPTIONS[appId]?.map(({ label, name }) => {APP_OPTIONS[appId]?.map(({ label, name }) =>
<Option key={name} name={name} label={label} setOption={setOption}/> <Option key={name} name={name} label={label} setOption={setOption}/>
)} )}

View file

@ -74,8 +74,27 @@ select.Input > * {
} }
.Input[type=checkbox] { .Input[type=checkbox] {
background-color: var(--background-color-b); display: none;
outline: none; }
.Checkbox {
display: flex;
justify-content: center;
align-items: center;
width: 1.25rem;
height: 1.25rem;
cursor: pointer;
}
.Checkbox > svg {
width: 100%;
height: 100%;
object-fit: contain;
fill: var(--foreground-color-a);
}
.Checkbox > svg > * {
fill: inherit;
} }
.Url { .Url {

View file

@ -73,7 +73,7 @@ export const WindowView = memo(({ id, app, size, position, onInteract, options,
close(); close();
}}/> }}/>
<Divider/> <Divider/>
<ClickAction label={"Share"} icon={ModalsManager.getModalIconUrl("share")} onTrigger={() => { <ClickAction label={"Share"} icon={ModalsManager.getModalIconUrl("share")} shortcut={["Alt", "s"]} onTrigger={() => {
openWindowedModal({ openWindowedModal({
appId: app.id, appId: app.id,
fullscreen: maximized, fullscreen: maximized,

View file

@ -48,6 +48,7 @@ export function useShortcuts({ options, shortcuts, useCategories = true }) {
continue; continue;
event.preventDefault(); event.preventDefault();
event.stopPropagation();
if (!shortcut.includes(event.key) || !allowExecution) if (!shortcut.includes(event.key) || !allowExecution)
continue; continue;