// CompanyGear — a unified "settings" button that lives on every main screen.
// Default: a clean stroked gear icon.
// When the user enables `useLogoIcon` in Einstellungen → Darstellung AND has
// uploaded a logo, the gear is swapped for the logo (same tap-target, same
// behaviour — opens the global FirmenprofilSheet).
const CompanyCtx = React.createContext({ company: {}, openSettings: () => {} });
window.CompanyCtx = CompanyCtx;
// Feather-style 6-tooth settings gear in a 24×24 viewBox.
const GEAR_PATH =
'M12.22 2h-.44a2 2 0 00-2 2v.18a2 2 0 01-1 1.73l-.43.25a2 2 0 01-2 0l-.15-.08a2 2 0 00-2.73.73l-.22.38a2 2 0 00.73 2.73l.15.1a2 2 0 011 1.72v.51a2 2 0 01-1 1.74l-.15.09a2 2 0 00-.73 2.73l.22.38a2 2 0 002.73.73l.15-.08a2 2 0 012 0l.43.25a2 2 0 011 1.73V20a2 2 0 002 2h.44a2 2 0 002-2v-.18a2 2 0 011-1.73l.43-.25a2 2 0 012 0l.15.08a2 2 0 002.73-.73l.22-.39a2 2 0 00-.73-2.73l-.15-.08a2 2 0 01-1-1.74v-.5a2 2 0 011-1.74l.15-.09a2 2 0 00.73-2.73l-.22-.38a2 2 0 00-2.73-.73l-.15.08a2 2 0 01-2 0l-.43-.25a2 2 0 01-1-1.73V4a2 2 0 00-2-2z';
function CompanyGear({ size = 38, style }) {
const t = useTheme();
const ctx = React.useContext(CompanyCtx);
const company = (ctx && ctx.company) || {};
const open = (ctx && ctx.openSettings) || (() => {});
// Studio design: render the round bordered gear in-place (matches the home one),
// so it sits correctly in each screen's header action row.
if (t.studio) {
return (
);
}
// The "Firmenlogo statt Zahnrad" toggle lives on the company object so it
// travels through the same persistence and context as everything else.
const showLogo = !!(company.useLogoIcon && company.logo);
if (showLogo) {
// Logo mode — circular chip with the user's logo inside.
const pad = Math.round(size * 0.18);
return (
{ e.target.style.display = 'none'; }}
/>
);
}
// Default — clean settings gear in the standard chip treatment used by the
// sibling header buttons (search, reorder, …).
const iconSize = Math.round(size * 0.5);
return (