brand code (replaces the brand link)
@@ -785,6 +921,13 @@ onUnmounted(() => {
font-size: 1rem;
}
+/* The messaging block's language selector sits at the block head's right. */
+.block-head .contact-lang {
+ margin-left: auto;
+ flex: 0 0 auto;
+ width: auto;
+}
+
.text-input {
flex: 1;
min-width: 4rem;
diff --git a/frontend/src/contact-main.js b/frontend/src/contact-main.js
index 6f8517f..1e54c97 100644
--- a/frontend/src/contact-main.js
+++ b/frontend/src/contact-main.js
@@ -25,8 +25,34 @@ const state = reactive({
unread: false, // visitor: an unread admin reply
adminUnread: 0, // admin: unanswered threads
viewerAdmin: false, // set once the inbox has been opened: icon badge = adminUnread
+ // Localized site contact strings (pagerite:contact-* asset config,
+ // refreshed on every open — they change with the page language):
+ // label doubles as the visitor dialog's title; email gets a mailto
+ // link with subject prefilled.
+ label: 'Contact us',
+ email: '',
+ subject: '',
})
+// The localized contact strings ride the page's asset config (the
+// production JSON block, or pagerite:* meta tags in dev).
+function readContactStrings() {
+ let assets = {}
+ const el = document.getElementById('pagerite-assets')
+ if (el) {
+ try {
+ assets = JSON.parse(el.textContent)
+ } catch { /* keep empty */ }
+ } else {
+ for (const m of document.querySelectorAll('meta[name^="pagerite:contact-"]')) {
+ assets[m.name] = m.content
+ }
+ }
+ state.label = assets['pagerite:contact-label'] || 'Contact us'
+ state.subject = assets['pagerite:contact-subject'] || state.label
+ state.email = assets['pagerite:contact-email'] || ''
+}
+
// The panel is main content, not a sidebar: while open it holds paskia's
// shared blur backdrop (refcounted, z-index 1099; the overlay itself sits
// at 1100, below the auth iframe's 9999).
@@ -154,6 +180,7 @@ export function open(br, { admin = false } = {}) {
bridge.register(token, onThread, onPow)
}
state.mode = admin ? 'admin' : 'visitor'
+ readContactStrings()
state.open = true
if (!admin) markSeen()
else refreshBadges()
diff --git a/frontend/src/pagerite.js b/frontend/src/pagerite.js
index 7158ab1..d5ab1ed 100644
--- a/frontend/src/pagerite.js
+++ b/frontend/src/pagerite.js
@@ -191,12 +191,16 @@ import { reconnectPolicy, socketSlot, watchConnecting } from "./reconnect";
// contact_unread. Once the bundle has loaded, its refreshBadges keeps
// the marker live.
let adminUnreadSeed = 0;
+ // Messaging disabled in the site settings (no pagerite:contact-label in
+ // the asset config): no icon for visitors — admins keep theirs, the
+ // inbox still holds the existing threads.
+ const contactEnabled = !!assets["pagerite:contact-label"];
function makeContactIcon(admin) {
const b = document.createElement("button");
b.type = "button";
b.id = "contact-icon";
b.className = "contact-icon icon-btn";
- b.title = admin ? "messages" : "contact us";
+ b.title = admin ? "messages" : (assets["pagerite:contact-label"] || "contact us");
b.textContent = "✉️";
if (admin) {
if (adminUnreadSeed > 0) b.classList.add("has-unread");
@@ -245,8 +249,9 @@ import { reconnectPolicy, socketSlot, watchConnecting } from "./reconnect";
const onToolPage = currentPath === "/_a";
if (document.getElementById("page-banner")) {
const pens = pensContainer();
- // The contact icon is there for everyone.
- pens.append(makeContactIcon(canEdit));
+ // The contact icon is there for everyone — except visitors when
+ // messaging is disabled (admins keep the inbox).
+ if (canEdit || contactEnabled) pens.append(makeContactIcon(canEdit));
if (canEdit && !onToolPage) {
// Analytics viewer is a normal page at /_a.
const a = document.createElement("a");