chore: consolidate platform split checks
This commit is contained in:
32
webui/src/utils/delta.ts
Normal file
32
webui/src/utils/delta.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { DeltaDeletedItem } from "../types";
|
||||
|
||||
export type DeltaRowMergeOptions<T> = {
|
||||
deletedResourceType?: string;
|
||||
sort?: (left: T, right: T) => number;
|
||||
};
|
||||
|
||||
export function deltaDeletedIds(deleted: DeltaDeletedItem[] | undefined, resourceType?: string): Set<string> {
|
||||
return new Set(
|
||||
(deleted ?? [])
|
||||
.filter((item) => !resourceType || !item.resource_type || item.resource_type === resourceType)
|
||||
.map((item) => item.id)
|
||||
);
|
||||
}
|
||||
|
||||
export function mergeDeltaRows<T>(
|
||||
current: T[],
|
||||
changed: T[],
|
||||
deleted: DeltaDeletedItem[] | undefined,
|
||||
getKey: (item: T) => string,
|
||||
options: DeltaRowMergeOptions<T> = {}
|
||||
): T[] {
|
||||
const byId = new Map(current.map((item) => [getKey(item), item]));
|
||||
for (const item of changed) {
|
||||
byId.set(getKey(item), item);
|
||||
}
|
||||
for (const id of deltaDeletedIds(deleted, options.deletedResourceType)) {
|
||||
byId.delete(id);
|
||||
}
|
||||
const rows = Array.from(byId.values());
|
||||
return options.sort ? rows.sort(options.sort) : rows;
|
||||
}
|
||||
27
webui/src/utils/deltaHooks.ts
Normal file
27
webui/src/utils/deltaHooks.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { useCallback, useRef } from "react";
|
||||
|
||||
export type DeltaWatermarkStore = {
|
||||
getDeltaWatermark: (key: string) => string | null;
|
||||
setDeltaWatermark: (key: string, watermark: string | null | undefined) => void;
|
||||
resetDeltaWatermark: (key?: string) => void;
|
||||
};
|
||||
|
||||
export function useDeltaWatermarks(): DeltaWatermarkStore {
|
||||
const watermarksRef = useRef<Record<string, string | null>>({});
|
||||
|
||||
const getDeltaWatermark = useCallback((key: string) => watermarksRef.current[key] ?? null, []);
|
||||
|
||||
const setDeltaWatermark = useCallback((key: string, watermark: string | null | undefined) => {
|
||||
watermarksRef.current[key] = watermark ?? null;
|
||||
}, []);
|
||||
|
||||
const resetDeltaWatermark = useCallback((key?: string) => {
|
||||
if (key) {
|
||||
delete watermarksRef.current[key];
|
||||
return;
|
||||
}
|
||||
watermarksRef.current = {};
|
||||
}, []);
|
||||
|
||||
return { getDeltaWatermark, setDeltaWatermark, resetDeltaWatermark };
|
||||
}
|
||||
@@ -1,85 +1,85 @@
|
||||
const FIELD_HELP_BY_LABEL: Record<string, string> = {
|
||||
"API base URL": "Optional backend URL. Leave empty to use the current origin and the configured Vite/backend proxy.",
|
||||
"Automation API key": "Fallback API key for scripted or non-login access. Interactive browser sessions should use login tokens instead.",
|
||||
"Email": "Email address used to identify the user account for login or address entry.",
|
||||
"Password": "Password for the selected account or mail server. Stored and transmitted according to the configured backend flow.",
|
||||
"Name": "Human-readable display name shown in lists, reports or outgoing address headers.",
|
||||
"Email address": "The mailbox address, for example office@example.org.",
|
||||
"i18n:govoplan-core.api_base_url.1358fba4": "i18n:govoplan-core.optional_backend_url_leave_empty_to_use_the_curr.52bd2bb4",
|
||||
"i18n:govoplan-core.automation_api_key.5d4e2e6e": "i18n:govoplan-core.fallback_api_key_for_scripted_or_non_login_acces.17baecf2",
|
||||
"i18n:govoplan-core.email.84add5b2": "i18n:govoplan-core.email_address_used_to_identify_the_user_account_.0af40171",
|
||||
"i18n:govoplan-core.password.8be3c943": "i18n:govoplan-core.password_for_the_selected_account_or_mail_server.d9681f16",
|
||||
"i18n:govoplan-core.name.709a2322": "i18n:govoplan-core.human_readable_display_name_shown_in_lists_repor.a86e80a0",
|
||||
"i18n:govoplan-core.email_address.c94d3175": "i18n:govoplan-core.the_mailbox_address_for_example_office_example_o.8e6c2449",
|
||||
|
||||
"Campaign ID": "Stable technical identifier used in JSON, reports, filenames and backend references.",
|
||||
"Campaign name": "Human-readable campaign name shown in lists, review screens and reports.",
|
||||
"Mode": "Campaign operating mode. Use draft while editing, test for trial runs and send when preparing the real campaign.",
|
||||
"Scenario": "High-level campaign pattern used by guided setup to prefill sensible defaults.",
|
||||
"Description": "Internal explanation of the campaign purpose. This is not sent to recipients.",
|
||||
"i18n:govoplan-core.campaign_id.4c4ed79e": "i18n:govoplan-core.stable_technical_identifier_used_in_json_reports.c1088ac6",
|
||||
"i18n:govoplan-core.campaign_name.aa5d0e72": "i18n:govoplan-core.human_readable_campaign_name_shown_in_lists_revi.9023c9a6",
|
||||
"i18n:govoplan-core.mode.a7b93d21": "i18n:govoplan-core.campaign_operating_mode_use_draft_while_editing_.a3a9e257",
|
||||
"i18n:govoplan-core.scenario.569aae5b": "i18n:govoplan-core.high_level_campaign_pattern_used_by_guided_setup.c5ec6652",
|
||||
"i18n:govoplan-core.description.55f8ebc8": "i18n:govoplan-core.internal_explanation_of_the_campaign_purpose_thi.f232e76f",
|
||||
|
||||
"Default From address": "Default sender address used for outgoing messages unless individual senders are allowed and set per recipient.",
|
||||
"From name": "Display name shown with the sender address in outgoing messages.",
|
||||
"From email": "Mailbox address used as the sender of outgoing messages.",
|
||||
"Global Reply-To address": "Default reply destination for recipient responses. Leave empty to let replies go to the From address.",
|
||||
"Reply-To": "Address recipients should reply to when it differs from the sender address.",
|
||||
"To": "Global To recipients added to every message in addition to recipient-specific recipients.",
|
||||
"Global recipients": "Default recipients included in every generated message.",
|
||||
"CC": "Global carbon-copy recipients included in every generated message.",
|
||||
"BCC": "Global blind-copy recipients included in every generated message.",
|
||||
"i18n:govoplan-core.default_from_address.b9ee6d77": "i18n:govoplan-core.default_sender_address_used_for_outgoing_message.3824700a",
|
||||
"i18n:govoplan-core.from_name.1e77633a": "i18n:govoplan-core.display_name_shown_with_the_sender_address_in_ou.21d950a3",
|
||||
"i18n:govoplan-core.from_email.1288a2a1": "i18n:govoplan-core.mailbox_address_used_as_the_sender_of_outgoing_m.c3c79e29",
|
||||
"i18n:govoplan-core.global_reply_to_address.bec1a89b": "i18n:govoplan-core.default_reply_destination_for_recipient_response.86474287",
|
||||
"i18n:govoplan-core.reply_to.c1733667": "i18n:govoplan-core.address_recipients_should_reply_to_when_it_diffe.f9035357",
|
||||
"i18n:govoplan-core.to.ae79ea1e": "i18n:govoplan-core.global_to_recipients_added_to_every_message_in_a.f4d3154f",
|
||||
"i18n:govoplan-core.global_recipients.d9aaa427": "i18n:govoplan-core.default_recipients_included_in_every_generated_m.f98da78f",
|
||||
"i18n:govoplan-core.cc.c5a976de": "i18n:govoplan-core.global_carbon_copy_recipients_included_in_every_.51b2b29e",
|
||||
"i18n:govoplan-core.bcc.4c0145a3": "i18n:govoplan-core.global_blind_copy_recipients_included_in_every_g.54f7daa6",
|
||||
|
||||
"Template source": "Where this campaign template comes from. Inline means it is stored directly in the campaign draft.",
|
||||
"Library template": "Reusable template record this campaign should refer to once the template backend is available.",
|
||||
"Subject": "Message subject. Placeholders can reference campaign/global/recipient fields.",
|
||||
"Body": "Template body content shown for review. Placeholders are checked against campaign fields.",
|
||||
"Plain text body": "Plain text version of the email body. It should remain readable without HTML rendering.",
|
||||
"HTML body": "Optional HTML version of the email body for richer formatting.",
|
||||
"i18n:govoplan-core.template_source.8e395b7a": "i18n:govoplan-core.where_this_campaign_template_comes_from_inline_m.de97578d",
|
||||
"i18n:govoplan-core.library_template.c62eb776": "i18n:govoplan-core.reusable_template_record_this_campaign_should_re.5896529b",
|
||||
"i18n:govoplan-core.subject.8d183dbd": "i18n:govoplan-core.message_subject_placeholders_can_reference_campa.0426f9a1",
|
||||
"i18n:govoplan-core.body.718a7e8a": "i18n:govoplan-core.template_body_content_shown_for_review_placehold.57454b52",
|
||||
"i18n:govoplan-core.plain_text_body.030a0da0": "i18n:govoplan-core.plain_text_version_of_the_email_body_it_should_r.fcccbb7c",
|
||||
"i18n:govoplan-core.html_body.77b5ba37": "i18n:govoplan-core.optional_html_version_of_the_email_body_for_rich.3f01db97",
|
||||
|
||||
"Attachment base path": "Base folder used to resolve campaign attachment rules and relative file patterns.",
|
||||
"Campaign attachment base path": "Base folder used during campaign creation to resolve attachment files and patterns.",
|
||||
"Default missing behavior": "Default review behavior when an expected attachment cannot be found.",
|
||||
"Default ambiguous behavior": "Default review behavior when a file pattern matches more than one attachment.",
|
||||
"Base directory": "Folder below the campaign attachment base path where this rule starts looking for files.",
|
||||
"File filter": "Filename or pattern used to select matching files. Field placeholders can be introduced later.",
|
||||
"Include subdirectories": "Whether the rule should also search below nested folders.",
|
||||
"Allow multiple matches": "Whether more than one matching file may be attached for this rule.",
|
||||
"Missing behavior": "Action or review severity when this rule finds no matching file.",
|
||||
"Ambiguous behavior": "Action or review severity when this rule finds multiple possible matches.",
|
||||
"i18n:govoplan-core.attachment_base_path.66e9940b": "i18n:govoplan-core.base_folder_used_to_resolve_campaign_attachment_.1c5d7f57",
|
||||
"i18n:govoplan-core.campaign_attachment_base_path.84827619": "i18n:govoplan-core.base_folder_used_during_campaign_creation_to_res.7d7c1681",
|
||||
"i18n:govoplan-core.default_missing_behavior.ffbd9cd7": "i18n:govoplan-core.default_review_behavior_when_an_expected_attachm.e4bd7ea5",
|
||||
"i18n:govoplan-core.default_ambiguous_behavior.878b9345": "i18n:govoplan-core.default_review_behavior_when_a_file_pattern_matc.b6ee0c22",
|
||||
"i18n:govoplan-core.base_directory.31c0edd6": "i18n:govoplan-core.folder_below_the_campaign_attachment_base_path_w.04f81c33",
|
||||
"i18n:govoplan-core.file_filter.cf0c5b6f": "i18n:govoplan-core.filename_or_pattern_used_to_select_matching_file.1f76eaa4",
|
||||
"i18n:govoplan-core.include_subdirectories.97984dfb": "i18n:govoplan-core.whether_the_rule_should_also_search_below_nested.7c05e589",
|
||||
"i18n:govoplan-core.allow_multiple_matches.1ad3a854": "i18n:govoplan-core.whether_more_than_one_matching_file_may_be_attac.b29c38c1",
|
||||
"i18n:govoplan-core.missing_behavior.de3d1ac7": "i18n:govoplan-core.action_or_review_severity_when_this_rule_finds_n.bc500ee1",
|
||||
"i18n:govoplan-core.ambiguous_behavior.e86e724b": "i18n:govoplan-core.action_or_review_severity_when_this_rule_finds_m.2e6863d1",
|
||||
|
||||
"Host": "Mail server hostname or IP address for the selected protocol.",
|
||||
"SMTP host": "SMTP server hostname or IP address used for sending messages.",
|
||||
"Port": "Network port used by the selected mail protocol.",
|
||||
"SMTP port": "Network port used by the SMTP server, commonly 587 for STARTTLS or 465 for TLS.",
|
||||
"Username": "Login name for the selected mail server. Often the same as the mailbox address.",
|
||||
"Security": "Connection security mode expected by the server: plain, TLS or STARTTLS.",
|
||||
"Timeout seconds": "Maximum time to wait for the mail server before the connection test or send attempt fails.",
|
||||
"Detected/saved sent folder": "IMAP folder name used as the detected or manually configured Sent folder.",
|
||||
"Append folder": "Folder where successfully sent messages should be appended via IMAP.",
|
||||
"IMAP append to Sent": "Whether sent messages should also be copied into the configured Sent folder via IMAP.",
|
||||
"i18n:govoplan-core.host.3960ec4c": "i18n:govoplan-core.mail_server_hostname_or_ip_address_for_the_selec.596c2d69",
|
||||
"i18n:govoplan-core.smtp_host.2d4a434b": "i18n:govoplan-core.smtp_server_hostname_or_ip_address_used_for_send.47eabfa4",
|
||||
"i18n:govoplan-core.port.fe035157": "i18n:govoplan-core.network_port_used_by_the_selected_mail_protocol.664fa120",
|
||||
"i18n:govoplan-core.smtp_port.65b5a108": "i18n:govoplan-core.network_port_used_by_the_smtp_server_commonly_58.11ef582f",
|
||||
"i18n:govoplan-core.username.84c29015": "i18n:govoplan-core.login_name_for_the_selected_mail_server_often_th.5ae22850",
|
||||
"i18n:govoplan-core.security.f25ce1b8": "i18n:govoplan-core.connection_security_mode_expected_by_the_server_.4348e12e",
|
||||
"i18n:govoplan-core.timeout_seconds.0bfc6553": "i18n:govoplan-core.maximum_time_to_wait_for_the_mail_server_before_.4b0241d0",
|
||||
"i18n:govoplan-core.detected_saved_sent_folder.18642a29": "i18n:govoplan-core.imap_folder_name_used_as_the_detected_or_manuall.45ad006f",
|
||||
"i18n:govoplan-core.append_folder.06ed4bba": "i18n:govoplan-core.folder_where_successfully_sent_messages_should_b.538b4e3e",
|
||||
"i18n:govoplan-core.imap_append_to_sent.1a097d3a": "i18n:govoplan-core.whether_sent_messages_should_also_be_copied_into.7fe7e178",
|
||||
|
||||
"Messages per minute": "Rate limit for outgoing messages. Lower values are safer for mail providers and throttled accounts.",
|
||||
"Concurrency": "Number of send operations that may run in parallel. Keep low until account and provider limits are clear.",
|
||||
"Max attempts": "Maximum retry attempts for a message before it remains failed for review.",
|
||||
"i18n:govoplan-core.messages_per_minute.bea49348": "i18n:govoplan-core.rate_limit_for_outgoing_messages_lower_values_ar.9e929f6c",
|
||||
"i18n:govoplan-core.concurrency.2ec390bf": "i18n:govoplan-core.number_of_send_operations_that_may_run_in_parall.557a7155",
|
||||
"i18n:govoplan-core.max_attempts.f684fef4": "i18n:govoplan-core.maximum_retry_attempts_for_a_message_before_it_r.ad40b526",
|
||||
|
||||
"Source type": "Recipient data source format. Inline data is edited in the campaign; external sources will be parsed later.",
|
||||
"Source path": "Path or identifier for an external recipient source such as a CSV file.",
|
||||
"i18n:govoplan-core.source_type.5d02ee8d": "i18n:govoplan-core.recipient_data_source_format_inline_data_is_edit.086c01b0",
|
||||
"i18n:govoplan-core.source_path.5956aebe": "i18n:govoplan-core.path_or_identifier_for_an_external_recipient_sou.f7da6e8f",
|
||||
|
||||
"Remember previously used addresses": "Planned opt-in collection for autocomplete across campaigns. Currently autocomplete is campaign-local only.",
|
||||
"External address-book sync": "Placeholder for CardDAV, Google, LDAP or similar address sources.",
|
||||
"Allow individual senders": "Permit recipient rows to override the campaign's default sender address.",
|
||||
"Allow individual From": "Permit per-recipient sender overrides when building messages.",
|
||||
"Allow individual Reply-To": "Permit recipient rows to override the global Reply-To address.",
|
||||
"Allow individual To": "Permit recipient rows to define their own To recipients in addition to global headers.",
|
||||
"Allow individual CC": "Permit recipient rows to define their own CC recipients.",
|
||||
"Allow individual BCC": "Permit recipient rows to define their own BCC recipients.",
|
||||
"Allow individual attachments": "Permit recipient-specific attachment rules in addition to global files.",
|
||||
"Send without attachments": "Allow messages to be sent even when no attachment is resolved. Disable to force review or blocking.",
|
||||
"Status tracking": "Store per-message build, validation, queue, send and IMAP status for review and reporting.",
|
||||
"Suggest addresses from this campaign": "Use addresses already present in this campaign as autocomplete suggestions.",
|
||||
"Remember newly used addresses": "Prepare newly entered addresses for a future user-level address memory.",
|
||||
"Show guided warnings while editing": "Show inline guidance and warnings while campaign data is being edited.",
|
||||
"Required": "Mark this item as mandatory. Missing required data should become a validation or review issue.",
|
||||
"Subdirs": "Search nested folders below the configured base directory.",
|
||||
"Can override": "Allow recipient-specific values to override the global value for this field.",
|
||||
"Append successfully sent messages to Sent": "After SMTP send succeeds, append a copy of the message to the selected IMAP Sent folder.",
|
||||
"Append successful messages to Sent via IMAP": "After SMTP send succeeds, append a copy of the message to the configured IMAP Sent folder."
|
||||
"i18n:govoplan-core.remember_previously_used_addresses.0ae67018": "i18n:govoplan-core.planned_opt_in_collection_for_autocomplete_acros.2f06b032",
|
||||
"i18n:govoplan-core.external_address_book_sync.40412341": "i18n:govoplan-core.placeholder_for_carddav_google_ldap_or_similar_a.1a22f474",
|
||||
"i18n:govoplan-core.allow_individual_senders.f85fda12": "i18n:govoplan-core.permit_recipient_rows_to_override_the_campaign_s.ec2e6233",
|
||||
"i18n:govoplan-core.allow_individual_from.ca797b5c": "i18n:govoplan-core.permit_per_recipient_sender_overrides_when_build.62e46d13",
|
||||
"i18n:govoplan-core.allow_individual_reply_to.028f8044": "i18n:govoplan-core.permit_recipient_rows_to_override_the_global_rep.092d7e85",
|
||||
"i18n:govoplan-core.allow_individual_to.966cb33e": "i18n:govoplan-core.permit_recipient_rows_to_define_their_own_to_rec.3b37defe",
|
||||
"i18n:govoplan-core.allow_individual_cc.0457c0e2": "i18n:govoplan-core.permit_recipient_rows_to_define_their_own_cc_rec.0247b3cd",
|
||||
"i18n:govoplan-core.allow_individual_bcc.a932d94b": "i18n:govoplan-core.permit_recipient_rows_to_define_their_own_bcc_re.46d737dc",
|
||||
"i18n:govoplan-core.allow_individual_attachments.a6ff0e87": "i18n:govoplan-core.permit_recipient_specific_attachment_rules_in_ad.7bbe1f71",
|
||||
"i18n:govoplan-core.send_without_attachments.ead6d030": "i18n:govoplan-core.allow_messages_to_be_sent_even_when_no_attachmen.5c5268e1",
|
||||
"i18n:govoplan-core.status_tracking.15f61f88": "i18n:govoplan-core.store_per_message_build_validation_queue_send_an.57e387c9",
|
||||
"i18n:govoplan-core.suggest_addresses_from_this_campaign.5ebe2aea": "i18n:govoplan-core.use_addresses_already_present_in_this_campaign_a.43258b88",
|
||||
"i18n:govoplan-core.remember_newly_used_addresses.aebe8adb": "i18n:govoplan-core.prepare_newly_entered_addresses_for_a_future_use.b77195ed",
|
||||
"i18n:govoplan-core.show_guided_warnings_while_editing.bc5dba85": "i18n:govoplan-core.show_inline_guidance_and_warnings_while_campaign.a892f5e9",
|
||||
"i18n:govoplan-core.required.eed6bfb4": "i18n:govoplan-core.mark_this_item_as_mandatory_missing_required_dat.3a6f40c8",
|
||||
"i18n:govoplan-core.subdirs.ab9017e1": "i18n:govoplan-core.search_nested_folders_below_the_configured_base_.122d1916",
|
||||
"i18n:govoplan-core.can_override.c37b61c4": "i18n:govoplan-core.allow_recipient_specific_values_to_override_the_.1b21d0f0",
|
||||
"i18n:govoplan-core.append_successfully_sent_messages_to_sent.002fd67e": "i18n:govoplan-core.after_smtp_send_succeeds_append_a_copy_of_the_me.2842ed88",
|
||||
"i18n:govoplan-core.append_successful_messages_to_sent_via_imap.dbd1b1d8": "i18n:govoplan-core.after_smtp_send_succeeds_append_a_copy_of_the_me.686e7abb"
|
||||
};
|
||||
|
||||
export function helpForFieldLabel(label: unknown): string | undefined {
|
||||
if (typeof label !== "string") return undefined;
|
||||
return FIELD_HELP_BY_LABEL[label];
|
||||
}
|
||||
}
|
||||
@@ -5,36 +5,36 @@ export type HelpContext = {
|
||||
};
|
||||
|
||||
const campaignSectionContexts: Record<string, Omit<HelpContext, "route">> = {
|
||||
data: { id: "campaign.settings", title: "Campaign settings" },
|
||||
campaign: { id: "campaign.settings", title: "Campaign settings" },
|
||||
fields: { id: "campaign.fields", title: "Campaign fields" },
|
||||
template: { id: "campaign.template", title: "Template" },
|
||||
files: { id: "campaign.attachments", title: "Attachments" },
|
||||
attachments: { id: "campaign.attachments", title: "Attachments" },
|
||||
recipients: { id: "campaign.recipients", title: "Sender & Recipients" },
|
||||
"recipient-data": { id: "campaign.recipient-data", title: "Recipient data" },
|
||||
"mail-settings": { id: "campaign.server-settings", title: "Server settings" },
|
||||
"server-settings": { id: "campaign.server-settings", title: "Server settings" },
|
||||
mail: { id: "campaign.server-settings", title: "Server settings" },
|
||||
"global-settings": { id: "campaign.global-settings", title: "Policies" },
|
||||
settings: { id: "campaign.global-settings", title: "Policies" },
|
||||
review: { id: "campaign.review-send", title: "Review & Send" },
|
||||
send: { id: "campaign.review-send", title: "Review & Send" },
|
||||
report: { id: "campaign.report", title: "Report" },
|
||||
reports: { id: "campaign.report", title: "Report" },
|
||||
audit: { id: "campaign.audit", title: "Audit log" },
|
||||
json: { id: "campaign.json", title: "JSON" }
|
||||
data: { id: "campaign.settings", title: "i18n:govoplan-core.campaign_settings.efffec26" },
|
||||
campaign: { id: "campaign.settings", title: "i18n:govoplan-core.campaign_settings.efffec26" },
|
||||
fields: { id: "campaign.fields", title: "i18n:govoplan-core.campaign_fields.969e7d80" },
|
||||
template: { id: "campaign.template", title: "i18n:govoplan-core.template.3ec1ae06" },
|
||||
files: { id: "campaign.attachments", title: "i18n:govoplan-core.attachments.6771ade6" },
|
||||
attachments: { id: "campaign.attachments", title: "i18n:govoplan-core.attachments.6771ade6" },
|
||||
recipients: { id: "campaign.recipients", title: "i18n:govoplan-core.sender_recipients.922c6d24" },
|
||||
"recipient-data": { id: "campaign.recipient-data", title: "i18n:govoplan-core.recipient_data.c2baaf10" },
|
||||
"mail-settings": { id: "campaign.server-settings", title: "i18n:govoplan-core.server_settings.28af3cc7" },
|
||||
"server-settings": { id: "campaign.server-settings", title: "i18n:govoplan-core.server_settings.28af3cc7" },
|
||||
mail: { id: "campaign.server-settings", title: "i18n:govoplan-core.server_settings.28af3cc7" },
|
||||
"global-settings": { id: "campaign.global-settings", title: "i18n:govoplan-core.policies.8d611849" },
|
||||
settings: { id: "campaign.global-settings", title: "i18n:govoplan-core.policies.8d611849" },
|
||||
review: { id: "campaign.review-send", title: "i18n:govoplan-core.review_send.1627617d" },
|
||||
send: { id: "campaign.review-send", title: "i18n:govoplan-core.review_send.1627617d" },
|
||||
report: { id: "campaign.report", title: "i18n:govoplan-core.report.ee45c303" },
|
||||
reports: { id: "campaign.report", title: "i18n:govoplan-core.report.ee45c303" },
|
||||
audit: { id: "campaign.audit", title: "i18n:govoplan-core.audit_log.3cfc5f1c" },
|
||||
json: { id: "campaign.json", title: "i18n:govoplan-core.json.031a4e76" }
|
||||
};
|
||||
|
||||
const topLevelContexts: Record<string, Omit<HelpContext, "route">> = {
|
||||
dashboard: { id: "app.dashboard", title: "Dashboard" },
|
||||
campaigns: { id: "campaigns.list", title: "Campaigns" },
|
||||
templates: { id: "templates.list", title: "Templates" },
|
||||
files: { id: "files.list", title: "Files" },
|
||||
"address-book": { id: "address-book.list", title: "Address Book" },
|
||||
reports: { id: "reports.list", title: "Reports" },
|
||||
settings: { id: "app.settings", title: "Settings" },
|
||||
admin: { id: "app.admin", title: "Admin" }
|
||||
dashboard: { id: "app.dashboard", title: "i18n:govoplan-core.dashboard.d87f47b4" },
|
||||
campaigns: { id: "campaigns.list", title: "i18n:govoplan-core.campaigns.01a23a28" },
|
||||
templates: { id: "templates.list", title: "i18n:govoplan-core.templates.f25b700e" },
|
||||
files: { id: "files.list", title: "i18n:govoplan-core.files.6ce6c512" },
|
||||
"address-book": { id: "address-book.list", title: "i18n:govoplan-core.address_book.f6327f59" },
|
||||
reports: { id: "reports.list", title: "i18n:govoplan-core.reports.88bc3fe3" },
|
||||
settings: { id: "app.settings", title: "i18n:govoplan-core.settings.c7f73bb5" },
|
||||
admin: { id: "app.admin", title: "i18n:govoplan-core.admin.4e7afebc" }
|
||||
};
|
||||
|
||||
export function helpContextForPathname(pathname: string): HelpContext {
|
||||
@@ -42,19 +42,19 @@ export function helpContextForPathname(pathname: string): HelpContext {
|
||||
const segments = route.split("/").filter(Boolean);
|
||||
|
||||
if (segments[0] === "campaigns" && segments[1]) {
|
||||
if (!segments[2]) return { id: "campaign.overview", title: "Campaign overview", route };
|
||||
if (!segments[2]) return { id: "campaign.overview", title: "i18n:govoplan-core.campaign_overview.43c3d159", route };
|
||||
if (segments[2] === "wizard") {
|
||||
const step = segments[3] || "create";
|
||||
return { id: `campaign.wizard.${step}`, title: `${capitalize(step)} wizard`, route };
|
||||
}
|
||||
const context = campaignSectionContexts[segments[2]];
|
||||
if (context) return { ...context, route };
|
||||
return { id: "campaign.workspace", title: "Campaign workspace", route };
|
||||
return { id: "campaign.workspace", title: "i18n:govoplan-core.campaign_workspace.c345580f", route };
|
||||
}
|
||||
|
||||
const context = topLevelContexts[segments[0] || "campaigns"];
|
||||
if (context) return { ...context, route };
|
||||
return { id: "app.general", title: "Application", route };
|
||||
return { id: "app.general", title: "i18n:govoplan-core.application.b291beb8", route };
|
||||
}
|
||||
|
||||
export function helpQueryForContext(context: HelpContext): string {
|
||||
@@ -63,4 +63,4 @@ export function helpQueryForContext(context: HelpContext): string {
|
||||
|
||||
function capitalize(value: string): string {
|
||||
return value.replace(/-/g, " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user