Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-add flow-assistant GPT link index.tsx #1091

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ const ContentFeatures: Record<string, ContentFeatureProps> = {
},
};

const homepagePillData: Record<string, HomepagePillItemsProps> = {
const homepagePillData: Record<
string,
HomepagePillItemsProps & {
onClick?: () => void;
}
> = {
'dev-office-hours': {
link: 'https://calendar.google.com/calendar/embed?src=c_47978f5cd9da636cadc6b8473102b5092c1a865dd010558393ecb7f9fd0c9ad0%40group.calendar.google.com',
icon: 'dev-office-hours',
Expand All @@ -55,6 +60,33 @@ const homepagePillData: Record<string, HomepagePillItemsProps> = {
icon: 'flow-assistant-gpt',
text: 'Flow AI Assistant',
subText: 'Chat with devs',
onClick: () => {
const el = document.querySelector('ask-cookbook') as HTMLElement & {
shadowRoot?: ShadowRoot;
};
if (!el) {
console.warn('ask-cookbook element not found');
return;
}

const shadow = el.shadowRoot;
if (!shadow) {
console.warn('ask-cookbook has no shadowRoot');
return;
}

const button = shadow.querySelector(
'#ask-cookbook-button',
) as HTMLButtonElement;
if (!button) {
console.warn(
'Internal #ask-cookbook-button not found in the shadow root',
);
return;
}

button.click();
},
},
'developer-chat': {
link: 'https://discord.gg/flow',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,27 @@ export interface HomepagePillItemsProps {
icon: string;
text: string;
subText?: string;
onClick?: () => void;
}

export function HomepagePillItem({
link,
text,
icon,
subText = 'View Latest',
onClick,
}: HomepagePillItemsProps): React.ReactElement {
return (
<AppLink
className="flex py-3 pl-3 cursor-pointer rounded-custom text-black hover:no-underline hover:text-black hover:bg-primary-gray-10 bg-white justify-start items-center hover:border-black"
to={link}
onClick={(e) => {
// If there's an onClick, call it instead of normal navigation
if (onClick) {
e.preventDefault();
onClick();
}
}}
>
<HomepageStartItemIcons icon={icon} />
<div className="relative group align-center mx-2">
Expand Down
Loading