Enhance Activepieces automation flows with restore UI and publishing

- Add "Restore Defaults" dropdown to Automations page with confirmation
- Create flows in "Defaults" folder for organization
- Pre-populate trigger sample data when creating/restoring flows
- Auto-publish flows (lock and enable) after creation
- Fix email template context variables to match template tags
- Fix dark mode logo switching in Activepieces iframe
- Add iframe refresh on flow restore
- Auto-populate business context (name, email, phone, address) in emails

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
poduck
2025-12-21 23:38:10 -05:00
parent ac3115a5a1
commit 7b380fa903
14 changed files with 786 additions and 149 deletions

View File

@@ -1,15 +1,64 @@
import { t } from 'i18next';
import { useEffect, useState } from 'react';
import { flagsHooks } from '@/hooks/flags-hooks';
import { useTheme } from '@/components/theme-provider';
const FullLogo = () => {
const branding = flagsHooks.useWebsiteBranding();
const { theme } = useTheme();
// Track resolved theme from DOM (handles 'system' theme correctly)
const [isDark, setIsDark] = useState(() =>
document.documentElement.classList.contains('dark')
);
useEffect(() => {
// Update when theme changes - check the actual applied class
const checkDark = () => {
setIsDark(document.documentElement.classList.contains('dark'));
};
checkDark();
// Observe class changes on documentElement
const observer = new MutationObserver((mutations) => {
for (const mutation of mutations) {
if (mutation.attributeName === 'class') {
checkDark();
}
}
});
observer.observe(document.documentElement, { attributes: true });
return () => observer.disconnect();
}, [theme]);
// Support dark mode by switching logo URLs
// Light logo (dark text) for light mode, dark logo (light text) for dark mode
const baseLogoUrl = branding.logos.fullLogoUrl;
// Compute the appropriate logo URL based on theme
let logoUrl = baseLogoUrl;
if (isDark) {
// Need dark logo (light text for dark background)
if (baseLogoUrl.includes('-light.svg')) {
logoUrl = baseLogoUrl.replace('-light.svg', '-dark.svg');
} else if (!baseLogoUrl.includes('-dark.svg')) {
logoUrl = baseLogoUrl.replace(/\.svg$/, '-dark.svg');
}
} else {
// Need light logo (dark text for light background)
if (baseLogoUrl.includes('-dark.svg')) {
logoUrl = baseLogoUrl.replace('-dark.svg', '-light.svg');
}
// Otherwise use base URL as-is (assumed to be light version)
}
return (
<div className="h-[60px]">
<img
className="h-full"
src={branding.logos.fullLogoUrl}
src={logoUrl}
alt={t('logo')}
/>
</div>