v0.12.0 codes for FCM and rebranded jama to RosterChirp
This commit is contained in:
@@ -32,8 +32,8 @@ export default function AboutModal({ onClose }) {
|
||||
}, []);
|
||||
|
||||
// Always use the original app identity — not the user-customised settings name/logo
|
||||
const appName = about?.default_app_name || 'jama';
|
||||
const logoSrc = about?.default_logo || '/icons/jama.png';
|
||||
const appName = about?.default_app_name || 'rosterchirp';
|
||||
const logoSrc = about?.default_logo || '/icons/rosterchirp.png';
|
||||
const version = about?.version || '';
|
||||
const a = about || {};
|
||||
|
||||
|
||||
@@ -321,7 +321,7 @@ export default function BrandingModal({ onClose }) {
|
||||
useEffect(() => {
|
||||
api.getSettings().then(({ settings }) => {
|
||||
setSettings(settings);
|
||||
setAppName(settings.app_name || 'jama');
|
||||
setAppName(settings.app_name || 'rosterchirp');
|
||||
setColourTitle(settings.color_title || DEFAULT_TITLE_COLOR);
|
||||
setColourTitleDark(settings.color_title_dark || DEFAULT_TITLE_DARK_COLOR);
|
||||
setColourPublic(settings.color_avatar_public || DEFAULT_PUBLIC_COLOR);
|
||||
@@ -329,7 +329,7 @@ export default function BrandingModal({ onClose }) {
|
||||
}).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const notifySidebarRefresh = () => window.dispatchEvent(new Event('jama:settings-changed'));
|
||||
const notifySidebarRefresh = () => window.dispatchEvent(new Event('rosterchirp:settings-changed'));
|
||||
|
||||
const handleSaveName = async () => {
|
||||
if (!appName.trim()) return;
|
||||
@@ -391,7 +391,7 @@ export default function BrandingModal({ onClose }) {
|
||||
await api.resetSettings();
|
||||
const { settings: fresh } = await api.getSettings();
|
||||
setSettings(fresh);
|
||||
setAppName(fresh.app_name || 'jama');
|
||||
setAppName(fresh.app_name || 'rosterchirp');
|
||||
setColourTitle(DEFAULT_TITLE_COLOR);
|
||||
setColourTitleDark(DEFAULT_TITLE_DARK_COLOR);
|
||||
setColourPublic(DEFAULT_PUBLIC_COLOR);
|
||||
@@ -433,7 +433,7 @@ export default function BrandingModal({ onClose }) {
|
||||
border: '1px solid var(--border)', overflow: 'hidden', display: 'flex',
|
||||
alignItems: 'center', justifyContent: 'center', flexShrink: 0
|
||||
}}>
|
||||
<img src={settings.logo_url || '/icons/jama.png'} alt="logo" style={{ width: '100%', height: '100%', objectFit: 'contain' }} />
|
||||
<img src={settings.logo_url || '/icons/rosterchirp.png'} alt="logo" style={{ width: '100%', height: '100%', objectFit: 'contain' }} />
|
||||
</div>
|
||||
<div>
|
||||
<label className="btn btn-secondary btn-sm" style={{ cursor: 'pointer', display: 'inline-block' }}>
|
||||
|
||||
@@ -48,11 +48,11 @@ export default function ChatWindow({ group, onBack, onGroupUpdated, onDirectMess
|
||||
setIconGroupInfo(settings.icon_groupinfo || '');
|
||||
setAvatarColors({ public: settings.color_avatar_public || '#1a73e8', dm: settings.color_avatar_dm || '#a142f4' });
|
||||
}).catch(() => {});
|
||||
window.addEventListener('jama:settings-updated', handler);
|
||||
window.addEventListener('jama:settings-changed', handler);
|
||||
window.addEventListener('rosterchirp:settings-updated', handler);
|
||||
window.addEventListener('rosterchirp:settings-changed', handler);
|
||||
return () => {
|
||||
window.removeEventListener('jama:settings-updated', handler);
|
||||
window.removeEventListener('jama:settings-changed', handler);
|
||||
window.removeEventListener('rosterchirp:settings-updated', handler);
|
||||
window.removeEventListener('rosterchirp:settings-changed', handler);
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -4,24 +4,24 @@ import { api } from '../utils/api.js';
|
||||
|
||||
export default function GlobalBar({ isMobile, showSidebar, onBurger }) {
|
||||
const { connected } = useSocket();
|
||||
const [settings, setSettings] = useState({ app_name: 'jama', logo_url: '' });
|
||||
const [settings, setSettings] = useState({ app_name: 'rosterchirp', logo_url: '' });
|
||||
const [isDark, setIsDark] = useState(() => document.documentElement.getAttribute('data-theme') === 'dark');
|
||||
|
||||
useEffect(() => {
|
||||
api.getSettings().then(({ settings }) => setSettings(settings)).catch(() => {});
|
||||
const handler = () => api.getSettings().then(({ settings }) => setSettings(settings)).catch(() => {});
|
||||
window.addEventListener('jama:settings-changed', handler);
|
||||
window.addEventListener('rosterchirp:settings-changed', handler);
|
||||
const themeObserver = new MutationObserver(() => {
|
||||
setIsDark(document.documentElement.getAttribute('data-theme') === 'dark');
|
||||
});
|
||||
themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
|
||||
return () => {
|
||||
window.removeEventListener('jama:settings-changed', handler);
|
||||
window.removeEventListener('rosterchirp:settings-changed', handler);
|
||||
themeObserver.disconnect();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const appName = settings.app_name || 'jama';
|
||||
const appName = settings.app_name || 'rosterchirp';
|
||||
const logoUrl = settings.logo_url;
|
||||
const titleColor = (isDark ? settings.color_title_dark : settings.color_title) || null;
|
||||
|
||||
@@ -48,7 +48,7 @@ export default function GlobalBar({ isMobile, showSidebar, onBurger }) {
|
||||
</svg>
|
||||
</button>
|
||||
<div className="global-bar-brand">
|
||||
<img src={logoUrl || '/icons/jama.png'} alt={appName} className="global-bar-logo" />
|
||||
<img src={logoUrl || '/icons/rosterchirp.png'} alt={appName} className="global-bar-logo" />
|
||||
<span className="global-bar-title" style={titleColor ? { color: titleColor } : {}}>{appName}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* HostPanel.jsx — JAMA-HOST Control Panel
|
||||
* HostPanel.jsx — RosterChirp-Host Control Panel
|
||||
*
|
||||
* Renders inside the main JAMA right-panel area (not a separate page/route).
|
||||
* Renders inside the main RosterChirp right-panel area (not a separate page/route).
|
||||
* Protected by:
|
||||
* 1. Only shown when is_host_domain === true (server-computed from HOST_DOMAIN)
|
||||
* 2. Only accessible to admin role users
|
||||
@@ -15,9 +15,9 @@ import UserFooter from './UserFooter.jsx';
|
||||
// ── Constants ─────────────────────────────────────────────────────────────────
|
||||
|
||||
const PLANS = [
|
||||
{ value: 'chat', label: 'JAMA-Chat', desc: 'Chat only' },
|
||||
{ value: 'brand', label: 'JAMA-Brand', desc: 'Chat + Branding' },
|
||||
{ value: 'team', label: 'JAMA-Team', desc: 'Chat + Branding + Groups + Schedule' },
|
||||
{ value: 'chat', label: 'RosterChirp-Chat', desc: 'Chat only' },
|
||||
{ value: 'brand', label: 'RosterChirp-Brand', desc: 'Chat + Branding' },
|
||||
{ value: 'team', label: 'RosterChirp-Team', desc: 'Chat + Branding + Groups + Schedule' },
|
||||
];
|
||||
|
||||
const PLAN_COLOURS = {
|
||||
@@ -307,7 +307,7 @@ function KeyEntry({ onSubmit }) {
|
||||
setChecking(true); setError('');
|
||||
try {
|
||||
const res = await fetch('/api/host/status', { headers: { 'X-Host-Admin-Key': key.trim() } });
|
||||
if (res.ok) { sessionStorage.setItem('jama-host-key', key.trim()); onSubmit(key.trim()); }
|
||||
if (res.ok) { sessionStorage.setItem('rosterchirp-host-key', key.trim()); onSubmit(key.trim()); }
|
||||
else setError('Invalid admin key');
|
||||
} catch { setError('Connection error'); }
|
||||
finally { setChecking(false); }
|
||||
@@ -336,7 +336,7 @@ function KeyEntry({ onSubmit }) {
|
||||
|
||||
export default function HostPanel({ onProfile, onHelp, onAbout }) {
|
||||
const { user } = useAuth();
|
||||
const [adminKey, setAdminKey] = useState(() => sessionStorage.getItem('jama-host-key') || '');
|
||||
const [adminKey, setAdminKey] = useState(() => sessionStorage.getItem('rosterchirp-host-key') || '');
|
||||
const [status, setStatus] = useState(null);
|
||||
const [tenants, setTenants] = useState([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -363,7 +363,7 @@ export default function HostPanel({ onProfile, onHelp, onAbout }) {
|
||||
toast(e.message, 'error');
|
||||
// Key is invalid — clear it so the prompt shows again
|
||||
if (e.message.includes('401') || e.message.includes('Invalid') || e.message.includes('401')) {
|
||||
sessionStorage.removeItem('jama-host-key');
|
||||
sessionStorage.removeItem('rosterchirp-host-key');
|
||||
setAdminKey('');
|
||||
}
|
||||
} finally { setLoading(false); }
|
||||
|
||||
@@ -5,9 +5,9 @@ import { useToast } from '../contexts/ToastContext.jsx';
|
||||
// ── Helpers ───────────────────────────────────────────────────────────────────
|
||||
|
||||
const APP_TYPES = {
|
||||
'JAMA-Chat': { label: 'JAMA-Chat', desc: 'Chat only. No Branding, Group Manager or Schedule Manager.' },
|
||||
'JAMA-Brand': { label: 'JAMA-Brand', desc: 'Chat and Branding.' },
|
||||
'JAMA-Team': { label: 'JAMA-Team', desc: 'Chat, Branding, Group Manager and Schedule Manager.' },
|
||||
'RosterChirp-Chat': { label: 'RosterChirp-Chat', desc: 'Chat only. No Branding, Group Manager or Schedule Manager.' },
|
||||
'RosterChirp-Brand': { label: 'RosterChirp-Brand', desc: 'Chat and Branding.' },
|
||||
'RosterChirp-Team': { label: 'RosterChirp-Team', desc: 'Chat, Branding, Group Manager and Schedule Manager.' },
|
||||
};
|
||||
|
||||
// ── Team Management Tab ───────────────────────────────────────────────────────
|
||||
@@ -34,7 +34,7 @@ function TeamManagementTab() {
|
||||
try {
|
||||
await api.updateTeamSettings({ toolManagers });
|
||||
toast('Team settings saved', 'success');
|
||||
window.dispatchEvent(new Event('jama:settings-changed'));
|
||||
window.dispatchEvent(new Event('rosterchirp:settings-changed'));
|
||||
} catch (e) { toast(e.message, 'error'); }
|
||||
finally { setSaving(false); }
|
||||
};
|
||||
@@ -82,7 +82,7 @@ function RegistrationTab({ onFeaturesChanged }) {
|
||||
api.getSettings().then(({ settings }) => setSettings(settings)).catch(() => {});
|
||||
}, []);
|
||||
|
||||
const appType = settings.app_type || 'JAMA-Chat';
|
||||
const appType = settings.app_type || 'RosterChirp-Chat';
|
||||
const activeCode = settings.registration_code || '';
|
||||
const adminEmail = settings.admin_email || '—';
|
||||
|
||||
@@ -104,7 +104,7 @@ function RegistrationTab({ onFeaturesChanged }) {
|
||||
const fresh = await api.getSettings();
|
||||
setSettings(fresh.settings);
|
||||
toast('Registration applied successfully.', 'success');
|
||||
window.dispatchEvent(new Event('jama:settings-changed'));
|
||||
window.dispatchEvent(new Event('rosterchirp:settings-changed'));
|
||||
onFeaturesChanged && onFeaturesChanged(f);
|
||||
} catch (e) { toast(e.message || 'Invalid registration code', 'error'); }
|
||||
finally { setRegLoading(false); }
|
||||
@@ -116,12 +116,12 @@ function RegistrationTab({ onFeaturesChanged }) {
|
||||
const fresh = await api.getSettings();
|
||||
setSettings(fresh.settings);
|
||||
toast('Registration cleared.', 'success');
|
||||
window.dispatchEvent(new Event('jama:settings-changed'));
|
||||
window.dispatchEvent(new Event('rosterchirp:settings-changed'));
|
||||
onFeaturesChanged && onFeaturesChanged(f);
|
||||
} catch (e) { toast(e.message, 'error'); }
|
||||
};
|
||||
|
||||
const typeInfo = APP_TYPES[appType] || APP_TYPES['JAMA-Chat'];
|
||||
const typeInfo = APP_TYPES[appType] || APP_TYPES['RosterChirp-Chat'];
|
||||
const siteUrl = window.location.origin;
|
||||
|
||||
return (
|
||||
@@ -132,7 +132,7 @@ function RegistrationTab({ onFeaturesChanged }) {
|
||||
Registration {activeCode ? 'is' : 'required:'}
|
||||
</p>
|
||||
<p style={{ fontSize: 13, color: 'var(--text-secondary)', lineHeight: 1.6 }}>
|
||||
JAMA {activeCode ? 'is' : 'will be'} registered to:<br />
|
||||
RosterChirp {activeCode ? 'is' : 'will be'} registered to:<br />
|
||||
<strong>Type:</strong> {typeInfo.label}<br />
|
||||
<strong>URL:</strong> {siteUrl}
|
||||
</p>
|
||||
@@ -185,9 +185,9 @@ function RegistrationTab({ onFeaturesChanged }) {
|
||||
)}
|
||||
|
||||
<p style={{ fontSize: 12, color: 'var(--text-tertiary)', marginTop: 16, lineHeight: 1.5 }}>
|
||||
Registration codes unlock application features. Contact your JAMA provider for a code.<br />
|
||||
<strong>JAMA-Brand</strong> — unlocks Branding.
|
||||
<strong>JAMA-Team</strong> — unlocks Branding, Group Manager and Schedule Manager.
|
||||
Registration codes unlock application features. Contact your RosterChirp provider for a code.<br />
|
||||
<strong>RosterChirp-Brand</strong> — unlocks Branding.
|
||||
<strong>RosterChirp-Team</strong> — unlocks Branding, Group Manager and Schedule Manager.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
@@ -270,18 +270,18 @@ function WebPushTab() {
|
||||
// ── Main modal ────────────────────────────────────────────────────────────────
|
||||
export default function SettingsModal({ onClose, onFeaturesChanged }) {
|
||||
const [tab, setTab] = useState('registration');
|
||||
const [appType, setAppType] = useState('JAMA-Chat');
|
||||
const [appType, setAppType] = useState('RosterChirp-Chat');
|
||||
|
||||
useEffect(() => {
|
||||
api.getSettings().then(({ settings }) => {
|
||||
setAppType(settings.app_type || 'JAMA-Chat');
|
||||
setAppType(settings.app_type || 'RosterChirp-Chat');
|
||||
}).catch(() => {});
|
||||
const handler = () => api.getSettings().then(({ settings }) => setAppType(settings.app_type || 'JAMA-Chat')).catch(() => {});
|
||||
window.addEventListener('jama:settings-changed', handler);
|
||||
return () => window.removeEventListener('jama:settings-changed', handler);
|
||||
const handler = () => api.getSettings().then(({ settings }) => setAppType(settings.app_type || 'RosterChirp-Chat')).catch(() => {});
|
||||
window.addEventListener('rosterchirp:settings-changed', handler);
|
||||
return () => window.removeEventListener('rosterchirp:settings-changed', handler);
|
||||
}, []);
|
||||
|
||||
const isTeam = appType === 'JAMA-Team';
|
||||
const isTeam = appType === 'RosterChirp-Team';
|
||||
|
||||
const tabs = [
|
||||
isTeam && { id: 'team', label: 'Team Management' },
|
||||
|
||||
@@ -14,20 +14,20 @@ function nameToColor(name) {
|
||||
}
|
||||
|
||||
function useAppSettings() {
|
||||
const [settings, setSettings] = useState({ app_name: 'jama', logo_url: '', color_avatar_public: '', color_avatar_dm: '' });
|
||||
const [settings, setSettings] = useState({ app_name: 'rosterchirp', logo_url: '', color_avatar_public: '', color_avatar_dm: '' });
|
||||
const fetchSettings = () => {
|
||||
api.getSettings().then(({ settings }) => setSettings(settings)).catch(() => {});
|
||||
};
|
||||
useEffect(() => {
|
||||
fetchSettings();
|
||||
window.addEventListener('jama:settings-changed', fetchSettings);
|
||||
return () => window.removeEventListener('jama:settings-changed', fetchSettings);
|
||||
window.addEventListener('rosterchirp:settings-changed', fetchSettings);
|
||||
return () => window.removeEventListener('rosterchirp:settings-changed', fetchSettings);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
const name = settings.app_name || 'jama';
|
||||
const name = settings.app_name || 'rosterchirp';
|
||||
const prefix = document.title.match(/^(\(\d+\)\s*)/)?.[1] || '';
|
||||
document.title = prefix + name;
|
||||
const faviconUrl = settings.logo_url || '/icons/jama.png';
|
||||
const faviconUrl = settings.logo_url || '/icons/rosterchirp.png';
|
||||
let link = document.querySelector("link[rel~='icon']");
|
||||
if (!link) { link = document.createElement('link'); link.rel = 'icon'; document.head.appendChild(link); }
|
||||
link.href = faviconUrl;
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useAuth } from '../contexts/AuthContext.jsx';
|
||||
import Avatar from './Avatar.jsx';
|
||||
|
||||
function useTheme() {
|
||||
const [dark, setDark] = useState(() => localStorage.getItem('jama-theme') === 'dark');
|
||||
const [dark, setDark] = useState(() => localStorage.getItem('rosterchirp-theme') === 'dark');
|
||||
useEffect(() => {
|
||||
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light');
|
||||
localStorage.setItem('jama-theme', dark ? 'dark' : 'light');
|
||||
localStorage.setItem('rosterchirp-theme', dark ? 'dark' : 'light');
|
||||
}, [dark]);
|
||||
return [dark, setDark];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user