-
Notifications
You must be signed in to change notification settings - Fork 17
WIP: Feature: add welcome screen #25
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
WIP: Feature: add welcome screen #25
Conversation
| const [searchParams, setSearchParams] = useSearchParams(); | ||
|
|
||
| const toCreate = searchParams.get('add-extension') === 'true'; | ||
|
|
||
| const setToCreate = (value: boolean) => { | ||
| const newParams = new URLSearchParams(searchParams); | ||
| if (value) { | ||
| newParams.set('add-extension', 'true'); | ||
| } else { | ||
| newParams.delete('add-extension'); | ||
| } | ||
| setSearchParams(newParams); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated code in ConfigurationPage und ExtensionPage.
I'm not 100% sure I understand what this code tries to accomplish. Isn't this basically redirect? Couldn't we simply use router.push(...)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not a redirect: We are updating the url search parameter 'add-extension'.
|
|
||
| const toCreate = searchParams.get('add-extension') === 'true'; | ||
|
|
||
| const setToCreate = (value: boolean) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that this is a click handler, a name like handleSomeButtonClick might be more canonical.
| queryKey: ['enabled-configurations'], | ||
| queryFn: () => api.extensions.getConfigurations(true), | ||
| }); | ||
| if (!loadedConfigurations) return <></>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the empty answer intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we currently don't have a skeleton, we just show a blank page
| import { Button, Text, Title } from '@mantine/core'; | ||
| import { IconArrowRight } from '@tabler/icons-react'; | ||
| import { useProfile } from 'src/hooks'; | ||
|
|
||
| export const WelcomePage = () => { | ||
| const profile = useProfile(); | ||
| if (!profile) return <></>; | ||
| return ( | ||
| <div className="flex h-screen items-center justify-center p-4"> | ||
| <div className="max-w-[500px] [&>*]:pb-2"> | ||
| <Title>Welcome to c4 GenAI Suite</Title> | ||
| <Text c="dimmed">An AI chatbot with Model Context Provider (MCP) integration. Powered by Langchain.</Text> | ||
| <br /> | ||
| {profile.isAdmin ? ( | ||
| <Button component="a" href="/admin/assistants?create=true" rightSection={<IconArrowRight className="w-4" />}> | ||
| Setup an Assistent | ||
| </Button> | ||
| ) : ( | ||
| <Text c="dimmed">No Assistent is set up yet. Ask your Admin to set up an Assistent get started.</Text> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given how short this JSX is (short for JSX anyway), would it make sense to add this as an early return the ExtensionsPage, avoid all this indirection and extra layering and have one component instead of four?
The goal here seems to be displaying a default message when the Extensions page is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is actually shown in the user section. When no assistent exists, we show a welcome page
f7a0312 to
a4de045
Compare
|
@marcusleg Could you please trigger the workflow for me? |
1a80c29 to
05b400e
Compare
|
Updated PR: #69 |
Still work in progress