diff --git a/README.md b/README.md index 62d92361..ced41f61 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,10 @@ A productivity toolkit that enhances PowerPoint with specialized formatting and ![Edison Add-in](assets/edison-128.png) +The add-in opens as a task pane with a header, collapsible tool sections, and a +status bar docked at the bottom for progress and results. All sections start +collapsed; click a section title to expand it. + ## Features ### Content Tools @@ -192,14 +196,14 @@ manifest.xml # Add-in manifest 1. Navigate to the slide where the grid should appear. 2. Set spacing (minimum 4 pt), opacity (0–100), and color. -3. Click **Add** to create the grid. Click **Remove** to delete it. +3. Click **Add grid** to create the grid. Click **Remove grid** to delete it. 4. The grid is a set of shapes on the current slide and appears in slideshow/export output. #### Guidelines 1. Set the position, orientation, and color. -2. Click **Add** to create a guideline. -3. Click **Remove** to delete all guidelines on the current slide. +2. Click **Add guide** to create a guideline. +3. Click **Remove guides** to delete all guidelines on the current slide. ## Tips @@ -208,6 +212,12 @@ manifest.xml # Add-in manifest - **Long operations**: A progress counter and **Stop** button appear for large presentations. - **Destructive actions**: Removals and Insert Titles ask for confirmation. +## Documentation + +- [User Guide](docs/USER_GUIDE.md) +- [Developer Guide](docs/DEVELOPERS.md) +- [UI Guidelines](docs/UI_GUIDELINES.md) + ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/docs/DEVELOPERS.md b/docs/DEVELOPERS.md index 4bb79b17..3f509b92 100644 --- a/docs/DEVELOPERS.md +++ b/docs/DEVELOPERS.md @@ -194,6 +194,7 @@ For raw Fluent buttons that need a confirmation dialog: onConfirm={remove} confirmTitle="Remove the grid?" confirmMessage="This removes the grid from the current slide." + confirmLabel="Remove" > Remove @@ -201,12 +202,15 @@ For raw Fluent buttons that need a confirmation dialog: ### Section -Collapsible grouping with consistent styling: +A single disclosure item. `Section` renders an `AccordionItem`, so it must be +placed inside the shared `Accordion` in `App.tsx`: ```tsx -
- -
+ +
+ +
+
``` ## Creating a New Tool @@ -350,6 +354,21 @@ Test pure functions and helpers directly. Office.js interactions should be kept Continuous integration runs lint, typecheck, tests, build, and manifest validation on every push and pull request. +## UI Guidelines + +The pane follows Fluent 2 and Microsoft's Office Add-in UX guidance. The full +rules and review checklist live in [`docs/UI_GUIDELINES.md`](UI_GUIDELINES.md). + +Key points: + +- Use Fluent tokens for colour, spacing, type, radius, and motion. No literal + hex values in UI styles (slide colours are the exception). +- Keep one scroll container. Sections must not set `maxHeight` or `overflow`. +- All action buttons use the blue primary style; destructive actions are + confirmed by a dialog. +- Labels are verb + object, with a short hint when a selection is required. +- Keep the single always-mounted `role="status"` region for feedback. + ## Performance Guidelines - **Batch `context.sync()` calls.** Load all needed properties, then sync once. @@ -366,12 +385,15 @@ Continuous integration runs lint, typecheck, tests, build, and manifest validati 4. Add confirmations for destructive operations. 5. Make repeated add operations idempotent. 6. Use Fluent `Field`/`Input`/`Dropdown` controls so labels and keyboard navigation work. -7. Announce results through the status region (`role="status"`). -8. Update docs when behavior changes. +7. Use design tokens and follow `docs/UI_GUIDELINES.md` for any new UI. +8. Announce results through the status region (`role="status"`). +9. Update docs when behavior changes. ## Resources - [Office Add-ins documentation](https://learn.microsoft.com/office/dev/add-ins/) +- [Office Add-in UX design guidelines](https://learn.microsoft.com/office/dev/add-ins/design/add-in-design) - [Office.js API reference](https://learn.microsoft.com/javascript/api/overview/office) - [Fluent UI React v9](https://react.fluentui.dev/) +- [Fluent 2 design system](https://fluent2.microsoft.design/) - [Vitest](https://vitest.dev/) diff --git a/docs/UI_GUIDELINES.md b/docs/UI_GUIDELINES.md new file mode 100644 index 00000000..763ac09e --- /dev/null +++ b/docs/UI_GUIDELINES.md @@ -0,0 +1,127 @@ +# Edison UI Guidelines + +The task pane follows **Fluent 2** (`@fluentui/react-components` v9) and Microsoft's +[Office Add-in UX guidelines](https://learn.microsoft.com/office/dev/add-ins/design/add-in-design), +including WCAG 2.1 AA expectations. This document records the rules the codebase +follows so new tools stay consistent. + +## Structure + +The pane has three fixed regions (`src/taskpane/components/App.tsx`): + +1. **Header** — Edison icon, name, and a short descriptor. Gives the pane identity + when several add-ins are open. +2. **Scroll area** — one vertical scroll owner containing a single `Accordion` + with one `Section` per tool group. +3. **Status dock** — always-mounted `role="status"` live region at the bottom. + It shows progress with a Stop button while processing, then the result. + +Rules: + +- Never add a second scroll container. Do not put `overflow: auto` or a fixed + `maxHeight` inside a section; the pane scrolls as a whole. +- `Section` renders an `AccordionItem`, so it must be a child of an `Accordion`. +- All sections start collapsed. Use `multiple` on the `Accordion` so several + groups can stay open. + +## Design tokens + +Use Fluent tokens for every colour, spacing, radius, shadow, and font value. + +| Concern | Use | +|---|---| +| Colours | `tokens.colorNeutral*`, `tokens.colorBrand*`, `tokens.colorPalette*` | +| Spacing | `tokens.spacingHorizontal*`, `tokens.spacingVertical*` | +| Type | `tokens.fontFamilyBase`, `tokens.fontSizeBase200/300/400`, `tokens.fontWeightSemibold` | +| Radius | `tokens.borderRadiusMedium` | +| Elevation | `tokens.shadow2`, `tokens.shadow4` | +| Motion | `tokens.durationNormal`, `tokens.curveEasyEase` | + +- No literal hex colours in UI styles. The only exceptions are the colours that + are written **into the slide** (grid, guideline, marking, watermark). +- Do not hand-roll shadows or theme-dependent colours; that is what broke dark + mode before v1.2.0. +- Placeholder/loading chrome in `taskpane.html` uses CSS variables with a + `prefers-color-scheme: dark` override. + +## Typography and spacing + +- Body text: `fontSizeBase300` (14 px). Metadata and hints: `fontSizeBase200`. +- Section headings: `fontSizeBase400` + `fontWeightSemibold`, neutral foreground. +- Pane padding: `spacingHorizontalL` (16 px). Gaps between related controls: + `spacingVerticalS`/`spacingHorizontalS` (8 px); between tool groups: + `spacingVerticalM` (12 px) via `Section`'s stack. +- Prefer `gap` on flex containers over spacer `
` elements. +- Do not use `Text size={100}` (10 px); it is below the readable minimum. + +## Action hierarchy + +The pane uses one button style: **all action buttons are blue** (`appearance="primary"`), +including secondary actions, Remove, Cancel, and Stop. This keeps the controls +visually consistent across sections. + +| Action | Appearance | +|---|---| +| Every action button (run, add, remove, cancel, stop) | `primary` | +| Colour swatches | keep the swatch colour (never brand blue) | +| Horizontal/vertical direction toggles | `outline`, stateful | + +- Keep destructive actions visually confirmed by a dialog even though the + trigger is blue. +- Dialog copy states exactly what will be removed or replaced. Cancel keeps + initial focus. +- Colour swatches are the one exception: they must show the colour that will be + written to the slide. + +## Labels and copy + +- Buttons use **verb + object**: "Add progress bar", "Remove guides", + "Match properties" — not "Add" / "Remove" on their own. +- Section titles are nouns ("Grid & Guidelines"), matching the User Guide. +- Add a one-line hint (`useCommonStyles().hint`, `Text size={200}`) above a tool + when the selection requirement is not obvious ("Select exactly two shapes"). +- Avoid duplicating a section title in every button tooltip. + +## Forms and groups + +- One control → `Field label`. `Input` and `Dropdown` are field-aware, so the + label is associated automatically. +- A set of related controls (colour swatches, direction toggle) → visible `Text` + label plus a `role="group"` container with `aria-labelledby`. +- `Field`/`Dropdown` fill the pane width (`width: 100%`); numeric inputs may be + capped (`maxWidth: 180px`). +- Colour swatches are at least 32×32 px, show a check icon for the selected + value (not colour alone — WCAG 1.4.1), and expose `aria-pressed`. + +## Feedback and accessibility + +- Keep exactly one `role="status"` region mounted for the lifetime of the pane. + It announces progress and results without moving focus. +- Success messages auto-clear after 5 seconds; warnings and errors stay until + the next action. +- Icon-only controls need an accessible name (`aria-label` or a Fluent `Tooltip` + with `relationship="label"`). +- Do not rely on `title` alone for the accessible name. +- Every interactive control must be reachable and operable by keyboard. +- Target size: at least 32×32 px for icon-only controls; primary buttons are + full width of their container. +- Status text must not be the only indication of an error; the icon and colour + are paired with a message. + +## Responsive behaviour + +- Design for the minimum task-pane width (320 px). The pane can be narrower when + docked; the two-column button grids collapse to one column below 360 px + (`@media (max-width: 360px)`). +- Prefer wrapping toolbars and full-width controls over horizontal scrolling. +- Test at 320 px and ~480 px, in light and dark mode, with a collapsed section. + +## Review checklist + +- [ ] Only tokens for colours, spacing, type, radius, and motion +- [ ] All action buttons use the blue primary style; destructive actions confirmed +- [ ] Labels are verb + object; hints explain selection requirements +- [ ] One scroll container; no nested `maxHeight`/`overflow` +- [ ] Single always-mounted live region +- [ ] Icon-only controls have accessible names +- [ ] Works at 320 px, light and dark, keyboard only diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md index ae673a98..8defd47a 100644 --- a/docs/USER_GUIDE.md +++ b/docs/USER_GUIDE.md @@ -14,15 +14,21 @@ This guide will help you use the Edison PowerPoint Add-in to create professional ### Interface Overview -The Edison task pane is organized into collapsible sections: +The Edison task pane has three areas: + +- **Header** - The Edison logo and the add-in name, so you can tell which add-in pane is open. +- **Sections** - A scrollable list of collapsible tool groups. All sections start collapsed; click a section title to expand or collapse it. +- **Status bar** - Docked at the bottom of the pane. It shows progress and a **Stop** button during long operations, then the result. + +The sections are: - **Content** - Tools for manipulating content and shapes - **Progress Bar** - Add/remove presentation progress indicators - **Confidential Marking** - Add/remove confidential labels - **Draft Watermark** - Add/remove draft watermarks - **Alignment** - Tools for aligning shapes and objects -- **Layout** - Grids and guidelines for the current slide -- **Settings** - Slide size and other per-presentation preferences +- **Grid & Guidelines** - Grids and guidelines for the current slide +- **Settings** - Slide size and version information ## Content Tools @@ -127,6 +133,10 @@ Adds or removes a "DRAFT" watermark on slide masters to mark in-progress present These tools align selected objects to the slide edges or center. +The alignment controls are icon buttons in a single row: the first three align +horizontally (left, center, right), the last three align vertically (top, +middle, bottom). Hover an icon to see its name. + ### Horizontal Alignment - **Left** - Aligns all shapes to the left edge of the slide diff --git a/src/taskpane/Root.tsx b/src/taskpane/Root.tsx index dcb0a3e6..0b491e1c 100644 --- a/src/taskpane/Root.tsx +++ b/src/taskpane/Root.tsx @@ -54,7 +54,7 @@ const Root: React.FC = () => { }, []); return ( - + diff --git a/src/taskpane/components/AlignmentButtons.tsx b/src/taskpane/components/AlignmentButtons.tsx index a1acb138..6339f625 100644 --- a/src/taskpane/components/AlignmentButtons.tsx +++ b/src/taskpane/components/AlignmentButtons.tsx @@ -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 = ({ label, icon, disabled, onClick }) => ( + + + +); + /** * 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 => { @@ -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 => { @@ -240,68 +260,48 @@ export const AlignmentButtons: React.FC = () => { return (
-
- - - - - - -
+ onClick={alignRight} + /> + + } + disabled={isProcessing} + onClick={alignTop} + /> + } + disabled={isProcessing} + onClick={alignMiddle} + /> + } + disabled={isProcessing} + onClick={alignBottom} + /> +
); }; diff --git a/src/taskpane/components/App.tsx b/src/taskpane/components/App.tsx index 87736e58..b9d8897c 100644 --- a/src/taskpane/components/App.tsx +++ b/src/taskpane/components/App.tsx @@ -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 ; + return ; case "warning": - return ; + return ; case "error": - return ; + return ; default: - return ; + return ; } }; + const hasStatus = isProcessing || Boolean(statusMessage); + return ( { setProgress }}>
-
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- -
- - { - if (data.optionValue === "widescreen" || data.optionValue === "standard") { - setSlideSizePreset(data.optionValue); - } - }} - > - - - - -
- - {/* Status message area at the bottom */} - {isProcessing && ( -
-
- - {progress ? `Processing ${progress.current} / ${progress.total}...` : "Processing..."} -
- {progress && progress.total > 0 && ( - - )} - +
+ +
+ Edison + PowerPoint toolbox
- )} +
- {!isProcessing && statusMessage && ( -
+ -
- {getStatusIcon()} - {statusMessage} -
-
- )} +
+ + + + + +
-
- Edison • v{__APP_VERSION__} +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + { + if (data.optionValue === "widescreen" || data.optionValue === "standard") { + setSlideSizePreset(data.optionValue); + } + }} + > + + + + +
+ Version {__APP_VERSION__} +
+
+ +
+ + {/* Always-mounted live region docked at the bottom of the pane */} +
+ {isProcessing ? ( +
+
+ + Processing + {progress && ( + + {progress.current} of {progress.total}… + + )} +
+ {progress && progress.total > 0 && ( + + )} +
+ +
+
+ ) : statusMessage ? ( +
+
+ {getStatusIcon()} + {statusMessage} +
+
+ ) : null}
diff --git a/src/taskpane/components/ConfidentialButtons.tsx b/src/taskpane/components/ConfidentialButtons.tsx index 00e2bd07..4e4b1c4a 100644 --- a/src/taskpane/components/ConfidentialButtons.tsx +++ b/src/taskpane/components/ConfidentialButtons.tsx @@ -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 (
-
+ + Adds a centered label near the bottom of every slide. + +
} 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
diff --git a/src/taskpane/components/ConfirmButton.tsx b/src/taskpane/components/ConfirmButton.tsx index 81af57f9..847a6fdb 100644 --- a/src/taskpane/components/ConfirmButton.tsx +++ b/src/taskpane/components/ConfirmButton.tsx @@ -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 = ({ {confirmTitle} {confirmMessage} - } 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
diff --git a/src/taskpane/components/ErrorBoundary.tsx b/src/taskpane/components/ErrorBoundary.tsx index 6b14315f..b0a95e00 100644 --- a/src/taskpane/components/ErrorBoundary.tsx +++ b/src/taskpane/components/ErrorBoundary.tsx @@ -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 ( +
+ Edison could not load + + {message || "An unexpected error occurred."} + + +
+ ); +}; + export class ErrorBoundary extends React.Component { state: ErrorBoundaryState = { hasError: false, message: "" }; @@ -28,15 +60,7 @@ export class ErrorBoundary extends React.Component -

Edison could not load

-

{this.state.message || "An unexpected error occurred."}

- -
- ); + return ; } return this.props.children; diff --git a/src/taskpane/components/GridGuidelineManager.tsx b/src/taskpane/components/GridGuidelineManager.tsx index ae366061..c3607e26 100644 --- a/src/taskpane/components/GridGuidelineManager.tsx +++ b/src/taskpane/components/GridGuidelineManager.tsx @@ -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 = ({ color, selectedColor, onClick }) => { const styles = useStyles(); + const label = color.charAt(0).toUpperCase() + color.slice(1); + const selected = color === selectedColor; + return ( { onConfirm={removeGrid} icon={} 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 - + {/* Guidelines Section */}
- - - - - - + Guidelines + + + + +
- -
+ Type +
setGuideDirection("horizontal")} icon={} - style={{ minWidth: "40px", padding: "2px 8px" }} > Horizontal @@ -683,33 +687,32 @@ export const GridGuidelineManager: React.FC = () => { checked={guideDirection === "vertical"} onClick={() => setGuideDirection("vertical")} icon={} - style={{ minWidth: "40px", padding: "2px 8px" }} > Vertical
- +
- -
+ Color +
- -
+ +
{ onConfirm={removeGuidelines} icon={} 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
diff --git a/src/taskpane/components/Header.tsx b/src/taskpane/components/Header.tsx deleted file mode 100644 index f3d6c59a..00000000 --- a/src/taskpane/components/Header.tsx +++ /dev/null @@ -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 = (props: HeaderProps) => { - const { title, logo, message } = props; - const styles = useStyles(); - - return ( -
- {title} -

{message}

-
- ); -}; - -export default Header; diff --git a/src/taskpane/components/InsertTitles.tsx b/src/taskpane/components/InsertTitles.tsx index 73018e5f..a3b905f3 100644 --- a/src/taskpane/components/InsertTitles.tsx +++ b/src/taskpane/components/InsertTitles.tsx @@ -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 = { 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 (
+ + Select the text box that should receive the collected titles. +
{ { @@ -140,6 +151,7 @@ export const InsertTitles: React.FC = () => { { diff --git a/src/taskpane/components/MatchProperties.tsx b/src/taskpane/components/MatchProperties.tsx index 27085ab9..536e3053 100644 --- a/src/taskpane/components/MatchProperties.tsx +++ b/src/taskpane/components/MatchProperties.tsx @@ -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 (
+ + Select two or more shapes; the first shape is the source. +
{ return (
+ + Select two or more shapes; the first shape sets the size. +
{ - const styles = useStyles(); const commonStyles = useCommonStyles(); const { slideSize } = useSettings(); const { @@ -135,20 +114,21 @@ export const ProgressBarButtons: React.FC = () => { return (
-
+ + Adds a progress bar to every slide. Each slide gets two shapes. + +
} 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
diff --git a/src/taskpane/components/RoundImage.tsx b/src/taskpane/components/RoundImage.tsx index da1d74c3..6efd130c 100644 --- a/src/taskpane/components/RoundImage.tsx +++ b/src/taskpane/components/RoundImage.tsx @@ -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 (
+ + Select one image to create the mask, then intersect it in PowerPoint. +
= ({ title, children }) => { +export const Section: React.FC = ({ title, value, children }) => { const styles = useStyles(); return ( -
- - - {title} - {children} - - -
+ + {title} + +
{children}
+
+
); }; diff --git a/src/taskpane/components/SwapPositions.tsx b/src/taskpane/components/SwapPositions.tsx index f00b5c0f..0a81f282 100644 --- a/src/taskpane/components/SwapPositions.tsx +++ b/src/taskpane/components/SwapPositions.tsx @@ -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 (
+ + Select exactly two shapes to exchange their positions. +
{ + const loading = document.getElementById("loading"); + if (!loading) return; + + loading.style.opacity = "0"; + window.setTimeout(() => loading.remove(), 200); +}; + /* Render application after Office initializes */ Office.onReady(() => { root?.render(); + window.requestAnimationFrame(hideLoadingIndicator); }); // Define proper module hot interface for webpack hot module replacement diff --git a/src/taskpane/taskpane.html b/src/taskpane/taskpane.html index 2716cfaa..4e228251 100644 --- a/src/taskpane/taskpane.html +++ b/src/taskpane/taskpane.html @@ -15,23 +15,46 @@