diff --git a/src/lib/i18n/en.ts b/src/lib/i18n/en.ts index 8a8970f..b7550ba 100644 --- a/src/lib/i18n/en.ts +++ b/src/lib/i18n/en.ts @@ -172,6 +172,8 @@ export const en: Messages = { openContribution: { contribute: "Open Contribution", contributeNote: "Contribute to this note", + suggestEdit: "Suggest Edit", + suggestNote: "Suggest Note", queueHeading: "Submitted open contributions", queueEmpty: "No pending open contributions.", by: "Submitted by", diff --git a/src/lib/i18n/fr.ts b/src/lib/i18n/fr.ts index 538ce64..65152ce 100644 --- a/src/lib/i18n/fr.ts +++ b/src/lib/i18n/fr.ts @@ -176,6 +176,8 @@ export const fr: PartialMessages = { openContribution: { contribute: "Contribuer ouvertement", contributeNote: "Contribuer à cette note", + suggestEdit: "Suggérer une modification", + suggestNote: "Suggérer une note", queueHeading: "Contributions ouvertes soumises", queueEmpty: "Aucune contribution en attente.", by: "Soumise par", diff --git a/src/lib/i18n/index.ts b/src/lib/i18n/index.ts index 3b7679b..2441129 100644 --- a/src/lib/i18n/index.ts +++ b/src/lib/i18n/index.ts @@ -169,6 +169,8 @@ export interface Messages { openContribution: { contribute: string; contributeNote: string; + suggestEdit: string; + suggestNote: string; queueHeading: string; queueEmpty: string; by: string; diff --git a/src/lib/i18n/ja.ts b/src/lib/i18n/ja.ts index d9e512e..32cf860 100644 --- a/src/lib/i18n/ja.ts +++ b/src/lib/i18n/ja.ts @@ -178,6 +178,8 @@ export const ja: PartialMessages = { openContribution: { contribute: "オープン投稿", contributeNote: "このノートに投稿する", + suggestEdit: "編集を提案", + suggestNote: "ノートを提案", queueHeading: "投稿されたオープン投稿", queueEmpty: "保留中の投稿はありません。", by: "投稿者", diff --git a/src/views/layout.ts b/src/views/layout.ts index 0d42cfa..0f537f0 100644 --- a/src/views/layout.ts +++ b/src/views/layout.ts @@ -18,6 +18,7 @@ import { } from "../lib/urls.ts"; import { ICONS } from "./icons.ts"; import { + contributionSmallButtonClass, dangerSmallButtonClass, fieldFocusClass, kbdClass, @@ -166,11 +167,27 @@ function renderWithSidebar(body: string, options: LayoutOptions): string { ? `${msg.wiki.newNote}` : ""; + // Open contributions: a non-contributor on an open wiki suggests changes rather + // than editing directly. "Suggest Edit" replaces the edit action on a note; + // "Suggest Note" offers a new note. Both route through the submission queue. + const suggestEditLink = + options?.canSubmitContribution && options.currentNoteSlug + ? `${msg.openContribution.suggestEdit}` + : ""; + const suggestNoteLink = options?.canSubmitContribution + ? `${msg.openContribution.suggestNote}` + : ""; + // The button tokens are inline-flex, and Tailwind emits .inline-flex after // .block, so a `block` on the anchor loses regardless of attribute order and // the buttons sit side by side. Flex children are blockified, which stacks // them full-width without fighting the token's display. - const noteActions = [editLink, newNoteLink].filter(Boolean); + const noteActions = [ + editLink, + newNoteLink, + suggestEditLink, + suggestNoteLink, + ].filter(Boolean); const noteActionsBlock = noteActions.length ? `
${noteActions.join("\n")}
` : ""; diff --git a/src/views/theme/index.ts b/src/views/theme/index.ts index 3b595e1..9954c36 100644 --- a/src/views/theme/index.ts +++ b/src/views/theme/index.ts @@ -7,6 +7,7 @@ export { type WikiThemeMode, } from "./resolve.ts"; export { + contributionSmallButtonClass, dangerButtonClass, dangerSmallButtonClass, denseInputClass, diff --git a/src/views/theme/tokens.ts b/src/views/theme/tokens.ts index c55fdf8..422a6b1 100644 --- a/src/views/theme/tokens.ts +++ b/src/views/theme/tokens.ts @@ -65,6 +65,10 @@ export const primarySmallButtonClass = `inline-flex items-center justify-center export const outlineSmallButtonClass = `inline-flex items-center justify-center ${touchTargetClass} px-3 py-1.5 border border-[var(--accent)] ${THEME.accentText} text-sm font-medium rounded ${THEME.accentSoft}`; +// Open-contribution actions: distinct orange so they read as "suggest" rather +// than "edit", and never get confused with the normal edit/new buttons. +export const contributionSmallButtonClass = `inline-flex items-center justify-center ${touchTargetClass} px-3 py-1.5 bg-[#f97316] text-white text-sm font-medium rounded hover:bg-[#ea580c]`; + export const dangerButtonClass = `inline-flex items-center justify-center ${touchTargetClass} px-4 py-2 bg-[var(--danger-action)] text-[var(--danger-foreground)] text-sm font-medium rounded hover:bg-[var(--danger-action-hover)]`; export const dangerSmallButtonClass = `inline-flex items-center justify-center ${touchTargetClass} px-2.5 py-1 bg-[var(--danger-action)] text-[var(--danger-foreground)] text-xs font-medium rounded hover:bg-[var(--danger-action-hover)]`; diff --git a/src/views/wiki.ts b/src/views/wiki.ts index 397703b..2a4e333 100644 --- a/src/views/wiki.ts +++ b/src/views/wiki.ts @@ -4,7 +4,11 @@ import { t } from "../lib/i18n/index.ts"; import { newNoteUrl, noteUrl } from "../lib/urls.ts"; import type { WikiIdentity } from "../lib/wiki-identity.ts"; import { type LayoutOptions, layout } from "./layout.ts"; -import { primarySmallButtonClass, THEME } from "./theme/index.ts"; +import { + contributionSmallButtonClass, + primarySmallButtonClass, + THEME, +} from "./theme/index.ts"; export function wikiPage( wiki: WikiIdentity, @@ -33,7 +37,7 @@ export function wikiPage( : ""; const openContributionButton = options?.canSubmitContribution - ? `${msg.openContribution.contribute}` + ? `${msg.openContribution.suggestNote}` : ""; const content = `