Rework task pane UI and document design guidelines
- Add a header, a shared accordion, a docked status region, and token-based styles - Use the blue primary style for every action button and collapse all sections by default - Improve labels, selection hints, destructive confirmations, grid semantics, and narrow-pane layout - Add docs/UI_GUIDELINES.md and update the README, user guide, and developer guide
This commit is contained in:
1 parent
89989c04e9
commit
e223dc61c8
23 files changed
+719
-549
No files matched your search
@@ -6,11 +6,16 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import {
|
||||
Button,
|
||||
makeStyles
|
||||
import {
|
||||
makeStyles,
|
||||
Text,
|
||||
tokens,
|
||||
Toolbar,
|
||||
ToolbarButton,
|
||||
ToolbarDivider,
|
||||
Tooltip
|
||||
} from "@fluentui/react-components";
|
||||
import {
|
||||
import {
|
||||
TextAlignLeftRegular,
|
||||
TextAlignCenterRegular,
|
||||
TextAlignRightRegular,
|
||||
@@ -39,42 +44,57 @@ type VerticalAlignmentType = 'top' | 'middle' | 'bottom';
|
||||
* Component-specific styles
|
||||
*/
|
||||
const useStyles = makeStyles({
|
||||
alignmentGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(3, 1fr)",
|
||||
gap: "8px",
|
||||
width: "100%"
|
||||
},
|
||||
alignButton: {
|
||||
toolbar: {
|
||||
width: "100%",
|
||||
minWidth: 0,
|
||||
padding: "8px 4px",
|
||||
"& span": {
|
||||
justifyContent: "center"
|
||||
}
|
||||
flexWrap: "wrap",
|
||||
gap: tokens.spacingHorizontalXS,
|
||||
padding: 0,
|
||||
backgroundColor: "transparent"
|
||||
}
|
||||
});
|
||||
|
||||
interface AlignButtonProps {
|
||||
label: string;
|
||||
icon: React.ReactElement;
|
||||
disabled: boolean;
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Icon-only alignment button with a tooltip that doubles as its accessible name.
|
||||
*/
|
||||
const AlignButton: React.FC<AlignButtonProps> = ({ label, icon, disabled, onClick }) => (
|
||||
<Tooltip content={label} relationship="description">
|
||||
<ToolbarButton
|
||||
appearance="primary"
|
||||
aria-label={label}
|
||||
icon={icon}
|
||||
disabled={disabled}
|
||||
onClick={onClick}
|
||||
/>
|
||||
</Tooltip>
|
||||
);
|
||||
|
||||
/**
|
||||
* AlignmentButtons component provides UI and functionality to align
|
||||
* selected shapes in PowerPoint presentations.
|
||||
*
|
||||
*
|
||||
* @returns React component
|
||||
*/
|
||||
export const AlignmentButtons: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const commonStyles = useCommonStyles();
|
||||
const { slideSize } = useSettings();
|
||||
const {
|
||||
const {
|
||||
setStatusMessage,
|
||||
setStatusType,
|
||||
isProcessing,
|
||||
isProcessing,
|
||||
setIsProcessing
|
||||
} = useStatusContext();
|
||||
|
||||
/**
|
||||
* Handles errors and updates the status message
|
||||
*
|
||||
*
|
||||
* @param error - The error object
|
||||
* @param operation - The operation being performed (for logging)
|
||||
*/
|
||||
@@ -86,7 +106,7 @@ export const AlignmentButtons: React.FC = () => {
|
||||
|
||||
/**
|
||||
* Generic function to handle horizontal alignment of shapes
|
||||
*
|
||||
*
|
||||
* @param alignmentType - The type of horizontal alignment to apply
|
||||
*/
|
||||
const handleHorizontalAlignment = async (alignmentType: HorizontalAlignmentType): Promise<void> => {
|
||||
@@ -142,7 +162,7 @@ export const AlignmentButtons: React.FC = () => {
|
||||
|
||||
/**
|
||||
* Generic function to handle vertical alignment of shapes
|
||||
*
|
||||
*
|
||||
* @param alignmentType - The type of vertical alignment to apply
|
||||
*/
|
||||
const handleVerticalAlignment = async (alignmentType: VerticalAlignmentType): Promise<void> => {
|
||||
@@ -240,68 +260,48 @@ export const AlignmentButtons: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={commonStyles.container}>
|
||||
<div className={styles.alignmentGrid}>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.alignButton}
|
||||
onClick={alignTop}
|
||||
icon={<TextboxAlignTopRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Align Top"
|
||||
>
|
||||
Top
|
||||
</Button>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.alignButton}
|
||||
onClick={alignMiddle}
|
||||
icon={<TextboxAlignMiddleRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Align Middle"
|
||||
>
|
||||
Middle
|
||||
</Button>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.alignButton}
|
||||
onClick={alignBottom}
|
||||
icon={<TextboxAlignBottomRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Align Bottom"
|
||||
>
|
||||
Bottom
|
||||
</Button>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.alignButton}
|
||||
onClick={alignLeft}
|
||||
<Text size={200} className={commonStyles.hint}>
|
||||
Select objects on the slide, then align them to the slide edges or center.
|
||||
</Text>
|
||||
<Toolbar aria-label="Align selected objects" className={styles.toolbar}>
|
||||
<AlignButton
|
||||
label="Align left"
|
||||
icon={<TextAlignLeftRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Align Left"
|
||||
>
|
||||
Left
|
||||
</Button>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.alignButton}
|
||||
onClick={alignCenter}
|
||||
onClick={alignLeft}
|
||||
/>
|
||||
<AlignButton
|
||||
label="Align center"
|
||||
icon={<TextAlignCenterRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Align Center"
|
||||
>
|
||||
Center
|
||||
</Button>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.alignButton}
|
||||
onClick={alignRight}
|
||||
onClick={alignCenter}
|
||||
/>
|
||||
<AlignButton
|
||||
label="Align right"
|
||||
icon={<TextAlignRightRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Align Right"
|
||||
>
|
||||
Right
|
||||
</Button>
|
||||
</div>
|
||||
onClick={alignRight}
|
||||
/>
|
||||
<ToolbarDivider />
|
||||
<AlignButton
|
||||
label="Align top"
|
||||
icon={<TextboxAlignTopRegular />}
|
||||
disabled={isProcessing}
|
||||
onClick={alignTop}
|
||||
/>
|
||||
<AlignButton
|
||||
label="Align middle"
|
||||
icon={<TextboxAlignMiddleRegular />}
|
||||
disabled={isProcessing}
|
||||
onClick={alignMiddle}
|
||||
/>
|
||||
<AlignButton
|
||||
label="Align bottom"
|
||||
icon={<TextboxAlignBottomRegular />}
|
||||
disabled={isProcessing}
|
||||
onClick={alignBottom}
|
||||
/>
|
||||
</Toolbar>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
+167
-114
@@ -19,9 +19,11 @@ import AlignmentButtons from "./AlignmentButtons";
|
||||
import GridGuidelineManager from "./GridGuidelineManager";
|
||||
import Section from "./Section";
|
||||
import {
|
||||
Accordion,
|
||||
Button,
|
||||
Dropdown,
|
||||
Field,
|
||||
Image,
|
||||
makeStyles,
|
||||
Option,
|
||||
ProgressBar as FluentProgressBar,
|
||||
@@ -48,23 +50,58 @@ const useStyles = makeStyles({
|
||||
root: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
padding: "16px",
|
||||
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
|
||||
backgroundColor: tokens.colorNeutralBackground1,
|
||||
overflow: "auto",
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0
|
||||
height: "100%",
|
||||
overflow: "hidden",
|
||||
fontFamily: tokens.fontFamilyBase,
|
||||
backgroundColor: tokens.colorNeutralBackground1
|
||||
},
|
||||
header: {
|
||||
display: "flex",
|
||||
flexShrink: 0,
|
||||
alignItems: "center",
|
||||
gap: tokens.spacingHorizontalS,
|
||||
padding: `${tokens.spacingVerticalM} ${tokens.spacingHorizontalL}`,
|
||||
borderBottomWidth: "1px",
|
||||
borderBottomStyle: "solid",
|
||||
borderBottomColor: tokens.colorNeutralStroke2
|
||||
},
|
||||
headerText: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
minWidth: 0
|
||||
},
|
||||
muted: {
|
||||
color: tokens.colorNeutralForeground3
|
||||
},
|
||||
scrollArea: {
|
||||
flex: 1,
|
||||
overflowY: "auto",
|
||||
overflowX: "hidden",
|
||||
padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalL} ${tokens.spacingVerticalL}`
|
||||
},
|
||||
accordion: {
|
||||
width: "100%"
|
||||
},
|
||||
dropdown: {
|
||||
width: "100%"
|
||||
},
|
||||
about: {
|
||||
paddingTop: tokens.spacingVerticalS
|
||||
},
|
||||
statusDock: {
|
||||
flexShrink: 0
|
||||
},
|
||||
statusDockActive: {
|
||||
padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalL}`,
|
||||
borderTopWidth: "1px",
|
||||
borderTopStyle: "solid",
|
||||
borderTopColor: tokens.colorNeutralStroke2,
|
||||
backgroundColor: tokens.colorNeutralBackground2
|
||||
},
|
||||
statusContainer: {
|
||||
marginTop: "4px",
|
||||
padding: "8px 12px",
|
||||
fontSize: "13px",
|
||||
borderRadius: "6px",
|
||||
backgroundColor: tokens.colorNeutralBackground3,
|
||||
transition: "all 0.3s ease"
|
||||
padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS}`,
|
||||
borderRadius: tokens.borderRadiusMedium,
|
||||
backgroundColor: tokens.colorNeutralBackground3
|
||||
},
|
||||
infoStatus: {
|
||||
backgroundColor: tokens.colorBrandBackground2,
|
||||
@@ -82,22 +119,18 @@ const useStyles = makeStyles({
|
||||
backgroundColor: tokens.colorPaletteRedBackground1,
|
||||
color: tokens.colorPaletteRedForeground1
|
||||
},
|
||||
statusIcon: {
|
||||
marginRight: "8px"
|
||||
},
|
||||
statusText: {
|
||||
display: "flex",
|
||||
alignItems: "center"
|
||||
alignItems: "center",
|
||||
gap: tokens.spacingHorizontalS
|
||||
},
|
||||
progressBar: {
|
||||
marginTop: "8px"
|
||||
marginTop: tokens.spacingVerticalS
|
||||
},
|
||||
footer: {
|
||||
fontSize: "12px",
|
||||
color: tokens.colorNeutralForeground3,
|
||||
textAlign: "center",
|
||||
marginTop: "auto",
|
||||
padding: "8px 0"
|
||||
stopRow: {
|
||||
display: "flex",
|
||||
justifyContent: "flex-end",
|
||||
marginTop: tokens.spacingVerticalXS
|
||||
}
|
||||
});
|
||||
|
||||
@@ -132,16 +165,18 @@ const App: React.FC = () => {
|
||||
const getStatusIcon = () => {
|
||||
switch (statusType) {
|
||||
case "success":
|
||||
return <CheckmarkCircleRegular className={styles.statusIcon} />;
|
||||
return <CheckmarkCircleRegular />;
|
||||
case "warning":
|
||||
return <WarningRegular className={styles.statusIcon} />;
|
||||
return <WarningRegular />;
|
||||
case "error":
|
||||
return <ErrorCircleRegular className={styles.statusIcon} />;
|
||||
return <ErrorCircleRegular />;
|
||||
default:
|
||||
return <InfoRegular className={styles.statusIcon} />;
|
||||
return <InfoRegular />;
|
||||
}
|
||||
};
|
||||
|
||||
const hasStatus = isProcessing || Boolean(statusMessage);
|
||||
|
||||
return (
|
||||
<StatusContext.Provider value={{
|
||||
statusMessage,
|
||||
@@ -154,94 +189,112 @@ const App: React.FC = () => {
|
||||
setProgress
|
||||
}}>
|
||||
<div className={styles.root}>
|
||||
<Section title="Content">
|
||||
<MatchProperties />
|
||||
<div style={{ marginTop: "8px" }}></div>
|
||||
<MatchSizes />
|
||||
<div style={{ marginTop: "8px" }}></div>
|
||||
<SwapPositions />
|
||||
<div style={{ marginTop: "8px" }}></div>
|
||||
<InsertTitles />
|
||||
<div style={{ marginTop: "8px" }}></div>
|
||||
<RoundImage />
|
||||
</Section>
|
||||
|
||||
<Section title="Progress Bar">
|
||||
<ProgressBarButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Confidential Marking">
|
||||
<ConfidentialButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Draft Watermark">
|
||||
<DraftButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Alignment">
|
||||
<AlignmentButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Layout">
|
||||
<GridGuidelineManager />
|
||||
</Section>
|
||||
|
||||
<Section title="Settings">
|
||||
<Field label="Slide size">
|
||||
<Dropdown
|
||||
value={SLIDE_SIZE_LABELS[slideSizePreset]}
|
||||
selectedOptions={[slideSizePreset]}
|
||||
onOptionSelect={(_, data) => {
|
||||
if (data.optionValue === "widescreen" || data.optionValue === "standard") {
|
||||
setSlideSizePreset(data.optionValue);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Option value="widescreen">{SLIDE_SIZE_LABELS.widescreen}</Option>
|
||||
<Option value="standard">{SLIDE_SIZE_LABELS.standard}</Option>
|
||||
</Dropdown>
|
||||
</Field>
|
||||
</Section>
|
||||
|
||||
{/* Status message area at the bottom */}
|
||||
{isProcessing && (
|
||||
<div className={styles.statusContainer} role="status" aria-live="polite">
|
||||
<div className={styles.statusText}>
|
||||
<Spinner size="tiny" style={{ marginRight: "8px" }} />
|
||||
{progress ? `Processing ${progress.current} / ${progress.total}...` : "Processing..."}
|
||||
</div>
|
||||
{progress && progress.total > 0 && (
|
||||
<FluentProgressBar
|
||||
className={styles.progressBar}
|
||||
value={progress.current / progress.total}
|
||||
/>
|
||||
)}
|
||||
<Button
|
||||
size="small"
|
||||
appearance="subtle"
|
||||
style={{ marginTop: "4px" }}
|
||||
onClick={requestCancellation}
|
||||
>
|
||||
Stop
|
||||
</Button>
|
||||
<header className={styles.header}>
|
||||
<Image src="assets/edison-32.png" alt="" width={32} height={32} />
|
||||
<div className={styles.headerText}>
|
||||
<Text size={400} weight="semibold">Edison</Text>
|
||||
<Text size={200} className={styles.muted}>PowerPoint toolbox</Text>
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
|
||||
{!isProcessing && statusMessage && (
|
||||
<div
|
||||
className={`${styles.statusContainer} ${styles[`${statusType}Status`]}`}
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
<div className={styles.scrollArea}>
|
||||
<Accordion
|
||||
multiple
|
||||
collapsible
|
||||
className={styles.accordion}
|
||||
>
|
||||
<div className={styles.statusText}>
|
||||
{getStatusIcon()}
|
||||
{statusMessage}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<Section title="Content" value="content">
|
||||
<MatchProperties />
|
||||
<MatchSizes />
|
||||
<SwapPositions />
|
||||
<InsertTitles />
|
||||
<RoundImage />
|
||||
</Section>
|
||||
|
||||
<div className={styles.footer}>
|
||||
<Text size={100}>Edison • v{__APP_VERSION__}</Text>
|
||||
<Section title="Progress Bar" value="progress-bar">
|
||||
<ProgressBarButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Confidential Marking" value="confidential">
|
||||
<ConfidentialButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Draft Watermark" value="draft">
|
||||
<DraftButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Alignment" value="alignment">
|
||||
<AlignmentButtons />
|
||||
</Section>
|
||||
|
||||
<Section title="Grid & Guidelines" value="grid-guidelines">
|
||||
<GridGuidelineManager />
|
||||
</Section>
|
||||
|
||||
<Section title="Settings" value="settings">
|
||||
<Field
|
||||
label="Slide size"
|
||||
hint="Used by alignment, grid, progress bar, title, and marking tools."
|
||||
>
|
||||
<Dropdown
|
||||
className={styles.dropdown}
|
||||
value={SLIDE_SIZE_LABELS[slideSizePreset]}
|
||||
selectedOptions={[slideSizePreset]}
|
||||
onOptionSelect={(_, data) => {
|
||||
if (data.optionValue === "widescreen" || data.optionValue === "standard") {
|
||||
setSlideSizePreset(data.optionValue);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Option value="widescreen">{SLIDE_SIZE_LABELS.widescreen}</Option>
|
||||
<Option value="standard">{SLIDE_SIZE_LABELS.standard}</Option>
|
||||
</Dropdown>
|
||||
</Field>
|
||||
<div className={styles.about}>
|
||||
<Text size={200} className={styles.muted}>Version {__APP_VERSION__}</Text>
|
||||
</div>
|
||||
</Section>
|
||||
</Accordion>
|
||||
</div>
|
||||
|
||||
{/* Always-mounted live region docked at the bottom of the pane */}
|
||||
<div
|
||||
className={`${styles.statusDock} ${hasStatus ? styles.statusDockActive : ""}`}
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
aria-atomic="true"
|
||||
>
|
||||
{isProcessing ? (
|
||||
<div>
|
||||
<div className={styles.statusText}>
|
||||
<Spinner size="tiny" />
|
||||
<Text size={300}>Processing</Text>
|
||||
{progress && (
|
||||
<Text size={300} aria-live="off">
|
||||
{progress.current} of {progress.total}…
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
{progress && progress.total > 0 && (
|
||||
<FluentProgressBar
|
||||
className={styles.progressBar}
|
||||
value={progress.current / progress.total}
|
||||
/>
|
||||
)}
|
||||
<div className={styles.stopRow}>
|
||||
<Button size="small" appearance="primary" onClick={requestCancellation}>
|
||||
Stop
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : statusMessage ? (
|
||||
<div className={`${styles.statusContainer} ${styles[`${statusType}Status`]}`}>
|
||||
<div className={styles.statusText}>
|
||||
{getStatusIcon()}
|
||||
<Text size={300}>{statusMessage}</Text>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</StatusContext.Provider>
|
||||
|
||||
@@ -5,10 +5,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import {
|
||||
Button,
|
||||
makeStyles
|
||||
} from "@fluentui/react-components";
|
||||
import { Button, Text } from "@fluentui/react-components";
|
||||
import {
|
||||
ShieldLockRegular,
|
||||
DismissRegular
|
||||
@@ -41,26 +38,6 @@ const CONFIDENTIAL_CONFIG = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Component-specific styles
|
||||
*/
|
||||
const useStyles = makeStyles({
|
||||
buttonGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, 1fr)",
|
||||
gap: "8px",
|
||||
width: "100%"
|
||||
},
|
||||
confidentialButton: {
|
||||
width: "100%",
|
||||
minWidth: 0,
|
||||
padding: "8px 4px",
|
||||
"& span": {
|
||||
justifyContent: "center"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Interface for slide processing results
|
||||
*/
|
||||
@@ -77,7 +54,6 @@ interface ProcessingResult {
|
||||
* @returns React component
|
||||
*/
|
||||
export const ConfidentialButtons: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const commonStyles = useCommonStyles();
|
||||
const { slideSize } = useSettings();
|
||||
const {
|
||||
@@ -265,20 +241,21 @@ export const ConfidentialButtons: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={commonStyles.container}>
|
||||
<div className={styles.buttonGrid}>
|
||||
<Text size={200} className={commonStyles.hint}>
|
||||
Adds a centered label near the bottom of every slide.
|
||||
</Text>
|
||||
<div className={commonStyles.buttonGroup}>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.confidentialButton}
|
||||
onClick={addConfidentialMarking}
|
||||
icon={<ShieldLockRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Add Confidential"
|
||||
>
|
||||
Add
|
||||
Add confidential marking
|
||||
</Button>
|
||||
<ConfirmButton
|
||||
appearance="primary"
|
||||
className={styles.confidentialButton}
|
||||
onConfirm={removeConfidentialMarking}
|
||||
icon={<DismissRegular />}
|
||||
disabled={isProcessing}
|
||||
@@ -287,7 +264,7 @@ export const ConfidentialButtons: React.FC = () => {
|
||||
confirmMessage="This removes the confidential marking from every slide in the presentation."
|
||||
confirmLabel="Remove"
|
||||
>
|
||||
Remove
|
||||
Remove confidential markings
|
||||
</ConfirmButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
DialogBody,
|
||||
DialogContent,
|
||||
DialogSurface,
|
||||
DialogTitle,
|
||||
DialogTitle
|
||||
} from "@fluentui/react-components";
|
||||
|
||||
export interface ConfirmButtonProps {
|
||||
@@ -74,7 +74,7 @@ export const ConfirmButton: React.FC<ConfirmButtonProps> = ({
|
||||
<DialogTitle>{confirmTitle}</DialogTitle>
|
||||
<DialogContent>{confirmMessage}</DialogContent>
|
||||
<DialogActions>
|
||||
<Button appearance="secondary" onClick={() => setIsOpen(false)}>
|
||||
<Button appearance="primary" onClick={() => setIsOpen(false)}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button appearance="primary" onClick={handleConfirm}>
|
||||
|
||||
@@ -6,12 +6,9 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Button, Text } from "@fluentui/react-components";
|
||||
import {
|
||||
Button,
|
||||
makeStyles
|
||||
} from "@fluentui/react-components";
|
||||
import {
|
||||
Edit24Regular,
|
||||
Edit20Regular,
|
||||
DismissRegular
|
||||
} from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
@@ -53,26 +50,6 @@ const DRAFT_CONFIG = {
|
||||
].join("\n")
|
||||
};
|
||||
|
||||
/**
|
||||
* Component-specific styles
|
||||
*/
|
||||
const useStyles = makeStyles({
|
||||
buttonGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, 1fr)",
|
||||
gap: "8px",
|
||||
width: "100%"
|
||||
},
|
||||
draftButton: {
|
||||
width: "100%",
|
||||
minWidth: 0,
|
||||
padding: "8px 4px",
|
||||
"& span": {
|
||||
justifyContent: "center"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Interface for master slide processing results
|
||||
*/
|
||||
@@ -89,7 +66,6 @@ interface ProcessingResult {
|
||||
* @returns React component
|
||||
*/
|
||||
export const DraftButtons: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const commonStyles = useCommonStyles();
|
||||
const {
|
||||
setStatusMessage,
|
||||
@@ -277,20 +253,21 @@ export const DraftButtons: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={commonStyles.container}>
|
||||
<div className={styles.buttonGrid}>
|
||||
<Text size={200} className={commonStyles.hint}>
|
||||
Applies a DRAFT watermark to every slide master.
|
||||
</Text>
|
||||
<div className={commonStyles.buttonGroup}>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.draftButton}
|
||||
onClick={addDraftWatermark}
|
||||
icon={<Edit24Regular />}
|
||||
icon={<Edit20Regular />}
|
||||
disabled={isProcessing}
|
||||
title="Add Draft"
|
||||
>
|
||||
Add
|
||||
Add draft watermark
|
||||
</Button>
|
||||
<ConfirmButton
|
||||
appearance="primary"
|
||||
className={styles.draftButton}
|
||||
onConfirm={removeDraftWatermark}
|
||||
icon={<DismissRegular />}
|
||||
disabled={isProcessing}
|
||||
@@ -299,7 +276,7 @@ export const DraftButtons: React.FC = () => {
|
||||
confirmMessage="This removes the DRAFT watermark from every slide master."
|
||||
confirmLabel="Remove"
|
||||
>
|
||||
Remove
|
||||
Remove draft watermarks
|
||||
</ConfirmButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Button, makeStyles, Text, tokens } from "@fluentui/react-components";
|
||||
import { getErrorMessage } from "../types/office-types";
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
@@ -15,6 +16,37 @@ interface ErrorBoundaryState {
|
||||
message: string;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "flex-start",
|
||||
gap: tokens.spacingVerticalM,
|
||||
padding: tokens.spacingVerticalL,
|
||||
backgroundColor: tokens.colorNeutralBackground1
|
||||
},
|
||||
message: {
|
||||
color: tokens.colorNeutralForeground2,
|
||||
whiteSpace: "pre-wrap"
|
||||
}
|
||||
});
|
||||
|
||||
const ErrorFallback: React.FC<{ message: string }> = ({ message }) => {
|
||||
const styles = useStyles();
|
||||
|
||||
return (
|
||||
<div role="alert" className={styles.root}>
|
||||
<Text size={400} weight="semibold">Edison could not load</Text>
|
||||
<Text size={300} className={styles.message}>
|
||||
{message || "An unexpected error occurred."}
|
||||
</Text>
|
||||
<Button appearance="primary" onClick={() => window.location.reload()}>
|
||||
Reload task pane
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
state: ErrorBoundaryState = { hasError: false, message: "" };
|
||||
|
||||
@@ -28,15 +60,7 @@ export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoun
|
||||
|
||||
render(): React.ReactNode {
|
||||
if (this.state.hasError) {
|
||||
return (
|
||||
<div role="alert" style={{ padding: "16px", fontFamily: "inherit" }}>
|
||||
<h2 style={{ marginTop: 0, fontSize: "16px" }}>Edison could not load</h2>
|
||||
<p style={{ fontSize: "13px" }}>{this.state.message || "An unexpected error occurred."}</p>
|
||||
<button type="button" onClick={() => window.location.reload()}>
|
||||
Reload task pane
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
return <ErrorFallback message={this.state.message} />;
|
||||
}
|
||||
|
||||
return this.props.children;
|
||||
|
||||
@@ -15,11 +15,12 @@ import {
|
||||
Field,
|
||||
Input,
|
||||
makeStyles,
|
||||
Label,
|
||||
Text,
|
||||
ToggleButton,
|
||||
tokens
|
||||
} from "@fluentui/react-components";
|
||||
import {
|
||||
CheckmarkRegular,
|
||||
DismissRegular,
|
||||
AddRegular,
|
||||
LineHorizontal3Regular,
|
||||
@@ -28,7 +29,6 @@ import {
|
||||
} from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useSettings } from "../context/SettingsContext";
|
||||
import { useCommonStyles } from "./commonStyles";
|
||||
import { deleteShapesByPrefix, getErrorMessage } from "../types/office-types";
|
||||
import { SHAPE_NAME_PREFIXES } from "../constants";
|
||||
import { isCancellationRequested, resetCancellation } from "../services/cancellation";
|
||||
@@ -85,64 +85,71 @@ interface ColorButtonProps {
|
||||
}
|
||||
|
||||
const useStyles = makeStyles({
|
||||
buttonGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, 1fr)",
|
||||
gap: "8px",
|
||||
width: "100%",
|
||||
marginBottom: "8px"
|
||||
root: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: tokens.spacingVerticalM
|
||||
},
|
||||
gridButton: {
|
||||
width: "100%",
|
||||
minWidth: 0,
|
||||
padding: "8px 4px",
|
||||
"& span": {
|
||||
justifyContent: "center"
|
||||
}
|
||||
hint: {
|
||||
color: tokens.colorNeutralForeground3
|
||||
},
|
||||
field: {
|
||||
maxWidth: "180px"
|
||||
},
|
||||
controlRow: {
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: "8px",
|
||||
marginBottom: "8px"
|
||||
gap: tokens.spacingHorizontalS
|
||||
},
|
||||
controlLabel: {
|
||||
minWidth: "80px",
|
||||
marginBottom: "0"
|
||||
minWidth: "48px",
|
||||
color: tokens.colorNeutralForeground2
|
||||
},
|
||||
controlInput: {
|
||||
flex: 1,
|
||||
"& input[type=number]::-webkit-inner-spin-button, & input[type=number]::-webkit-outer-spin-button": {
|
||||
"-webkit-appearance": "none",
|
||||
margin: 0
|
||||
},
|
||||
"& input[type=number]": {
|
||||
"-moz-appearance": "textfield"
|
||||
}
|
||||
},
|
||||
guidesContainer: {
|
||||
marginTop: "16px"
|
||||
},
|
||||
guideButtonGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, 1fr)",
|
||||
gap: "8px",
|
||||
width: "100%",
|
||||
marginTop: "8px"
|
||||
colorGroup: {
|
||||
display: "flex",
|
||||
gap: tokens.spacingHorizontalXS
|
||||
},
|
||||
colorButton: {
|
||||
width: "24px",
|
||||
height: "24px",
|
||||
minWidth: "24px",
|
||||
padding: "0",
|
||||
border: "1px solid " + tokens.colorNeutralStroke1,
|
||||
marginLeft: "8px"
|
||||
width: "32px",
|
||||
height: "32px",
|
||||
minWidth: "32px",
|
||||
padding: 0,
|
||||
border: `1px solid ${tokens.colorNeutralStroke1}`,
|
||||
borderRadius: tokens.borderRadiusMedium
|
||||
},
|
||||
colorButtonSelected: {
|
||||
border: "2px solid " + tokens.colorBrandForeground1
|
||||
border: `2px solid ${tokens.colorBrandForeground1}`
|
||||
},
|
||||
buttonGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
|
||||
gap: tokens.spacingHorizontalS,
|
||||
width: "100%",
|
||||
"@media (max-width: 360px)": {
|
||||
gridTemplateColumns: "1fr"
|
||||
}
|
||||
},
|
||||
gridButton: {
|
||||
width: "100%",
|
||||
minWidth: 0
|
||||
},
|
||||
guidesContainer: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: tokens.spacingVerticalM,
|
||||
paddingTop: tokens.spacingVerticalM,
|
||||
borderTopWidth: "1px",
|
||||
borderTopStyle: "solid",
|
||||
borderTopColor: tokens.colorNeutralStroke3
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns a check colour with sufficient contrast for each swatch.
|
||||
*/
|
||||
const getSwatchForeground = (color: GridColor): string =>
|
||||
color === "yellow" || color === "green" ? "#000000" : "#ffffff";
|
||||
|
||||
/**
|
||||
* ColorButton component - Renders a color selection button
|
||||
*
|
||||
@@ -151,14 +158,26 @@ const useStyles = makeStyles({
|
||||
*/
|
||||
const ColorButton: React.FC<ColorButtonProps> = ({ color, selectedColor, onClick }) => {
|
||||
const styles = useStyles();
|
||||
const label = color.charAt(0).toUpperCase() + color.slice(1);
|
||||
const selected = color === selectedColor;
|
||||
|
||||
return (
|
||||
<Button
|
||||
className={`${styles.colorButton} ${color === selectedColor ? styles.colorButtonSelected : ''}`}
|
||||
style={{ backgroundColor: colorValues[color] }}
|
||||
appearance="subtle"
|
||||
className={`${styles.colorButton} ${selected ? styles.colorButtonSelected : ''}`}
|
||||
style={{
|
||||
backgroundColor: colorValues[color],
|
||||
color: getSwatchForeground(color),
|
||||
width: "32px",
|
||||
minWidth: "32px",
|
||||
height: "32px",
|
||||
padding: 0
|
||||
}}
|
||||
onClick={() => onClick(color)}
|
||||
title={color.charAt(0).toUpperCase() + color.slice(1)}
|
||||
aria-label={`${color.charAt(0).toUpperCase() + color.slice(1)} color`}
|
||||
aria-pressed={color === selectedColor}
|
||||
title={`${label} color`}
|
||||
aria-label={`${label} color`}
|
||||
aria-pressed={selected}
|
||||
icon={selected ? <CheckmarkRegular /> : undefined}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -200,7 +219,6 @@ const useNumericInputHandler = (initialValue: number): NumericInputHandler => {
|
||||
*/
|
||||
export const GridGuidelineManager: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const commonStyles = useCommonStyles();
|
||||
const { slideSize } = useSettings();
|
||||
const {
|
||||
setStatusMessage,
|
||||
@@ -572,17 +590,13 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
}, [setIsProcessing, setProgress, setStatusMessage, setStatusType]);
|
||||
|
||||
return (
|
||||
<div className={commonStyles.container} style={{ maxHeight: "400px", overflowY: "auto" }}>
|
||||
{/* Grid Controls */}
|
||||
<Label style={{
|
||||
fontWeight: "600",
|
||||
marginBottom: "12px",
|
||||
fontSize: "16px"
|
||||
}}>
|
||||
Grid
|
||||
</Label>
|
||||
|
||||
<Field label="Spacing" style={{ marginBottom: "8px" }}>
|
||||
<div className={styles.root}>
|
||||
<Text size={400} weight="semibold">Grid</Text>
|
||||
<Text size={200} className={styles.hint}>
|
||||
Grid lines are slide shapes and appear in slideshows and exports.
|
||||
</Text>
|
||||
|
||||
<Field label="Spacing (pt)" className={styles.field}>
|
||||
<Input
|
||||
type="number"
|
||||
value={String(gridSpacing)}
|
||||
@@ -590,11 +604,10 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
min={GRID_SPACING_MIN}
|
||||
max={Math.min(slideSize.width, slideSize.height)}
|
||||
title="Grid spacing in points"
|
||||
style={{ width: "100px" }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Field label="Opacity" style={{ marginBottom: "8px" }}>
|
||||
|
||||
<Field label="Opacity (%)" className={styles.field}>
|
||||
<Input
|
||||
type="number"
|
||||
value={String(gridOpacity)}
|
||||
@@ -602,20 +615,19 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
min={GRID_OPACITY_MIN}
|
||||
max={GRID_OPACITY_MAX}
|
||||
title="Grid opacity percentage"
|
||||
style={{ width: "100px" }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
|
||||
<div className={styles.controlRow}>
|
||||
<Label className={styles.controlLabel}>Color</Label>
|
||||
<div style={{ display: "flex" }}>
|
||||
<Text id="grid-color-label" size={200} className={styles.controlLabel}>Color</Text>
|
||||
<div className={styles.colorGroup} role="group" aria-labelledby="grid-color-label">
|
||||
<ColorButton color="blue" selectedColor={gridColor} onClick={setGridColor} />
|
||||
<ColorButton color="red" selectedColor={gridColor} onClick={setGridColor} />
|
||||
<ColorButton color="yellow" selectedColor={gridColor} onClick={setGridColor} />
|
||||
<ColorButton color="green" selectedColor={gridColor} onClick={setGridColor} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className={styles.buttonGrid}>
|
||||
<Button
|
||||
appearance="primary"
|
||||
@@ -623,9 +635,9 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
onClick={createGrid}
|
||||
icon={<GridDotsRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Create Grid"
|
||||
title="Add grid"
|
||||
>
|
||||
Add
|
||||
Add grid
|
||||
</Button>
|
||||
<ConfirmButton
|
||||
appearance="primary"
|
||||
@@ -633,47 +645,39 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
onConfirm={removeGrid}
|
||||
icon={<DismissRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Remove Grid"
|
||||
title="Remove grid"
|
||||
confirmTitle="Remove the grid?"
|
||||
confirmMessage="This removes the grid from the current slide."
|
||||
confirmLabel="Remove"
|
||||
>
|
||||
Remove
|
||||
Remove grid
|
||||
</ConfirmButton>
|
||||
</div>
|
||||
|
||||
|
||||
{/* Guidelines Section */}
|
||||
<div className={styles.guidesContainer}>
|
||||
<Label style={{
|
||||
fontWeight: "600",
|
||||
marginBottom: "12px",
|
||||
fontSize: "16px"
|
||||
}}>
|
||||
Guidelines
|
||||
</Label>
|
||||
|
||||
<Field label="Position" style={{ marginBottom: "8px" }}>
|
||||
<Input
|
||||
type="number"
|
||||
value={String(guidePosition)}
|
||||
onChange={handleGuidePositionChange}
|
||||
min={0}
|
||||
max={guideDirection === "horizontal" ? slideSize.height : slideSize.width}
|
||||
title="Guideline position in points"
|
||||
style={{ width: "100px" }}
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<Text size={400} weight="semibold">Guidelines</Text>
|
||||
|
||||
<Field label="Position (pt)" className={styles.field}>
|
||||
<Input
|
||||
type="number"
|
||||
value={String(guidePosition)}
|
||||
onChange={handleGuidePositionChange}
|
||||
min={0}
|
||||
max={guideDirection === "horizontal" ? slideSize.height : slideSize.width}
|
||||
title="Guideline position in points"
|
||||
/>
|
||||
</Field>
|
||||
|
||||
<div className={styles.controlRow}>
|
||||
<Label className={styles.controlLabel}>Type</Label>
|
||||
<div style={{ display: "flex", gap: "8px" }}>
|
||||
<Text id="guide-direction-label" size={200} className={styles.controlLabel}>Type</Text>
|
||||
<div className={styles.colorGroup} role="group" aria-labelledby="guide-direction-label">
|
||||
<ToggleButton
|
||||
size="small"
|
||||
appearance="outline"
|
||||
checked={guideDirection === "horizontal"}
|
||||
onClick={() => setGuideDirection("horizontal")}
|
||||
icon={<LineHorizontal3Regular />}
|
||||
style={{ minWidth: "40px", padding: "2px 8px" }}
|
||||
>
|
||||
Horizontal
|
||||
</ToggleButton>
|
||||
@@ -683,33 +687,32 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
checked={guideDirection === "vertical"}
|
||||
onClick={() => setGuideDirection("vertical")}
|
||||
icon={<SplitVerticalRegular />}
|
||||
style={{ minWidth: "40px", padding: "2px 8px" }}
|
||||
>
|
||||
Vertical
|
||||
</ToggleButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className={styles.controlRow}>
|
||||
<Label className={styles.controlLabel}>Color</Label>
|
||||
<div style={{ display: "flex" }}>
|
||||
<Text id="guide-color-label" size={200} className={styles.controlLabel}>Color</Text>
|
||||
<div className={styles.colorGroup} role="group" aria-labelledby="guide-color-label">
|
||||
<ColorButton color="blue" selectedColor={guideColor} onClick={setGuideColor} />
|
||||
<ColorButton color="red" selectedColor={guideColor} onClick={setGuideColor} />
|
||||
<ColorButton color="yellow" selectedColor={guideColor} onClick={setGuideColor} />
|
||||
<ColorButton color="green" selectedColor={guideColor} onClick={setGuideColor} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className={styles.guideButtonGrid}>
|
||||
|
||||
<div className={styles.buttonGrid}>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.gridButton}
|
||||
onClick={addGuideline}
|
||||
icon={<AddRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Add Guideline"
|
||||
title="Add guideline"
|
||||
>
|
||||
Add
|
||||
Add guide
|
||||
</Button>
|
||||
<ConfirmButton
|
||||
appearance="primary"
|
||||
@@ -717,12 +720,12 @@ export const GridGuidelineManager: React.FC = () => {
|
||||
onConfirm={removeGuidelines}
|
||||
icon={<DismissRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Remove All Guidelines"
|
||||
title="Remove all guidelines"
|
||||
confirmTitle="Remove all guidelines?"
|
||||
confirmMessage="This removes every guideline from the current slide."
|
||||
confirmLabel="Remove"
|
||||
>
|
||||
Remove
|
||||
Remove guides
|
||||
</ConfirmButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import * as React from "react";
|
||||
import { Image, tokens, makeStyles } from "@fluentui/react-components";
|
||||
|
||||
export interface HeaderProps {
|
||||
title: string;
|
||||
logo: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles({
|
||||
welcome__header: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
paddingBottom: "30px",
|
||||
paddingTop: "100px",
|
||||
backgroundColor: tokens.colorNeutralBackground3,
|
||||
},
|
||||
message: {
|
||||
fontSize: tokens.fontSizeHero900,
|
||||
fontWeight: tokens.fontWeightRegular,
|
||||
fontColor: tokens.colorNeutralBackgroundStatic,
|
||||
},
|
||||
});
|
||||
|
||||
const Header: React.FC<HeaderProps> = (props: HeaderProps) => {
|
||||
const { title, logo, message } = props;
|
||||
const styles = useStyles();
|
||||
|
||||
return (
|
||||
<section className={styles.welcome__header}>
|
||||
<Image width="90" height="90" src={logo} alt={title} />
|
||||
<h1 className={styles.message}>{message}</h1>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default Header;
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Dropdown, Field, Option } from "@fluentui/react-components";
|
||||
import { Dropdown, Field, makeStyles, Option, Text } from "@fluentui/react-components";
|
||||
import { TextBulletListRegular } from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useSettings } from "../context/SettingsContext";
|
||||
@@ -22,8 +22,15 @@ const DETECTION_LABELS: Record<TitleDetectionMethod, string> = {
|
||||
first: "First text on slide"
|
||||
};
|
||||
|
||||
const useStyles = makeStyles({
|
||||
dropdown: {
|
||||
width: "100%"
|
||||
}
|
||||
});
|
||||
|
||||
export const InsertTitles: React.FC = () => {
|
||||
const styles = useCommonStyles();
|
||||
const localStyles = useStyles();
|
||||
const { slideSize } = useSettings();
|
||||
const { setStatusMessage, setStatusType, setIsProcessing, setProgress } = useStatusContext();
|
||||
const [titleDetectionMethod, setTitleDetectionMethod] =
|
||||
@@ -109,6 +116,9 @@ export const InsertTitles: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Text size={200} className={styles.hint}>
|
||||
Select the text box that should receive the collected titles.
|
||||
</Text>
|
||||
<div className={styles.buttonGroup}>
|
||||
<ActionButton
|
||||
title="Insert Titles"
|
||||
@@ -122,6 +132,7 @@ export const InsertTitles: React.FC = () => {
|
||||
|
||||
<Field label="Title detection">
|
||||
<Dropdown
|
||||
className={localStyles.dropdown}
|
||||
value={DETECTION_LABELS[titleDetectionMethod]}
|
||||
selectedOptions={[titleDetectionMethod]}
|
||||
onOptionSelect={(_, data) => {
|
||||
@@ -140,6 +151,7 @@ export const InsertTitles: React.FC = () => {
|
||||
|
||||
<Field label="Slide numbers">
|
||||
<Dropdown
|
||||
className={localStyles.dropdown}
|
||||
value={includeSlideNumbers ? "Include slide numbers" : "Exclude slide numbers"}
|
||||
selectedOptions={[includeSlideNumbers ? "yes" : "no"]}
|
||||
onOptionSelect={(_, data) => {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Text } from "@fluentui/react-components";
|
||||
import { ColorRegular } from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useCommonStyles } from "./commonStyles";
|
||||
@@ -321,6 +322,9 @@ export const MatchProperties: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Text size={200} className={styles.hint}>
|
||||
Select two or more shapes; the first shape is the source.
|
||||
</Text>
|
||||
<div className={styles.buttonGroup}>
|
||||
<ActionButton
|
||||
title="Match Properties"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Text } from "@fluentui/react-components";
|
||||
import { ArrowFitInRegular } from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useCommonStyles } from "./commonStyles";
|
||||
@@ -178,6 +179,9 @@ export const MatchSizes: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Text size={200} className={styles.hint}>
|
||||
Select two or more shapes; the first shape sets the size.
|
||||
</Text>
|
||||
<div className={styles.buttonGroup}>
|
||||
<ActionButton
|
||||
title="Match Sizes"
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import {
|
||||
Button,
|
||||
makeStyles
|
||||
} from "@fluentui/react-components";
|
||||
import { Button, Text } from "@fluentui/react-components";
|
||||
import {
|
||||
GaugeRegular,
|
||||
DismissRegular
|
||||
@@ -25,25 +22,7 @@ import {
|
||||
} from "../services/progressBar";
|
||||
import ConfirmButton from "./ConfirmButton";
|
||||
|
||||
const useStyles = makeStyles({
|
||||
buttonGrid: {
|
||||
display: "grid",
|
||||
gridTemplateColumns: "repeat(2, 1fr)",
|
||||
gap: "8px",
|
||||
width: "100%"
|
||||
},
|
||||
progressButton: {
|
||||
width: "100%",
|
||||
minWidth: 0,
|
||||
padding: "8px 4px",
|
||||
"& span": {
|
||||
justifyContent: "center"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export const ProgressBarButtons: React.FC = () => {
|
||||
const styles = useStyles();
|
||||
const commonStyles = useCommonStyles();
|
||||
const { slideSize } = useSettings();
|
||||
const {
|
||||
@@ -135,20 +114,21 @@ export const ProgressBarButtons: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={commonStyles.container}>
|
||||
<div className={styles.buttonGrid}>
|
||||
<Text size={200} className={commonStyles.hint}>
|
||||
Adds a progress bar to every slide. Each slide gets two shapes.
|
||||
</Text>
|
||||
<div className={commonStyles.buttonGroup}>
|
||||
<Button
|
||||
appearance="primary"
|
||||
className={styles.progressButton}
|
||||
onClick={addProgressBar}
|
||||
icon={<GaugeRegular />}
|
||||
disabled={isProcessing}
|
||||
title="Add Progress Bar"
|
||||
>
|
||||
Add
|
||||
Add progress bar
|
||||
</Button>
|
||||
<ConfirmButton
|
||||
appearance="primary"
|
||||
className={styles.progressButton}
|
||||
onConfirm={removeProgressBar}
|
||||
icon={<DismissRegular />}
|
||||
disabled={isProcessing}
|
||||
@@ -157,7 +137,7 @@ export const ProgressBarButtons: React.FC = () => {
|
||||
confirmMessage="This removes the progress bar from every slide in the presentation."
|
||||
confirmLabel="Remove"
|
||||
>
|
||||
Remove
|
||||
Remove progress bars
|
||||
</ConfirmButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Text } from "@fluentui/react-components";
|
||||
import { CircleRegular } from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useCommonStyles } from "./commonStyles";
|
||||
@@ -160,6 +161,9 @@ export const RoundImage: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Text size={200} className={styles.hint}>
|
||||
Select one image to create the mask, then intersect it in PowerPoint.
|
||||
</Text>
|
||||
<div className={styles.buttonGroup}>
|
||||
<ActionButton
|
||||
title="Round Image"
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as React from "react";
|
||||
import {
|
||||
Accordion,
|
||||
AccordionHeader,
|
||||
AccordionItem,
|
||||
AccordionPanel,
|
||||
@@ -10,46 +9,46 @@ import {
|
||||
|
||||
interface SectionProps {
|
||||
title: string;
|
||||
/** Stable accordion value; defaults to the title. */
|
||||
value?: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles({
|
||||
section: {
|
||||
marginBottom: "6px",
|
||||
padding: "12px",
|
||||
borderRadius: "8px",
|
||||
backgroundColor: tokens.colorNeutralBackground2,
|
||||
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.06)",
|
||||
transition: "all 0.2s ease",
|
||||
":hover": {
|
||||
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.1)"
|
||||
}
|
||||
item: {
|
||||
borderBottomWidth: "1px",
|
||||
borderBottomStyle: "solid",
|
||||
borderBottomColor: tokens.colorNeutralStroke3
|
||||
},
|
||||
accordion: {
|
||||
width: "100%"
|
||||
header: {
|
||||
color: tokens.colorNeutralForeground1,
|
||||
fontSize: tokens.fontSizeBase400,
|
||||
fontWeight: tokens.fontWeightSemibold
|
||||
},
|
||||
sectionTitle: {
|
||||
fontWeight: tokens.fontWeightSemibold,
|
||||
color: tokens.colorBrandForeground1,
|
||||
fontSize: tokens.fontSizeBase400
|
||||
stack: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: tokens.spacingVerticalM,
|
||||
paddingBottom: tokens.spacingVerticalM
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Collapsible section used to group related tools.
|
||||
* A single disclosure section inside the task pane's shared `Accordion`.
|
||||
*
|
||||
* `Section` must be rendered inside an `Accordion` so the disclosure widgets
|
||||
* share keyboard navigation and expansion state.
|
||||
*/
|
||||
export const Section: React.FC<SectionProps> = ({ title, children }) => {
|
||||
export const Section: React.FC<SectionProps> = ({ title, value, children }) => {
|
||||
const styles = useStyles();
|
||||
|
||||
return (
|
||||
<div className={styles.section}>
|
||||
<Accordion collapsible defaultOpenItems={[title]} className={styles.accordion}>
|
||||
<AccordionItem value={title}>
|
||||
<AccordionHeader className={styles.sectionTitle}>{title}</AccordionHeader>
|
||||
<AccordionPanel>{children}</AccordionPanel>
|
||||
</AccordionItem>
|
||||
</Accordion>
|
||||
</div>
|
||||
<AccordionItem value={value ?? title} className={styles.item}>
|
||||
<AccordionHeader className={styles.header}>{title}</AccordionHeader>
|
||||
<AccordionPanel>
|
||||
<div className={styles.stack}>{children}</div>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Text } from "@fluentui/react-components";
|
||||
import { ArrowSwapRegular } from "@fluentui/react-icons";
|
||||
import { useStatusContext } from "../context/StatusContext";
|
||||
import { useCommonStyles } from "./commonStyles";
|
||||
@@ -142,6 +143,9 @@ export const SwapPositions: React.FC = () => {
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<Text size={200} className={styles.hint}>
|
||||
Select exactly two shapes to exchange their positions.
|
||||
</Text>
|
||||
<div className={styles.buttonGroup}>
|
||||
<ActionButton
|
||||
title="Swap Positions"
|
||||
|
||||
@@ -1,49 +1,30 @@
|
||||
import { makeStyles } from "@fluentui/react-components";
|
||||
import { makeStyles, tokens } from "@fluentui/react-components";
|
||||
|
||||
// Common styles used across multiple components
|
||||
/**
|
||||
* Shared layout styles for the task pane.
|
||||
*
|
||||
* Only layout primitives live here. Status colours, spacing and typography come
|
||||
* from Fluent tokens so the pane follows the active (light or dark) theme.
|
||||
*/
|
||||
export const useCommonStyles = makeStyles({
|
||||
container: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
width: "100%",
|
||||
gap: tokens.spacingVerticalS
|
||||
},
|
||||
buttonGroup: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "8px",
|
||||
marginBottom: "2px",
|
||||
gap: tokens.spacingVerticalS
|
||||
},
|
||||
actionButton: {
|
||||
justifyContent: "flex-start",
|
||||
transitionProperty: "all",
|
||||
transitionDuration: "200ms",
|
||||
transitionTimingFunction: "cubic-bezier(0.33, 0, 0.67, 1)",
|
||||
transitionProperty: "background-color, border-color, color",
|
||||
transitionDuration: tokens.durationNormal,
|
||||
transitionTimingFunction: tokens.curveEasyEase
|
||||
},
|
||||
statusContainer: {
|
||||
marginTop: "4px",
|
||||
padding: "8px 12px",
|
||||
fontSize: "13px",
|
||||
borderRadius: "6px",
|
||||
backgroundColor: "#f3f2f1", // Light gray background
|
||||
transition: "all 0.3s ease",
|
||||
},
|
||||
successStatus: {
|
||||
backgroundColor: "#DFF6DD", // Light green background
|
||||
color: "#107C10", // Green text
|
||||
},
|
||||
warningStatus: {
|
||||
backgroundColor: "#FFF4CE", // Light yellow background
|
||||
color: "#797673", // Dark gray text
|
||||
},
|
||||
errorStatus: {
|
||||
backgroundColor: "#FDE7E9", // Light red background
|
||||
color: "#A80000", // Red text
|
||||
},
|
||||
statusIcon: {
|
||||
marginRight: "8px",
|
||||
},
|
||||
statusText: {
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
},
|
||||
});
|
||||
hint: {
|
||||
color: tokens.colorNeutralForeground3
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user