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:
schihei committed 2026-11-25 12:40:12 +01:00
1 parent 89989c04e9
commit e223dc61c8
23 files changed
+701 -531

No files matched your search

+13 -3
View File
@@ -4,6 +4,10 @@ A productivity toolkit that enhances PowerPoint with specialized formatting and
![Edison Add-in](assets/edison-128.png) ![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 ## Features
### Content Tools ### Content Tools
@@ -192,14 +196,14 @@ manifest.xml # Add-in manifest
1. Navigate to the slide where the grid should appear. 1. Navigate to the slide where the grid should appear.
2. Set spacing (minimum 4 pt), opacity (0–100), and color. 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. 4. The grid is a set of shapes on the current slide and appears in slideshow/export output.
#### Guidelines #### Guidelines
1. Set the position, orientation, and color. 1. Set the position, orientation, and color.
2. Click **Add** to create a guideline. 2. Click **Add guide** to create a guideline.
3. Click **Remove** to delete all guidelines on the current slide. 3. Click **Remove guides** to delete all guidelines on the current slide.
## Tips ## Tips
@@ -208,6 +212,12 @@ manifest.xml # Add-in manifest
- **Long operations**: A progress counter and **Stop** button appear for large presentations. - **Long operations**: A progress counter and **Stop** button appear for large presentations.
- **Destructive actions**: Removals and Insert Titles ask for confirmation. - **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 ## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
+28 -6
View File
@@ -194,6 +194,7 @@ For raw Fluent buttons that need a confirmation dialog:
onConfirm={remove} onConfirm={remove}
confirmTitle="Remove the grid?" confirmTitle="Remove the grid?"
confirmMessage="This removes the grid from the current slide." confirmMessage="This removes the grid from the current slide."
confirmLabel="Remove"
> >
Remove Remove
</ConfirmButton> </ConfirmButton>
@@ -201,12 +202,15 @@ For raw Fluent buttons that need a confirmation dialog:
### Section ### 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 ```tsx
<Section title="My Feature"> <Accordion multiple collapsible defaultOpenItems={["content"]}>
<MyFeatureComponent /> <Section title="My Feature">
</Section> <MyFeatureComponent />
</Section>
</Accordion>
``` ```
## Creating a New Tool ## 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. 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 ## Performance Guidelines
- **Batch `context.sync()` calls.** Load all needed properties, then sync once. - **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. 4. Add confirmations for destructive operations.
5. Make repeated add operations idempotent. 5. Make repeated add operations idempotent.
6. Use Fluent `Field`/`Input`/`Dropdown` controls so labels and keyboard navigation work. 6. Use Fluent `Field`/`Input`/`Dropdown` controls so labels and keyboard navigation work.
7. Announce results through the status region (`role="status"`). 7. Use design tokens and follow `docs/UI_GUIDELINES.md` for any new UI.
8. Update docs when behavior changes. 8. Announce results through the status region (`role="status"`).
9. Update docs when behavior changes.
## Resources ## Resources
- [Office Add-ins documentation](https://learn.microsoft.com/office/dev/add-ins/) - [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) - [Office.js API reference](https://learn.microsoft.com/javascript/api/overview/office)
- [Fluent UI React v9](https://react.fluentui.dev/) - [Fluent UI React v9](https://react.fluentui.dev/)
- [Fluent 2 design system](https://fluent2.microsoft.design/)
- [Vitest](https://vitest.dev/) - [Vitest](https://vitest.dev/)
+127
View File
@@ -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 `<div>` 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
+13 -3
View File
@@ -14,15 +14,21 @@ This guide will help you use the Edison PowerPoint Add-in to create professional
### Interface Overview ### 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 - **Content** - Tools for manipulating content and shapes
- **Progress Bar** - Add/remove presentation progress indicators - **Progress Bar** - Add/remove presentation progress indicators
- **Confidential Marking** - Add/remove confidential labels - **Confidential Marking** - Add/remove confidential labels
- **Draft Watermark** - Add/remove draft watermarks - **Draft Watermark** - Add/remove draft watermarks
- **Alignment** - Tools for aligning shapes and objects - **Alignment** - Tools for aligning shapes and objects
- **Layout** - Grids and guidelines for the current slide - **Grid & Guidelines** - Grids and guidelines for the current slide
- **Settings** - Slide size and other per-presentation preferences - **Settings** - Slide size and version information
## Content Tools ## 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. 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 ### Horizontal Alignment
- **Left** - Aligns all shapes to the left edge of the slide - **Left** - Aligns all shapes to the left edge of the slide
+1 -1
View File
@@ -54,7 +54,7 @@ const Root: React.FC = () => {
}, []); }, []);
return ( return (
<FluentProvider theme={theme}> <FluentProvider theme={theme} style={{ height: "100%" }}>
<ErrorBoundary> <ErrorBoundary>
<SettingsProvider> <SettingsProvider>
<App /> <App />
+70 -70
View File
@@ -7,8 +7,13 @@
import * as React from "react"; import * as React from "react";
import { import {
Button, makeStyles,
makeStyles Text,
tokens,
Toolbar,
ToolbarButton,
ToolbarDivider,
Tooltip
} from "@fluentui/react-components"; } from "@fluentui/react-components";
import { import {
TextAlignLeftRegular, TextAlignLeftRegular,
@@ -39,22 +44,37 @@ type VerticalAlignmentType = 'top' | 'middle' | 'bottom';
* Component-specific styles * Component-specific styles
*/ */
const useStyles = makeStyles({ const useStyles = makeStyles({
alignmentGrid: { toolbar: {
display: "grid",
gridTemplateColumns: "repeat(3, 1fr)",
gap: "8px",
width: "100%"
},
alignButton: {
width: "100%", width: "100%",
minWidth: 0, flexWrap: "wrap",
padding: "8px 4px", gap: tokens.spacingHorizontalXS,
"& span": { padding: 0,
justifyContent: "center" 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 * AlignmentButtons component provides UI and functionality to align
* selected shapes in PowerPoint presentations. * selected shapes in PowerPoint presentations.
@@ -240,68 +260,48 @@ export const AlignmentButtons: React.FC = () => {
return ( return (
<div className={commonStyles.container}> <div className={commonStyles.container}>
<div className={styles.alignmentGrid}> <Text size={200} className={commonStyles.hint}>
<Button Select objects on the slide, then align them to the slide edges or center.
appearance="primary" </Text>
className={styles.alignButton} <Toolbar aria-label="Align selected objects" className={styles.toolbar}>
onClick={alignTop} <AlignButton
icon={<TextboxAlignTopRegular />} label="Align left"
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}
icon={<TextAlignLeftRegular />} icon={<TextAlignLeftRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Align Left" onClick={alignLeft}
> />
Left <AlignButton
</Button> label="Align center"
<Button
appearance="primary"
className={styles.alignButton}
onClick={alignCenter}
icon={<TextAlignCenterRegular />} icon={<TextAlignCenterRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Align Center" onClick={alignCenter}
> />
Center <AlignButton
</Button> label="Align right"
<Button
appearance="primary"
className={styles.alignButton}
onClick={alignRight}
icon={<TextAlignRightRegular />} icon={<TextAlignRightRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Align Right" onClick={alignRight}
> />
Right <ToolbarDivider />
</Button> <AlignButton
</div> 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> </div>
); );
}; };
+167 -114
View File
@@ -19,9 +19,11 @@ import AlignmentButtons from "./AlignmentButtons";
import GridGuidelineManager from "./GridGuidelineManager"; import GridGuidelineManager from "./GridGuidelineManager";
import Section from "./Section"; import Section from "./Section";
import { import {
Accordion,
Button, Button,
Dropdown, Dropdown,
Field, Field,
Image,
makeStyles, makeStyles,
Option, Option,
ProgressBar as FluentProgressBar, ProgressBar as FluentProgressBar,
@@ -48,23 +50,58 @@ const useStyles = makeStyles({
root: { root: {
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
padding: "16px", height: "100%",
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif", overflow: "hidden",
backgroundColor: tokens.colorNeutralBackground1, fontFamily: tokens.fontFamilyBase,
overflow: "auto", backgroundColor: tokens.colorNeutralBackground1
position: "absolute", },
top: 0, header: {
left: 0, display: "flex",
right: 0, flexShrink: 0,
bottom: 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: { statusContainer: {
marginTop: "4px", padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalS}`,
padding: "8px 12px", borderRadius: tokens.borderRadiusMedium,
fontSize: "13px", backgroundColor: tokens.colorNeutralBackground3
borderRadius: "6px",
backgroundColor: tokens.colorNeutralBackground3,
transition: "all 0.3s ease"
}, },
infoStatus: { infoStatus: {
backgroundColor: tokens.colorBrandBackground2, backgroundColor: tokens.colorBrandBackground2,
@@ -82,22 +119,18 @@ const useStyles = makeStyles({
backgroundColor: tokens.colorPaletteRedBackground1, backgroundColor: tokens.colorPaletteRedBackground1,
color: tokens.colorPaletteRedForeground1 color: tokens.colorPaletteRedForeground1
}, },
statusIcon: {
marginRight: "8px"
},
statusText: { statusText: {
display: "flex", display: "flex",
alignItems: "center" alignItems: "center",
gap: tokens.spacingHorizontalS
}, },
progressBar: { progressBar: {
marginTop: "8px" marginTop: tokens.spacingVerticalS
}, },
footer: { stopRow: {
fontSize: "12px", display: "flex",
color: tokens.colorNeutralForeground3, justifyContent: "flex-end",
textAlign: "center", marginTop: tokens.spacingVerticalXS
marginTop: "auto",
padding: "8px 0"
} }
}); });
@@ -132,16 +165,18 @@ const App: React.FC = () => {
const getStatusIcon = () => { const getStatusIcon = () => {
switch (statusType) { switch (statusType) {
case "success": case "success":
return <CheckmarkCircleRegular className={styles.statusIcon} />; return <CheckmarkCircleRegular />;
case "warning": case "warning":
return <WarningRegular className={styles.statusIcon} />; return <WarningRegular />;
case "error": case "error":
return <ErrorCircleRegular className={styles.statusIcon} />; return <ErrorCircleRegular />;
default: default:
return <InfoRegular className={styles.statusIcon} />; return <InfoRegular />;
} }
}; };
const hasStatus = isProcessing || Boolean(statusMessage);
return ( return (
<StatusContext.Provider value={{ <StatusContext.Provider value={{
statusMessage, statusMessage,
@@ -154,94 +189,112 @@ const App: React.FC = () => {
setProgress setProgress
}}> }}>
<div className={styles.root}> <div className={styles.root}>
<Section title="Content"> <header className={styles.header}>
<MatchProperties /> <Image src="assets/edison-32.png" alt="" width={32} height={32} />
<div style={{ marginTop: "8px" }}></div> <div className={styles.headerText}>
<MatchSizes /> <Text size={400} weight="semibold">Edison</Text>
<div style={{ marginTop: "8px" }}></div> <Text size={200} className={styles.muted}>PowerPoint toolbox</Text>
<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>
</div> </div>
)} </header>
{!isProcessing && statusMessage && ( <div className={styles.scrollArea}>
<div <Accordion
className={`${styles.statusContainer} ${styles[`${statusType}Status`]}`} multiple
role="status" collapsible
aria-live="polite" className={styles.accordion}
> >
<div className={styles.statusText}> <Section title="Content" value="content">
{getStatusIcon()} <MatchProperties />
{statusMessage} <MatchSizes />
</div> <SwapPositions />
</div> <InsertTitles />
)} <RoundImage />
</Section>
<div className={styles.footer}> <Section title="Progress Bar" value="progress-bar">
<Text size={100}>Edison • v{__APP_VERSION__}</Text> <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>
</div> </div>
</StatusContext.Provider> </StatusContext.Provider>
@@ -5,10 +5,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { import { Button, Text } from "@fluentui/react-components";
Button,
makeStyles
} from "@fluentui/react-components";
import { import {
ShieldLockRegular, ShieldLockRegular,
DismissRegular 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 * Interface for slide processing results
*/ */
@@ -77,7 +54,6 @@ interface ProcessingResult {
* @returns React component * @returns React component
*/ */
export const ConfidentialButtons: React.FC = () => { export const ConfidentialButtons: React.FC = () => {
const styles = useStyles();
const commonStyles = useCommonStyles(); const commonStyles = useCommonStyles();
const { slideSize } = useSettings(); const { slideSize } = useSettings();
const { const {
@@ -265,20 +241,21 @@ export const ConfidentialButtons: React.FC = () => {
return ( return (
<div className={commonStyles.container}> <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 <Button
appearance="primary" appearance="primary"
className={styles.confidentialButton}
onClick={addConfidentialMarking} onClick={addConfidentialMarking}
icon={<ShieldLockRegular />} icon={<ShieldLockRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Add Confidential" title="Add Confidential"
> >
Add Add confidential marking
</Button> </Button>
<ConfirmButton <ConfirmButton
appearance="primary" appearance="primary"
className={styles.confidentialButton}
onConfirm={removeConfidentialMarking} onConfirm={removeConfidentialMarking}
icon={<DismissRegular />} icon={<DismissRegular />}
disabled={isProcessing} disabled={isProcessing}
@@ -287,7 +264,7 @@ export const ConfidentialButtons: React.FC = () => {
confirmMessage="This removes the confidential marking from every slide in the presentation." confirmMessage="This removes the confidential marking from every slide in the presentation."
confirmLabel="Remove" confirmLabel="Remove"
> >
Remove Remove confidential markings
</ConfirmButton> </ConfirmButton>
</div> </div>
</div> </div>
+2 -2
View File
@@ -13,7 +13,7 @@ import {
DialogBody, DialogBody,
DialogContent, DialogContent,
DialogSurface, DialogSurface,
DialogTitle, DialogTitle
} from "@fluentui/react-components"; } from "@fluentui/react-components";
export interface ConfirmButtonProps { export interface ConfirmButtonProps {
@@ -74,7 +74,7 @@ export const ConfirmButton: React.FC<ConfirmButtonProps> = ({
<DialogTitle>{confirmTitle}</DialogTitle> <DialogTitle>{confirmTitle}</DialogTitle>
<DialogContent>{confirmMessage}</DialogContent> <DialogContent>{confirmMessage}</DialogContent>
<DialogActions> <DialogActions>
<Button appearance="secondary" onClick={() => setIsOpen(false)}> <Button appearance="primary" onClick={() => setIsOpen(false)}>
Cancel Cancel
</Button> </Button>
<Button appearance="primary" onClick={handleConfirm}> <Button appearance="primary" onClick={handleConfirm}>
+9 -32
View File
@@ -6,12 +6,9 @@
*/ */
import * as React from "react"; import * as React from "react";
import { Button, Text } from "@fluentui/react-components";
import { import {
Button, Edit20Regular,
makeStyles
} from "@fluentui/react-components";
import {
Edit24Regular,
DismissRegular DismissRegular
} from "@fluentui/react-icons"; } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
@@ -53,26 +50,6 @@ const DRAFT_CONFIG = {
].join("\n") ].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 * Interface for master slide processing results
*/ */
@@ -89,7 +66,6 @@ interface ProcessingResult {
* @returns React component * @returns React component
*/ */
export const DraftButtons: React.FC = () => { export const DraftButtons: React.FC = () => {
const styles = useStyles();
const commonStyles = useCommonStyles(); const commonStyles = useCommonStyles();
const { const {
setStatusMessage, setStatusMessage,
@@ -277,20 +253,21 @@ export const DraftButtons: React.FC = () => {
return ( return (
<div className={commonStyles.container}> <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 <Button
appearance="primary" appearance="primary"
className={styles.draftButton}
onClick={addDraftWatermark} onClick={addDraftWatermark}
icon={<Edit24Regular />} icon={<Edit20Regular />}
disabled={isProcessing} disabled={isProcessing}
title="Add Draft" title="Add Draft"
> >
Add Add draft watermark
</Button> </Button>
<ConfirmButton <ConfirmButton
appearance="primary" appearance="primary"
className={styles.draftButton}
onConfirm={removeDraftWatermark} onConfirm={removeDraftWatermark}
icon={<DismissRegular />} icon={<DismissRegular />}
disabled={isProcessing} disabled={isProcessing}
@@ -299,7 +276,7 @@ export const DraftButtons: React.FC = () => {
confirmMessage="This removes the DRAFT watermark from every slide master." confirmMessage="This removes the DRAFT watermark from every slide master."
confirmLabel="Remove" confirmLabel="Remove"
> >
Remove Remove draft watermarks
</ConfirmButton> </ConfirmButton>
</div> </div>
</div> </div>
+33 -9
View File
@@ -4,6 +4,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { Button, makeStyles, Text, tokens } from "@fluentui/react-components";
import { getErrorMessage } from "../types/office-types"; import { getErrorMessage } from "../types/office-types";
interface ErrorBoundaryProps { interface ErrorBoundaryProps {
@@ -15,6 +16,37 @@ interface ErrorBoundaryState {
message: string; 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> { export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
state: ErrorBoundaryState = { hasError: false, message: "" }; state: ErrorBoundaryState = { hasError: false, message: "" };
@@ -28,15 +60,7 @@ export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoun
render(): React.ReactNode { render(): React.ReactNode {
if (this.state.hasError) { if (this.state.hasError) {
return ( return <ErrorFallback message={this.state.message} />;
<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 this.props.children; return this.props.children;
+102 -99
View File
@@ -15,11 +15,12 @@ import {
Field, Field,
Input, Input,
makeStyles, makeStyles,
Label, Text,
ToggleButton, ToggleButton,
tokens tokens
} from "@fluentui/react-components"; } from "@fluentui/react-components";
import { import {
CheckmarkRegular,
DismissRegular, DismissRegular,
AddRegular, AddRegular,
LineHorizontal3Regular, LineHorizontal3Regular,
@@ -28,7 +29,6 @@ import {
} from "@fluentui/react-icons"; } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
import { useSettings } from "../context/SettingsContext"; import { useSettings } from "../context/SettingsContext";
import { useCommonStyles } from "./commonStyles";
import { deleteShapesByPrefix, getErrorMessage } from "../types/office-types"; import { deleteShapesByPrefix, getErrorMessage } from "../types/office-types";
import { SHAPE_NAME_PREFIXES } from "../constants"; import { SHAPE_NAME_PREFIXES } from "../constants";
import { isCancellationRequested, resetCancellation } from "../services/cancellation"; import { isCancellationRequested, resetCancellation } from "../services/cancellation";
@@ -85,64 +85,71 @@ interface ColorButtonProps {
} }
const useStyles = makeStyles({ const useStyles = makeStyles({
buttonGrid: { root: {
display: "grid", display: "flex",
gridTemplateColumns: "repeat(2, 1fr)", flexDirection: "column",
gap: "8px", gap: tokens.spacingVerticalM
width: "100%",
marginBottom: "8px"
}, },
gridButton: { hint: {
width: "100%", color: tokens.colorNeutralForeground3
minWidth: 0, },
padding: "8px 4px", field: {
"& span": { maxWidth: "180px"
justifyContent: "center"
}
}, },
controlRow: { controlRow: {
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
gap: "8px", gap: tokens.spacingHorizontalS
marginBottom: "8px"
}, },
controlLabel: { controlLabel: {
minWidth: "80px", minWidth: "48px",
marginBottom: "0" color: tokens.colorNeutralForeground2
}, },
controlInput: { colorGroup: {
flex: 1, display: "flex",
"& input[type=number]::-webkit-inner-spin-button, & input[type=number]::-webkit-outer-spin-button": { gap: tokens.spacingHorizontalXS
"-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"
}, },
colorButton: { colorButton: {
width: "24px", width: "32px",
height: "24px", height: "32px",
minWidth: "24px", minWidth: "32px",
padding: "0", padding: 0,
border: "1px solid " + tokens.colorNeutralStroke1, border: `1px solid ${tokens.colorNeutralStroke1}`,
marginLeft: "8px" borderRadius: tokens.borderRadiusMedium
}, },
colorButtonSelected: { 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 * ColorButton component - Renders a color selection button
* *
@@ -151,14 +158,26 @@ const useStyles = makeStyles({
*/ */
const ColorButton: React.FC<ColorButtonProps> = ({ color, selectedColor, onClick }) => { const ColorButton: React.FC<ColorButtonProps> = ({ color, selectedColor, onClick }) => {
const styles = useStyles(); const styles = useStyles();
const label = color.charAt(0).toUpperCase() + color.slice(1);
const selected = color === selectedColor;
return ( return (
<Button <Button
className={`${styles.colorButton} ${color === selectedColor ? styles.colorButtonSelected : ''}`} appearance="subtle"
style={{ backgroundColor: colorValues[color] }} className={`${styles.colorButton} ${selected ? styles.colorButtonSelected : ''}`}
style={{
backgroundColor: colorValues[color],
color: getSwatchForeground(color),
width: "32px",
minWidth: "32px",
height: "32px",
padding: 0
}}
onClick={() => onClick(color)} onClick={() => onClick(color)}
title={color.charAt(0).toUpperCase() + color.slice(1)} title={`${label} color`}
aria-label={`${color.charAt(0).toUpperCase() + color.slice(1)} color`} aria-label={`${label} color`}
aria-pressed={color === selectedColor} aria-pressed={selected}
icon={selected ? <CheckmarkRegular /> : undefined}
/> />
); );
}; };
@@ -200,7 +219,6 @@ const useNumericInputHandler = (initialValue: number): NumericInputHandler => {
*/ */
export const GridGuidelineManager: React.FC = () => { export const GridGuidelineManager: React.FC = () => {
const styles = useStyles(); const styles = useStyles();
const commonStyles = useCommonStyles();
const { slideSize } = useSettings(); const { slideSize } = useSettings();
const { const {
setStatusMessage, setStatusMessage,
@@ -572,17 +590,13 @@ export const GridGuidelineManager: React.FC = () => {
}, [setIsProcessing, setProgress, setStatusMessage, setStatusType]); }, [setIsProcessing, setProgress, setStatusMessage, setStatusType]);
return ( return (
<div className={commonStyles.container} style={{ maxHeight: "400px", overflowY: "auto" }}> <div className={styles.root}>
{/* Grid Controls */} <Text size={400} weight="semibold">Grid</Text>
<Label style={{ <Text size={200} className={styles.hint}>
fontWeight: "600", Grid lines are slide shapes and appear in slideshows and exports.
marginBottom: "12px", </Text>
fontSize: "16px"
}}>
Grid
</Label>
<Field label="Spacing" style={{ marginBottom: "8px" }}> <Field label="Spacing (pt)" className={styles.field}>
<Input <Input
type="number" type="number"
value={String(gridSpacing)} value={String(gridSpacing)}
@@ -590,11 +604,10 @@ export const GridGuidelineManager: React.FC = () => {
min={GRID_SPACING_MIN} min={GRID_SPACING_MIN}
max={Math.min(slideSize.width, slideSize.height)} max={Math.min(slideSize.width, slideSize.height)}
title="Grid spacing in points" title="Grid spacing in points"
style={{ width: "100px" }}
/> />
</Field> </Field>
<Field label="Opacity" style={{ marginBottom: "8px" }}> <Field label="Opacity (%)" className={styles.field}>
<Input <Input
type="number" type="number"
value={String(gridOpacity)} value={String(gridOpacity)}
@@ -602,13 +615,12 @@ export const GridGuidelineManager: React.FC = () => {
min={GRID_OPACITY_MIN} min={GRID_OPACITY_MIN}
max={GRID_OPACITY_MAX} max={GRID_OPACITY_MAX}
title="Grid opacity percentage" title="Grid opacity percentage"
style={{ width: "100px" }}
/> />
</Field> </Field>
<div className={styles.controlRow}> <div className={styles.controlRow}>
<Label className={styles.controlLabel}>Color</Label> <Text id="grid-color-label" size={200} className={styles.controlLabel}>Color</Text>
<div style={{ display: "flex" }}> <div className={styles.colorGroup} role="group" aria-labelledby="grid-color-label">
<ColorButton color="blue" selectedColor={gridColor} onClick={setGridColor} /> <ColorButton color="blue" selectedColor={gridColor} onClick={setGridColor} />
<ColorButton color="red" selectedColor={gridColor} onClick={setGridColor} /> <ColorButton color="red" selectedColor={gridColor} onClick={setGridColor} />
<ColorButton color="yellow" selectedColor={gridColor} onClick={setGridColor} /> <ColorButton color="yellow" selectedColor={gridColor} onClick={setGridColor} />
@@ -623,9 +635,9 @@ export const GridGuidelineManager: React.FC = () => {
onClick={createGrid} onClick={createGrid}
icon={<GridDotsRegular />} icon={<GridDotsRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Create Grid" title="Add grid"
> >
Add Add grid
</Button> </Button>
<ConfirmButton <ConfirmButton
appearance="primary" appearance="primary"
@@ -633,47 +645,39 @@ export const GridGuidelineManager: React.FC = () => {
onConfirm={removeGrid} onConfirm={removeGrid}
icon={<DismissRegular />} icon={<DismissRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Remove Grid" title="Remove grid"
confirmTitle="Remove the grid?" confirmTitle="Remove the grid?"
confirmMessage="This removes the grid from the current slide." confirmMessage="This removes the grid from the current slide."
confirmLabel="Remove" confirmLabel="Remove"
> >
Remove Remove grid
</ConfirmButton> </ConfirmButton>
</div> </div>
{/* Guidelines Section */} {/* Guidelines Section */}
<div className={styles.guidesContainer}> <div className={styles.guidesContainer}>
<Label style={{ <Text size={400} weight="semibold">Guidelines</Text>
fontWeight: "600",
marginBottom: "12px",
fontSize: "16px"
}}>
Guidelines
</Label>
<Field label="Position" style={{ marginBottom: "8px" }}> <Field label="Position (pt)" className={styles.field}>
<Input <Input
type="number" type="number"
value={String(guidePosition)} value={String(guidePosition)}
onChange={handleGuidePositionChange} onChange={handleGuidePositionChange}
min={0} min={0}
max={guideDirection === "horizontal" ? slideSize.height : slideSize.width} max={guideDirection === "horizontal" ? slideSize.height : slideSize.width}
title="Guideline position in points" title="Guideline position in points"
style={{ width: "100px" }} />
/> </Field>
</Field>
<div className={styles.controlRow}> <div className={styles.controlRow}>
<Label className={styles.controlLabel}>Type</Label> <Text id="guide-direction-label" size={200} className={styles.controlLabel}>Type</Text>
<div style={{ display: "flex", gap: "8px" }}> <div className={styles.colorGroup} role="group" aria-labelledby="guide-direction-label">
<ToggleButton <ToggleButton
size="small" size="small"
appearance="outline" appearance="outline"
checked={guideDirection === "horizontal"} checked={guideDirection === "horizontal"}
onClick={() => setGuideDirection("horizontal")} onClick={() => setGuideDirection("horizontal")}
icon={<LineHorizontal3Regular />} icon={<LineHorizontal3Regular />}
style={{ minWidth: "40px", padding: "2px 8px" }}
> >
Horizontal Horizontal
</ToggleButton> </ToggleButton>
@@ -683,7 +687,6 @@ export const GridGuidelineManager: React.FC = () => {
checked={guideDirection === "vertical"} checked={guideDirection === "vertical"}
onClick={() => setGuideDirection("vertical")} onClick={() => setGuideDirection("vertical")}
icon={<SplitVerticalRegular />} icon={<SplitVerticalRegular />}
style={{ minWidth: "40px", padding: "2px 8px" }}
> >
Vertical Vertical
</ToggleButton> </ToggleButton>
@@ -691,8 +694,8 @@ export const GridGuidelineManager: React.FC = () => {
</div> </div>
<div className={styles.controlRow}> <div className={styles.controlRow}>
<Label className={styles.controlLabel}>Color</Label> <Text id="guide-color-label" size={200} className={styles.controlLabel}>Color</Text>
<div style={{ display: "flex" }}> <div className={styles.colorGroup} role="group" aria-labelledby="guide-color-label">
<ColorButton color="blue" selectedColor={guideColor} onClick={setGuideColor} /> <ColorButton color="blue" selectedColor={guideColor} onClick={setGuideColor} />
<ColorButton color="red" selectedColor={guideColor} onClick={setGuideColor} /> <ColorButton color="red" selectedColor={guideColor} onClick={setGuideColor} />
<ColorButton color="yellow" selectedColor={guideColor} onClick={setGuideColor} /> <ColorButton color="yellow" selectedColor={guideColor} onClick={setGuideColor} />
@@ -700,16 +703,16 @@ export const GridGuidelineManager: React.FC = () => {
</div> </div>
</div> </div>
<div className={styles.guideButtonGrid}> <div className={styles.buttonGrid}>
<Button <Button
appearance="primary" appearance="primary"
className={styles.gridButton} className={styles.gridButton}
onClick={addGuideline} onClick={addGuideline}
icon={<AddRegular />} icon={<AddRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Add Guideline" title="Add guideline"
> >
Add Add guide
</Button> </Button>
<ConfirmButton <ConfirmButton
appearance="primary" appearance="primary"
@@ -717,12 +720,12 @@ export const GridGuidelineManager: React.FC = () => {
onConfirm={removeGuidelines} onConfirm={removeGuidelines}
icon={<DismissRegular />} icon={<DismissRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Remove All Guidelines" title="Remove all guidelines"
confirmTitle="Remove all guidelines?" confirmTitle="Remove all guidelines?"
confirmMessage="This removes every guideline from the current slide." confirmMessage="This removes every guideline from the current slide."
confirmLabel="Remove" confirmLabel="Remove"
> >
Remove Remove guides
</ConfirmButton> </ConfirmButton>
</div> </div>
</div> </div>
-38
View File
@@ -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;
+13 -1
View File
@@ -5,7 +5,7 @@
*/ */
import * as React from "react"; 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 { TextBulletListRegular } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
import { useSettings } from "../context/SettingsContext"; import { useSettings } from "../context/SettingsContext";
@@ -22,8 +22,15 @@ const DETECTION_LABELS: Record<TitleDetectionMethod, string> = {
first: "First text on slide" first: "First text on slide"
}; };
const useStyles = makeStyles({
dropdown: {
width: "100%"
}
});
export const InsertTitles: React.FC = () => { export const InsertTitles: React.FC = () => {
const styles = useCommonStyles(); const styles = useCommonStyles();
const localStyles = useStyles();
const { slideSize } = useSettings(); const { slideSize } = useSettings();
const { setStatusMessage, setStatusType, setIsProcessing, setProgress } = useStatusContext(); const { setStatusMessage, setStatusType, setIsProcessing, setProgress } = useStatusContext();
const [titleDetectionMethod, setTitleDetectionMethod] = const [titleDetectionMethod, setTitleDetectionMethod] =
@@ -109,6 +116,9 @@ export const InsertTitles: React.FC = () => {
return ( return (
<div className={styles.container}> <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}> <div className={styles.buttonGroup}>
<ActionButton <ActionButton
title="Insert Titles" title="Insert Titles"
@@ -122,6 +132,7 @@ export const InsertTitles: React.FC = () => {
<Field label="Title detection"> <Field label="Title detection">
<Dropdown <Dropdown
className={localStyles.dropdown}
value={DETECTION_LABELS[titleDetectionMethod]} value={DETECTION_LABELS[titleDetectionMethod]}
selectedOptions={[titleDetectionMethod]} selectedOptions={[titleDetectionMethod]}
onOptionSelect={(_, data) => { onOptionSelect={(_, data) => {
@@ -140,6 +151,7 @@ export const InsertTitles: React.FC = () => {
<Field label="Slide numbers"> <Field label="Slide numbers">
<Dropdown <Dropdown
className={localStyles.dropdown}
value={includeSlideNumbers ? "Include slide numbers" : "Exclude slide numbers"} value={includeSlideNumbers ? "Include slide numbers" : "Exclude slide numbers"}
selectedOptions={[includeSlideNumbers ? "yes" : "no"]} selectedOptions={[includeSlideNumbers ? "yes" : "no"]}
onOptionSelect={(_, data) => { onOptionSelect={(_, data) => {
@@ -6,6 +6,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { Text } from "@fluentui/react-components";
import { ColorRegular } from "@fluentui/react-icons"; import { ColorRegular } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
import { useCommonStyles } from "./commonStyles"; import { useCommonStyles } from "./commonStyles";
@@ -321,6 +322,9 @@ export const MatchProperties: React.FC = () => {
return ( return (
<div className={styles.container}> <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}> <div className={styles.buttonGroup}>
<ActionButton <ActionButton
title="Match Properties" title="Match Properties"
+4
View File
@@ -6,6 +6,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { Text } from "@fluentui/react-components";
import { ArrowFitInRegular } from "@fluentui/react-icons"; import { ArrowFitInRegular } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
import { useCommonStyles } from "./commonStyles"; import { useCommonStyles } from "./commonStyles";
@@ -178,6 +179,9 @@ export const MatchSizes: React.FC = () => {
return ( return (
<div className={styles.container}> <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}> <div className={styles.buttonGroup}>
<ActionButton <ActionButton
title="Match Sizes" title="Match Sizes"
+7 -27
View File
@@ -6,10 +6,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { import { Button, Text } from "@fluentui/react-components";
Button,
makeStyles
} from "@fluentui/react-components";
import { import {
GaugeRegular, GaugeRegular,
DismissRegular DismissRegular
@@ -25,25 +22,7 @@ import {
} from "../services/progressBar"; } from "../services/progressBar";
import ConfirmButton from "./ConfirmButton"; 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 = () => { export const ProgressBarButtons: React.FC = () => {
const styles = useStyles();
const commonStyles = useCommonStyles(); const commonStyles = useCommonStyles();
const { slideSize } = useSettings(); const { slideSize } = useSettings();
const { const {
@@ -135,20 +114,21 @@ export const ProgressBarButtons: React.FC = () => {
return ( return (
<div className={commonStyles.container}> <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 <Button
appearance="primary" appearance="primary"
className={styles.progressButton}
onClick={addProgressBar} onClick={addProgressBar}
icon={<GaugeRegular />} icon={<GaugeRegular />}
disabled={isProcessing} disabled={isProcessing}
title="Add Progress Bar" title="Add Progress Bar"
> >
Add Add progress bar
</Button> </Button>
<ConfirmButton <ConfirmButton
appearance="primary" appearance="primary"
className={styles.progressButton}
onConfirm={removeProgressBar} onConfirm={removeProgressBar}
icon={<DismissRegular />} icon={<DismissRegular />}
disabled={isProcessing} disabled={isProcessing}
@@ -157,7 +137,7 @@ export const ProgressBarButtons: React.FC = () => {
confirmMessage="This removes the progress bar from every slide in the presentation." confirmMessage="This removes the progress bar from every slide in the presentation."
confirmLabel="Remove" confirmLabel="Remove"
> >
Remove Remove progress bars
</ConfirmButton> </ConfirmButton>
</div> </div>
</div> </div>
+4
View File
@@ -6,6 +6,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { Text } from "@fluentui/react-components";
import { CircleRegular } from "@fluentui/react-icons"; import { CircleRegular } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
import { useCommonStyles } from "./commonStyles"; import { useCommonStyles } from "./commonStyles";
@@ -160,6 +161,9 @@ export const RoundImage: React.FC = () => {
return ( return (
<div className={styles.container}> <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}> <div className={styles.buttonGroup}>
<ActionButton <ActionButton
title="Round Image" title="Round Image"
+26 -27
View File
@@ -1,6 +1,5 @@
import * as React from "react"; import * as React from "react";
import { import {
Accordion,
AccordionHeader, AccordionHeader,
AccordionItem, AccordionItem,
AccordionPanel, AccordionPanel,
@@ -10,46 +9,46 @@ import {
interface SectionProps { interface SectionProps {
title: string; title: string;
/** Stable accordion value; defaults to the title. */
value?: string;
children: React.ReactNode; children: React.ReactNode;
} }
const useStyles = makeStyles({ const useStyles = makeStyles({
section: { item: {
marginBottom: "6px", borderBottomWidth: "1px",
padding: "12px", borderBottomStyle: "solid",
borderRadius: "8px", borderBottomColor: tokens.colorNeutralStroke3
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)"
}
}, },
accordion: { header: {
width: "100%" color: tokens.colorNeutralForeground1,
fontSize: tokens.fontSizeBase400,
fontWeight: tokens.fontWeightSemibold
}, },
sectionTitle: { stack: {
fontWeight: tokens.fontWeightSemibold, display: "flex",
color: tokens.colorBrandForeground1, flexDirection: "column",
fontSize: tokens.fontSizeBase400 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(); const styles = useStyles();
return ( return (
<div className={styles.section}> <AccordionItem value={value ?? title} className={styles.item}>
<Accordion collapsible defaultOpenItems={[title]} className={styles.accordion}> <AccordionHeader className={styles.header}>{title}</AccordionHeader>
<AccordionItem value={title}> <AccordionPanel>
<AccordionHeader className={styles.sectionTitle}>{title}</AccordionHeader> <div className={styles.stack}>{children}</div>
<AccordionPanel>{children}</AccordionPanel> </AccordionPanel>
</AccordionItem> </AccordionItem>
</Accordion>
</div>
); );
}; };
@@ -6,6 +6,7 @@
*/ */
import * as React from "react"; import * as React from "react";
import { Text } from "@fluentui/react-components";
import { ArrowSwapRegular } from "@fluentui/react-icons"; import { ArrowSwapRegular } from "@fluentui/react-icons";
import { useStatusContext } from "../context/StatusContext"; import { useStatusContext } from "../context/StatusContext";
import { useCommonStyles } from "./commonStyles"; import { useCommonStyles } from "./commonStyles";
@@ -142,6 +143,9 @@ export const SwapPositions: React.FC = () => {
return ( return (
<div className={styles.container}> <div className={styles.container}>
<Text size={200} className={styles.hint}>
Select exactly two shapes to exchange their positions.
</Text>
<div className={styles.buttonGroup}> <div className={styles.buttonGroup}>
<ActionButton <ActionButton
title="Swap Positions" title="Swap Positions"
+15 -34
View File
@@ -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({ export const useCommonStyles = makeStyles({
container: { container: {
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
width: "100%", width: "100%",
gap: tokens.spacingVerticalS
}, },
buttonGroup: { buttonGroup: {
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
gap: "8px", gap: tokens.spacingVerticalS
marginBottom: "2px",
}, },
actionButton: { actionButton: {
justifyContent: "flex-start", justifyContent: "flex-start",
transitionProperty: "all", transitionProperty: "background-color, border-color, color",
transitionDuration: "200ms", transitionDuration: tokens.durationNormal,
transitionTimingFunction: "cubic-bezier(0.33, 0, 0.67, 1)", 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
}
}); });
+9
View File
@@ -7,9 +7,18 @@ import Root from "./Root";
const rootElement: HTMLElement | null = document.getElementById("container"); const rootElement: HTMLElement | null = document.getElementById("container");
const root = rootElement ? createRoot(rootElement) : undefined; const root = rootElement ? createRoot(rootElement) : undefined;
const hideLoadingIndicator = (): void => {
const loading = document.getElementById("loading");
if (!loading) return;
loading.style.opacity = "0";
window.setTimeout(() => loading.remove(), 200);
};
/* Render application after Office initializes */ /* Render application after Office initializes */
Office.onReady(() => { Office.onReady(() => {
root?.render(<Root />); root?.render(<Root />);
window.requestAnimationFrame(hideLoadingIndicator);
}); });
// Define proper module hot interface for webpack hot module replacement // Define proper module hot interface for webpack hot module replacement
+43 -35
View File
@@ -15,23 +15,46 @@
<style> <style>
:root { :root {
color-scheme: light dark;
--system-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; --system-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
--background: #faf9f8;
--foreground: #242424;
--accent: #0f6cbd;
--accent-soft: rgba(15, 108, 189, 0.25);
--error-background: #fde7e9;
--error-foreground: #a80000;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #1f1f1f;
--foreground: #ffffff;
--accent: #479ef5;
--accent-soft: rgba(71, 158, 245, 0.3);
--error-background: #3b1a1c;
--error-foreground: #ff99a4;
}
}
html,
body,
#container {
width: 100%;
height: 100%;
} }
body { body {
width: 100%;
height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: var(--system-font); font-family: var(--system-font);
background-color: var(--background);
color: var(--foreground);
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
overflow: hidden; overflow: hidden;
} }
#container { #container {
width: 100%; overflow: hidden;
height: 100%;
overflow: auto;
} }
/* Custom scrollbar for macOS style */ /* Custom scrollbar for macOS style */
@@ -69,28 +92,31 @@
padding: 16px; padding: 16px;
margin: 20px; margin: 20px;
border-radius: 8px; border-radius: 8px;
background-color: #FEF0F1; background-color: var(--error-background);
color: #D13438; color: var(--error-foreground);
font-family: var(--system-font); font-family: var(--system-font);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
line-height: 1.5; line-height: 1.5;
} }
/* Loading animation */ /* Loading animation */
.loading-container { #loading {
position: fixed;
inset: 0;
z-index: 10;
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
height: 100vh; justify-content: center;
background-color: var(--background);
transition: opacity 0.2s ease;
} }
.spinner { .spinner {
width: 40px; width: 32px;
height: 40px; height: 32px;
border: 3px solid rgba(0, 120, 212, 0.2); border: 3px solid var(--accent-soft);
border-radius: 50%; border-radius: 50%;
border-top-color: #0078D4; border-top-color: var(--accent);
animation: spin 1s ease-in-out infinite; animation: spin 1s linear infinite;
} }
@keyframes spin { @keyframes spin {
@@ -101,7 +127,7 @@
<body> <body>
<!-- Loading spinner shown until React loads --> <!-- Loading spinner shown until React loads -->
<div id="loading" class="loading-container"> <div id="loading">
<div class="spinner"></div> <div class="spinner"></div>
</div> </div>
@@ -126,24 +152,6 @@
document.getElementById("container").style.display = "none"; document.getElementById("container").style.display = "none";
document.getElementById("loading").style.display = "none"; document.getElementById("loading").style.display = "none";
} }
// Hide loading spinner when the app is loaded
window.addEventListener('DOMContentLoaded', function() {
// The React app will remove the loading element when it's ready
setTimeout(function() {
var loadingEl = document.getElementById("loading");
if (loadingEl) {
loadingEl.style.opacity = "0";
loadingEl.style.transition = "opacity 0.3s ease";
setTimeout(function() {
if (loadingEl.parentNode) {
loadingEl.parentNode.removeChild(loadingEl);
}
}, 300);
}
}, 500);
});
</script> </script>
</body> </body>