Files
smoothschedule/activepieces-fork/packages/react-ui/src/components/ui/home-button.tsx
poduck 3aa7199503 Add Activepieces integration for workflow automation
- Add Activepieces fork with SmoothSchedule custom piece
- Create integrations app with Activepieces service layer
- Add embed token endpoint for iframe integration
- Create Automations page with embedded workflow builder
- Add sidebar visibility fix for embed mode
- Add list inactive customers endpoint to Public API
- Include SmoothSchedule triggers: event created/updated/cancelled
- Include SmoothSchedule actions: create/update/cancel events, list resources/services/customers

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:59:37 -05:00

76 lines
2.2 KiB
TypeScript

import { t } from 'i18next';
import { ChevronLeft } from 'lucide-react';
import { Link } from 'react-router-dom';
import { flagsHooks } from '@/hooks/flags-hooks';
import { authenticationSession } from '@/lib/authentication-session';
import { ActivepiecesClientEventName } from 'ee-embed-sdk';
import { useEmbedding } from '../embed-provider';
import { Button } from './button';
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';
const HomeButtonWrapper = ({ children }: { children: React.ReactNode }) => {
const { embedState } = useEmbedding();
if (embedState.emitHomeButtonClickedEvent) {
const handleClick = () => {
window.parent.postMessage(
{
type: ActivepiecesClientEventName.CLIENT_BUILDER_HOME_BUTTON_CLICKED,
data: {
route: '/flows',
},
},
'*',
);
};
return <div onClick={handleClick}>{children}</div>;
}
return (
<Link to={authenticationSession.appendProjectRoutePrefix('/flows')}>
{children}
</Link>
);
};
const HomeButton = () => {
const { embedState } = useEmbedding();
const branding = flagsHooks.useWebsiteBranding();
const showBackButton = embedState.homeButtonIcon === 'back';
return (
<>
{!embedState.hideHomeButtonInBuilder && (
<Tooltip>
<HomeButtonWrapper>
<TooltipTrigger asChild>
<Button
variant="ghost"
size={'icon'}
className={showBackButton ? 'size-8' : 'size-10'}
>
{!showBackButton && (
<img
className="h-5 w-5 object-contain"
src={branding.logos.logoIconUrl}
alt={branding.websiteName}
/>
)}
{showBackButton && <ChevronLeft className="h-4 w-4" />}
</Button>
</TooltipTrigger>
</HomeButtonWrapper>
{!showBackButton && (
<TooltipContent side="bottom">
{t('Go to Dashboard')}
</TooltipContent>
)}
</Tooltip>
)}
</>
);
};
HomeButton.displayName = 'HomeButton';
export { HomeButton };