Skip to content

Your favorite shift management application!

feat(ui): personal view setting for wrapped shift titles (#226)

panteL5d54eda21ffa
diff --git a/app/page.tsx b/app/page.tsx
index dbd450b..c0c558f 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -551,6 +551,7 @@ function HomeContent() {
onChange: viewSettings.updatePersonal,
}}
showShiftNotes={calendarView.showShiftNotes}
+ wrapShiftTitles={calendarView.wrapShiftTitles}
highlightedWeekdays={calendarView.highlightedWeekdays}
highlightColor={calendarView.highlightColor}
canCreateShift={can("createShift")}
diff --git a/components/calendar-workspace.tsx b/components/calendar-workspace.tsx
index 7464ebf..79016a7 100644
--- a/components/calendar-workspace.tsx
+++ b/components/calendar-workspace.tsx
@@ -53,6 +53,8 @@ interface CalendarWorkspaceProps {
/** List view only: the personal sort, plus whether a calendar-pinned view locks it */
listSort: ListSort;
showShiftNotes: boolean;
+ /** Personal setting: month cells wrap a long title instead of cutting it */
+ wrapShiftTitles: boolean;
highlightedWeekdays: number[];
highlightColor: string;
/** createShift — gates the manual "add a new shift" affordance only */
@@ -98,6 +100,7 @@ export function CalendarWorkspace({
layout,
listSort,
showShiftNotes,
+ wrapShiftTitles,
highlightedWeekdays,
highlightColor,
canCreateShift,
@@ -295,6 +298,7 @@ export function CalendarWorkspace({
togglingDates={togglingDates}
layout={layout}
showShiftNotes={showShiftNotes}
+ wrapShiftTitles={wrapShiftTitles}
highlightedWeekdays={highlightedWeekdays}
highlightColor={highlightColor}
onDayClick={onDayClick}
diff --git a/components/day-cell-entries.tsx b/components/day-cell-entries.tsx
index 399d27f..ddfbbf1 100644
--- a/components/day-cell-entries.tsx
+++ b/components/day-cell-entries.tsx
@@ -130,14 +130,25 @@ export function useDayPress(
});
}
-/** Compact "N" / "N/capacity" badge. */
-export function SignupBadge({ shift, enabled }: { shift: ShiftWithCalendar; enabled: boolean }) {
- const t = useTranslations();
+/** The badge's text, or null when it stays hidden; the month grid measures it for its cell heights. */
+export function signupBadgeLabel(shift: ShiftWithCalendar, enabled: boolean): string | null {
if (!enabled) return null;
const count = shift.signups?.length ?? 0;
const capacity = shift.signupCapacity ?? null;
if (count === 0 && capacity == null) return null;
- const label = capacity != null ? formatSignupCapacityLabel(t, count, capacity) : null;
+ return capacity != null ? `${count}/${capacity}` : String(count);
+}
+
+/** Compact "N" / "N/capacity" badge. */
+export function SignupBadge({ shift, enabled }: { shift: ShiftWithCalendar; enabled: boolean }) {
+ const t = useTranslations();
+ const text = signupBadgeLabel(shift, enabled);
+ if (text === null) return null;
+ const capacity = shift.signupCapacity ?? null;
+ const label =
+ capacity != null
+ ? formatSignupCapacityLabel(t, shift.signups?.length ?? 0, capacity)
+ : null;
return (
<span
className={cn(
@@ -146,7 +157,7 @@ export function SignupBadge({ shift, enabled }: { shift: ShiftWithCalendar; enab
)}
title={label?.text}
>
- {capacity != null ? `${count}/${capacity}` : count}
+ {text}
</span>
);
}
@@ -194,6 +205,9 @@ const CHIP =
"shift-chip flex min-w-0 shrink-0 gap-1.5 rounded-[6px] py-0.5 pr-[7px] dark:[--shift-tint:14%]";
// Month cells cut titles to one line; week and list let them wrap
const lineClass = (wrap: boolean) => (wrap ? "block break-words" : "block truncate");
+// Month cells may instead wrap the title onto a second line (personal view setting)
+const titleClass = (wrap: boolean, lines: 1 | 2) =>
+ wrap || lines === 1 ? lineClass(wrap) : "line-clamp-2 break-words";
function ChipTime({
shift,
@@ -246,6 +260,7 @@ export function ShiftChip({
signupsEnabled,
customFieldDefinitions = [],
wrap = false,
+ titleLines = 1,
interactive = false,
}: {
shift: ShiftWithCalendar;
@@ -253,6 +268,8 @@ export function ShiftChip({
signupsEnabled: boolean;
customFieldDefinitions?: CustomFieldDefinition[];
wrap?: boolean;
+ /** Month cells only: 2 lets a long title run onto a second line before the ellipsis */
+ titleLines?: 1 | 2;
/** Week view only: the cell is a div, not a button, so a nested signup button is valid here */
interactive?: boolean;
}) {
@@ -292,7 +309,7 @@ export function ShiftChip({
<span className={cn(CHIP, "pl-[5px]")} style={shiftVars(shift.color)} title={title}>
<span className="shift-rail w-[3px] shrink-0 self-stretch rounded-full" />
<span className="min-w-0 flex-1">
- <span className={cn(lineClass(wrap), "text-[11.5px] font-medium leading-4")}>
+ <span className={cn(titleClass(wrap, titleLines), "text-[11.5px] font-medium leading-4")}>
{shift.title}
</span>
{showNote && shift.notes && (
@@ -317,9 +334,12 @@ export function ShiftChip({
export function ExternalShiftChip({
shift,
wrap = false,
+ titleLines = 1,
}: {
shift: ShiftWithCalendar;
wrap?: boolean;
+ /** Month cells only: 2 lets a long title run onto a second line before the ellipsis */
+ titleLines?: 1 | 2;
}) {
// Wrap mode: title column stacks the time below itself instead of beside it
if (wrap) {
@@ -339,7 +359,12 @@ export function ExternalShiftChip({
return (
<span className={cn(CHIP, "pl-[5px] items-center")} style={shiftVars(shift.color)} title={shift.title}>
<RefreshCw className="size-3 shrink-0" />
- <span className={cn("min-w-0 flex-1 text-[11.5px] font-medium leading-4", lineClass(wrap))}>
+ <span
+ className={cn(
+ "min-w-0 flex-1 text-[11.5px] font-medium leading-4",
+ titleClass(wrap, titleLines)
+ )}
+ >
{shift.title}
</span>
<ChipTime shift={shift} full={wrap} />
diff --git a/components/month-grid.tsx b/components/month-grid.tsx
index 39cf07f..2a45e78 100644
--- a/components/month-grid.tsx
+++ b/components/month-grid.tsx
@@ -17,6 +17,7 @@ import {
NoteLine,
ShiftChip,
SignupBadge,
+ signupBadgeLabel,
TODAY_BADGE,
buildDayContents,
useDayPress,
@@ -24,6 +25,7 @@ import {
} from "@/components/day-cell-entries";
import { hasVisibleCustomFields } from "@/components/custom-field-summary";
import { useCustomFields } from "@/hooks/useCustomFields";
+import { cellFont, cellMonoFont, countWrappedLines, textWidth } from "@/lib/text-measure";
const WEEKDAY_KEYS = [
"monday",
@@ -44,17 +46,43 @@ const DESKTOP_ROW = 20;
const DESKTOP_PLAIN_ROW = 18;
const DESKTOP_SUB_LINE = 14;
const DESKTOP_OVERFLOW = 14;
+const DESKTOP_TITLE_LINE = 16; // a second title line, leading-4
+// Horizontal chip geometry: cell px-2, chip pl-[5px]/pr-[7px], gap-1.5 between the columns
+const DESKTOP_CELL_PAD = 16;
+const DESKTOP_CHIP_PAD = 12;
+const DESKTOP_GAP_X = 6;
+const DESKTOP_RAIL = 3;
+const DESKTOP_SYNC_ICON = 12;
+const DESKTOP_SPLIT_ICON = 11; // size-[9px] plus its gap-0.5
+const DESKTOP_TIME_MAX = 0.45; // ChipTime is capped at max-w-[45%]
+const DESKTOP_BADGE_PAD = 8;
const PHONE_MIN_ROW = 84; // two fields plus the counter
const PHONE_CHROME = 30; // 5 padding, 22 head, 3 gap
const PHONE_GAP = 2;
const PHONE_FIELD = 19;
+const PHONE_FIELD_WRAP = 20; // py-[3px] plus one leading-[14px] line
+const PHONE_FIELD_WRAP_LINE = 14;
+const PHONE_FIELD_PAD = 12; // cell px-[2px], field px-1
const PHONE_COUNTER = 12;
const PHONE_MAX_FIELDS = 3;
const PHONE_HEAD_FIXED = 32; // 4 cell padding, 3 head padding, 22 day number, 3 gap
const PHONE_MARK = 10;
const PHONE_MAX_MARKS = 3;
const PHONE_FALLBACK_COL = 54; // 390px viewport, used until the grid is measured
+const MAX_TITLE_LINES = 2;
+
+/** Width left for the title beside the rail/icon, the optional signup badge and the time. */
+function desktopTitleWidth(
+ colWidth: number,
+ leading: number,
+ timeWidth: number,
+ badgeWidth: number
+): number {
+ const inner = colWidth - DESKTOP_CELL_PAD - DESKTOP_CHIP_PAD - leading - DESKTOP_GAP_X;
+ const time = Math.min(timeWidth, inner * DESKTOP_TIME_MAX);
+ return inner - DESKTOP_GAP_X - time - (badgeWidth > 0 ? badgeWidth + DESKTOP_GAP_X : 0);
+}
type Variant = "desktop" | "phone" | "compare";
@@ -130,6 +158,8 @@ interface MonthGridProps {
layout: DayLayoutOptions;
/** Desktop only: a shift's own note as a second line */
showShiftNotes?: boolean;
+ /** Personal setting: let a long title wrap instead of cutting it off */
+ wrapShiftTitles?: boolean;
highlightedWeekdays?: number[];
highlightColor?: string;
onDayClick: (date: Date) => void;
@@ -153,6 +183,7 @@ export function MonthGrid({
togglingDates,
layout,
showShiftNotes = false,
+ wrapShiftTitles = false,
highlightedWeekdays = [],
highlightColor,
onDayClick,
@@ -181,6 +212,53 @@ export function MonthGrid({
: (gridSize.height - (rows - 1)) / rows;
const colWidth = gridSize.width > 0 ? (gridSize.width - 8) / 7 : PHONE_FALLBACK_COL;
+ // Cell heights are computed in px, so a wrapped title has to be measured up front
+ const wrapTitles = wrapShiftTitles && variant !== "compare";
+ const fonts = useMemo(
+ () => ({
+ title: cellFont(500, 11.5),
+ time: cellMonoFont(400, 10.5),
+ badge: cellMonoFont(400, 10),
+ field: cellFont(600, 11),
+ }),
+ []
+ );
+
+ const desktopShiftLines = (shift: ShiftWithCalendar) => {
+ if (!wrapTitles) return 1;
+ const time = shift.isAllDay
+ ? t("calendarView.allDayShort")
+ : shift.startTime.slice(0, 5);
+ const split = !shift.isAllDay && (shift.segments?.length ?? 0) > 0;
+ const badge = signupBadgeLabel(shift, signupsEnabled(shift.calendarId));
+ const width = desktopTitleWidth(
+ colWidth,
+ DESKTOP_RAIL,
+ textWidth(time, fonts.time) + (split ? DESKTOP_SPLIT_ICON : 0),
+ badge ? textWidth(badge, fonts.badge) + DESKTOP_BADGE_PAD : 0
+ );
+ return countWrappedLines(shift.title, fonts.title, width, MAX_TITLE_LINES);
+ };
+
+ const desktopExternalLines = (shift: ShiftWithCalendar) => {
+ if (!wrapTitles) return 1;
+ const time = shift.isAllDay
+ ? t("calendarView.allDayShort")
+ : shift.startTime.slice(0, 5);
+ const width = desktopTitleWidth(
+ colWidth,
+ DESKTOP_SYNC_ICON,
+ textWidth(time, fonts.time),
+ 0
+ );
+ return countWrappedLines(shift.title, fonts.title, width, MAX_TITLE_LINES);
+ };
+
+ const phoneFieldLines = (title: string) =>
+ wrapTitles
+ ? countWrappedLines(title, fonts.field, colWidth - PHONE_FIELD_PAD, MAX_TITLE_LINES)
+ : 1;
+
// One pass over the month instead of scanning every shift and note per cell
const { maxShifts, maxExternalShifts, sortType, sortOrder, combinedSort } = layout;
const dayContents = useMemo(() => {
@@ -247,15 +325,24 @@ export function MonthGrid({
...content.events.map((note) => ({ kind: "event" as const, key: note.id, note })),
...content.notes.map((note) => ({ kind: "note" as const, key: note.id, note })),
];
- const heights = entries.map((entry) => {
+ const titleLines = entries.map((entry) =>
+ entry.kind === "shift"
+ ? desktopShiftLines(entry.shift)
+ : entry.kind === "external"
+ ? desktopExternalLines(entry.shift)
+ : 1
+ );
+ const heights = entries.map((entry, index) => {
+ const extraTitle = (titleLines[index] - 1) * DESKTOP_TITLE_LINE;
if (entry.kind === "shift") {
const noteLine = showShiftNotes && entry.shift.notes ? DESKTOP_SUB_LINE : 0;
const fieldLine = hasVisibleCustomFields(entry.shift.customFields, customFieldDefinitions)
? DESKTOP_SUB_LINE
: 0;
- return DESKTOP_ROW + noteLine + fieldLine;
+ return DESKTOP_ROW + extraTitle + noteLine + fieldLine;
}
- return entry.kind === "note" ? DESKTOP_PLAIN_ROW : DESKTOP_ROW;
+ if (entry.kind === "note") return DESKTOP_PLAIN_ROW;
+ return DESKTOP_ROW + extraTitle;
});
const shown = fitCount(
heights,
@@ -285,7 +372,8 @@ export function MonthGrid({
return (
<>
- {entries.slice(0, shown).map((entry) => {
+ {entries.slice(0, shown).map((entry, index) => {
+ const lines = titleLines[index] === 2 ? (2 as const) : (1 as const);
switch (entry.kind) {
case "shift":
return (
@@ -295,10 +383,11 @@ export function MonthGrid({
showNote={showShiftNotes}
signupsEnabled={signupsEnabled(entry.shift.calendarId)}
customFieldDefinitions={customFieldDefinitions}
+ titleLines={lines}
/>
);
case "external":
- return <ExternalShiftChip key={entry.key} shift={entry.shift} />;
+ return <ExternalShiftChip key={entry.key} shift={entry.shift} titleLines={lines} />;
case "event":
return <EventChip key={entry.key} note={entry.note} />;
case "note":
@@ -328,8 +417,15 @@ export function MonthGrid({
shift: undefined,
})),
];
+ const fieldLines = fields.map((field) =>
+ field.shift ? phoneFieldLines(field.shift.title) : 1
+ );
const shown = fitCount(
- fields.map(() => PHONE_FIELD),
+ fields.map((_, index) =>
+ wrapTitles
+ ? PHONE_FIELD_WRAP + (fieldLines[index] - 1) * PHONE_FIELD_WRAP_LINE
+ : PHONE_FIELD
+ ),
hiddenCount,
rowHeight - PHONE_CHROME,
PHONE_MAX_FIELDS,
@@ -341,14 +437,23 @@ export function MonthGrid({
return (
<span className="flex min-w-0 flex-col gap-[2px]">
{fields.slice(0, shown).map((field) => (
- // Cut hard at the field edge, no ellipsis: the first letters identify a shift
<span
key={field.key}
- className="shift-field flex h-[19px] shrink-0 items-center gap-[2px] overflow-hidden whitespace-nowrap rounded-[4px] px-1 text-[11px] font-semibold leading-[19px]"
+ className={cn(
+ "shift-field flex shrink-0 items-center gap-[2px] overflow-hidden rounded-[4px] px-1 text-[11px] font-semibold",
+ wrapTitles
+ ? "min-h-[20px] py-[3px] leading-[14px]"
+ : "h-[19px] whitespace-nowrap leading-[19px]"
+ )}
style={shiftVars(field.color)}
>
{field.shift ? (
- field.shift.title
+ wrapTitles ? (
+ <span className="min-w-0 line-clamp-2 break-words">{field.shift.title}</span>
+ ) : (
+ // Cut hard at the field edge, no ellipsis: the first letters identify a shift
+ field.shift.title
+ )
) : (
<>
<RefreshCw className="size-2.5 shrink-0" />
diff --git a/components/view-settings-sheet.tsx b/components/view-settings-sheet.tsx
index 4e109b8..bf3f909 100644
--- a/components/view-settings-sheet.tsx
+++ b/components/view-settings-sheet.tsx
@@ -95,6 +95,7 @@ function ViewFields({
disabled = false,
stampBar,
onlyMyShifts,
+ wrapTitles,
}: {
value: CalendarViewSettings;
onChange: (patch: Partial<CalendarViewSettings>) => void;
@@ -108,6 +109,8 @@ function ViewFields({
/** The selected calendar has signups turned off, so the filter would show nothing */
signupsDisabled?: boolean;
};
+ /** Only the personal view carries the wrapped-title toggle */
+ wrapTitles?: { checked: boolean; onChange: (checked: boolean) => void };
}) {
const t = useTranslations();
const id = useId();
@@ -122,8 +125,8 @@ function ViewFields({
{ day: 0, label: t("view.sunday") },
];
const days = value.highlightedWeekdays;
- // Neither is part of CalendarViewSettings, so a calendar's own view can never take them over
- const hasPersonalSection = !!stampBar || !!onlyMyShifts;
+ // None of these is part of CalendarViewSettings, so a calendar's own view can never take them over
+ const hasPersonalSection = !!stampBar || !!onlyMyShifts || !!wrapTitles;
return (
<div className="flex flex-col gap-6">
@@ -153,6 +156,15 @@ function ViewFields({
)}
</>
)}
+ {wrapTitles && (
+ <ToggleRow
+ id={`${id}-wrap-titles`}
+ title={t("view.wrapTitles")}
+ description={t("view.wrapTitlesHint")}
+ checked={wrapTitles.checked}
+ onCheckedChange={wrapTitles.onChange}
+ />
+ )}
</section>
)}
@@ -476,6 +488,10 @@ export function PersonalViewPanel({
}
: undefined
}
+ wrapTitles={{
+ checked: personal.wrapShiftTitles,
+ onChange: (wrapShiftTitles) => updatePersonal({ wrapShiftTitles }),
+ }}
/>
</div>
</PanelBody>
diff --git a/hooks/useViewSettings.ts b/hooks/useViewSettings.ts
index b51b394..dc271b7 100644
--- a/hooks/useViewSettings.ts
+++ b/hooks/useViewSettings.ts
@@ -24,6 +24,7 @@ const STORAGE_KEYS = {
hidePresetHeader: "hide-preset-header",
highlightedWeekdays: "highlighted-weekdays",
highlightColor: "highlight-color",
+ wrapShiftTitles: "wrap-shift-titles",
} as const;
function readStorage(key: string): string | null {
@@ -79,6 +80,7 @@ function readLocalViewSettings(): PersonalViewSettings {
showStampBar: hidePresetHeader === undefined ? undefined : !hidePresetHeader,
highlightedWeekdays: parseJson(readStorage(STORAGE_KEYS.highlightedWeekdays)),
highlightColor: readStorage(STORAGE_KEYS.highlightColor) ?? undefined,
+ wrapShiftTitles: parseBoolean(readStorage(STORAGE_KEYS.wrapShiftTitles)),
});
}
@@ -93,6 +95,7 @@ function writeLocalViewSettings(settings: PersonalViewSettings) {
writeStorage(STORAGE_KEYS.hidePresetHeader, String(!settings.showStampBar));
writeStorage(STORAGE_KEYS.highlightedWeekdays, JSON.stringify(settings.highlightedWeekdays));
writeStorage(STORAGE_KEYS.highlightColor, settings.highlightColor);
+ writeStorage(STORAGE_KEYS.wrapShiftTitles, String(settings.wrapShiftTitles));
}
async function fetchPersonalViewSettingsApi(): Promise<PersonalViewSettings | null> {
diff --git a/lib/text-measure.ts b/lib/text-measure.ts
new file mode 100644
index 0000000..d29e9f1
--- /dev/null
+++ b/lib/text-measure.ts
@@ -0,0 +1,95 @@
+// Canvas text measurement for the month grid: cell heights are computed in px before
+// the browser lays the text out, so a wrapped title has to be predicted, not observed.
+
+const widths = new Map<string, number>();
+let context: CanvasRenderingContext2D | null | undefined;
+
+function getContext(): CanvasRenderingContext2D | null {
+ if (context !== undefined) return context;
+ try {
+ context = document.createElement("canvas").getContext("2d");
+ } catch {
+ context = null;
+ }
+ return context;
+}
+
+function measure(ctx: CanvasRenderingContext2D, font: string, text: string): number {
+ const key = `${font}\u0000${text}`;
+ const cached = widths.get(key);
+ if (cached !== undefined) return cached;
+ ctx.font = font;
+ const width = ctx.measureText(text).width;
+ widths.set(key, width);
+ return width;
+}
+
+const families = new Map<string, string>();
+
+/** Reads a family once per page; `variable` is a CSS custom property such as `--font-mono`. */
+function fontFamily(variable: string | null, fallback: string): string {
+ const key = variable ?? "";
+ const cached = families.get(key);
+ if (cached !== undefined) return cached;
+ if (typeof window === "undefined") return fallback;
+ const style = getComputedStyle(document.body);
+ const family = (variable ? style.getPropertyValue(variable) : style.fontFamily).trim();
+ const resolved = family || fallback;
+ families.set(key, resolved);
+ return resolved;
+}
+
+/** A CSS font shorthand for a cell line, using whatever family the page renders in. */
+export function cellFont(weight: number, sizePx: number): string {
+ return `${weight} ${sizePx}px ${fontFamily(null, "sans-serif")}`;
+}
+
+export function cellMonoFont(weight: number, sizePx: number): string {
+ return `${weight} ${sizePx}px ${fontFamily("--font-mono", "ui-monospace, monospace")}`;
+}
+
+/** Width of `text` in `font`, or 0 without a canvas. */
+export function textWidth(text: string, font: string): number {
+ const ctx = getContext();
+ return ctx ? measure(ctx, font, text) : 0;
+}
+
+/**
+ * How many lines `text` needs at `maxWidth`, capped at `maxLines`. Mirrors the CSS the chips
+ * use: wrap at spaces, break an overlong word. Without a canvas (SSR) it reports one line,
+ * which is the non-wrapping layout and therefore never over-reserves.
+ */
+export function countWrappedLines(
+ text: string,
+ font: string,
+ maxWidth: number,
+ maxLines: number
+): number {
+ const trimmed = text.trim();
+ if (!trimmed || maxLines <= 1 || maxWidth <= 0) return 1;
+ const ctx = getContext();
+ if (!ctx) return 1;
+ if (measure(ctx, font, trimmed) <= maxWidth) return 1;
+
+ const space = measure(ctx, font, " ");
+ let lines = 1;
+ let used = 0;
+ for (const word of trimmed.split(/\s+/)) {
+ const width = measure(ctx, font, word);
+ const next = used === 0 ? width : used + space + width;
+ if (used > 0 && next > maxWidth) {
+ lines++;
+ if (lines >= maxLines) return maxLines;
+ used = width;
+ } else {
+ used = next;
+ }
+ if (used > maxWidth) {
+ const broken = Math.ceil(used / maxWidth) - 1;
+ lines += broken;
+ if (lines >= maxLines) return maxLines;
+ used -= broken * maxWidth;
+ }
+ }
+ return Math.min(lines, maxLines);
+}
diff --git a/lib/view-settings.ts b/lib/view-settings.ts
index 5844ae8..318f537 100644
--- a/lib/view-settings.ts
+++ b/lib/view-settings.ts
@@ -15,10 +15,12 @@ export interface CalendarViewSettings {
highlightColor: string;
}
-/** A user's own view; the stamp bar and the own-shifts filter are never taken over by a calendar. */
+/** A user's own view; these extra fields are never taken over by a calendar. */
export interface PersonalViewSettings extends CalendarViewSettings {
showStampBar: boolean;
onlyMyShifts: boolean;
+ /** Month cells wrap a long shift title onto a second line instead of cutting it */
+ wrapShiftTitles: boolean;
}
export const SHIFTS_PER_DAY_MAX = 3;
@@ -46,6 +48,7 @@ export const DEFAULT_PERSONAL_VIEW_SETTINGS: PersonalViewSettings = {
...DEFAULT_CALENDAR_VIEW_SETTINGS,
showStampBar: true,
onlyMyShifts: false,
+ wrapShiftTitles: false,
};
function isRecord(value: unknown): value is Record<string, unknown> {
@@ -105,6 +108,10 @@ export function sanitizePersonalViewSettings(input: unknown): PersonalViewSettin
...sanitizeCalendarViewSettings(src),
showStampBar: sanitizeBoolean(src.showStampBar, DEFAULT_PERSONAL_VIEW_SETTINGS.showStampBar),
onlyMyShifts: sanitizeBoolean(src.onlyMyShifts, DEFAULT_PERSONAL_VIEW_SETTINGS.onlyMyShifts),
+ wrapShiftTitles: sanitizeBoolean(
+ src.wrapShiftTitles,
+ DEFAULT_PERSONAL_VIEW_SETTINGS.wrapShiftTitles
+ ),
};
}
@@ -118,7 +125,7 @@ export function calendarViewSettingsEqual(a: CalendarViewSettings, b: CalendarVi
);
}
-/** A calendar's own view replaces the personal one as a whole; the stamp bar stays personal. */
+/** A calendar's own view replaces the personal one as a whole; the personal-only fields stay. */
export function resolveViewSettings(
personal: PersonalViewSettings,
calendarView: unknown
@@ -128,5 +135,6 @@ export function resolveViewSettings(
...sanitizeCalendarViewSettings(calendarView),
showStampBar: personal.showStampBar,
onlyMyShifts: personal.onlyMyShifts,
+ wrapShiftTitles: personal.wrapShiftTitles,
};
}
diff --git a/messages/cs.json b/messages/cs.json
index bf0a1e3..8392b5c 100644
--- a/messages/cs.json
+++ b/messages/cs.json
@@ -254,6 +254,8 @@
"onlyMyShifts": "Jen moje směny",
"onlyMyShiftsHint": "V kalendáři a denním zobrazení ukáže jen směny, na které jste přiřazeni",
"onlyMyShiftsSignupsDisabledHint": "Přiřazení jsou pro tento kalendář vypnutá, proto zůstane prázdný.",
+ "wrapTitles": "Zobrazit celé názvy",
+ "wrapTitlesHint": "Dlouhé názvy směn se v měsíčním zobrazení zalomí na druhý řádek místo oříznutí",
"settingsDescriptionLocal": "Vaše osobní zobrazení na tomto zařízení. Platí pro všechny kalendáře bez vlastního zobrazení.",
"overriddenByCalendar": "„{calendar}“ má vlastní zobrazení. Níže vyšedlá nastavení tam neplatí; nahoře zůstávají vždy osobní.",
"personalSection": "Vždy osobní",
diff --git a/messages/de.json b/messages/de.json
index e82c369..b2cb2e0 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -254,6 +254,8 @@
"onlyMyShifts": "Nur meine Schichten",
"onlyMyShiftsHint": "Zeigt im Kalender und in der Tagesansicht nur Schichten, denen du zugewiesen bist",
"onlyMyShiftsSignupsDisabledHint": "Für diesen Kalender sind Zuweisungen deaktiviert, daher bleibt der Kalender leer.",
+ "wrapTitles": "Vollständige Titel anzeigen",
+ "wrapTitlesHint": "Lange Schichttitel in der Monatsansicht auf einer zweiten Zeile umbrechen statt abschneiden",
"settingsDescriptionLocal": "Deine persönliche Ansicht auf diesem Gerät. Gilt für alle Kalender ohne eigene Ansicht.",
"overriddenByCalendar": "„{calendar}“ hat eine eigene Ansicht. Die ausgegrauten Einstellungen unten gelten dort nicht; nur die Einstellungen oben bleiben immer persönlich.",
"personalSection": "Immer persönlich",
diff --git a/messages/en.json b/messages/en.json
index 8c31689..f633c1d 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -254,6 +254,8 @@
"onlyMyShifts": "Only my shifts",
"onlyMyShiftsHint": "Shows only shifts you're assigned to in the calendar and day view",
"onlyMyShiftsSignupsDisabledHint": "Assignments are turned off for this calendar, so the calendar stays empty.",
+ "wrapTitles": "Show full titles",
+ "wrapTitlesHint": "Wrap long shift titles onto a second line in the month view instead of cutting them off",
"settingsDescriptionLocal": "Your personal view on this device. Applies to all calendars without their own view.",
"overriddenByCalendar": "“{calendar}” has its own view. The grayed-out settings below don't apply there; only the settings above always stay personal.",
"personalSection": "Always personal",
diff --git a/messages/es.json b/messages/es.json
index 6948658..9f591bb 100644
--- a/messages/es.json
+++ b/messages/es.json
@@ -254,6 +254,8 @@
"onlyMyShifts": "Solo mis turnos",
"onlyMyShiftsHint": "Muestra en el calendario y la vista diaria solo los turnos asignados a ti",
"onlyMyShiftsSignupsDisabledHint": "Las asignaciones están desactivadas para este calendario, por lo que quedará vacío.",
+ "wrapTitles": "Mostrar títulos completos",
+ "wrapTitlesHint": "Ajusta los títulos largos de turno en una segunda línea en la vista mensual en lugar de recortarlos",
"settingsDescriptionLocal": "Tu vista personal en este dispositivo. Se aplica a todos los calendarios sin vista propia.",
"overriddenByCalendar": "«{calendar}» tiene su propia vista. Los ajustes en gris de abajo no se aplican allí; solo los de arriba siguen siendo siempre personales.",
"personalSection": "Siempre personal",
diff --git a/messages/fr.json b/messages/fr.json
index 964baca..858d622 100755
--- a/messages/fr.json
+++ b/messages/fr.json
@@ -254,6 +254,8 @@
"onlyMyShifts": "Seulement mes créneaux",
"onlyMyShiftsHint": "N'affiche dans le calendrier et la vue journalière que les créneaux qui vous sont attribués",
"onlyMyShiftsSignupsDisabledHint": "Les attributions sont désactivées pour ce calendrier, il restera donc vide.",
+ "wrapTitles": "Afficher les titres complets",
+ "wrapTitlesHint": "Renvoyer les titres de service longs à la ligne dans la vue mensuelle au lieu de les tronquer",
"settingsDescriptionLocal": "Votre affichage personnel sur cet appareil. Il s’applique à tous les calendriers sans affichage propre.",
"overriddenByCalendar": "« {calendar} » a son propre affichage. Les réglages grisés ci-dessous ne s’y appliquent pas ; seuls ceux du haut restent toujours personnels.",
"personalSection": "Toujours personnel",
diff --git a/messages/it.json b/messages/it.json
index d25517f..a6b9d99 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -254,6 +254,8 @@
"onlyMyShifts": "Solo i miei turni",
"onlyMyShiftsHint": "Mostra nel calendario e nella vista giornaliera solo i turni a te assegnati",
"onlyMyShiftsSignupsDisabledHint": "Le assegnazioni sono disattivate per questo calendario, quindi rimarrà vuoto.",
+ "wrapTitles": "Mostra i titoli completi",
+ "wrapTitlesHint": "Manda a capo i titoli lunghi dei turni nella vista mensile invece di troncarli",
"settingsDescriptionLocal": "La tua vista personale su questo dispositivo. Vale per tutti i calendari senza una vista propria.",
"overriddenByCalendar": "«{calendar}» ha una vista propria. Le impostazioni in grigio qui sotto non valgono lì; solo quelle sopra restano sempre personali.",
"personalSection": "Sempre personale",