openreplay/frontend/app/components/Onboarding/Onboarding.tsx
Delirium dca5e54811
Kai UI (#3336)
* ui: kai ui thing

ui: fixes for picking existing chat, feedback and retry buttons

ui: connect finding, creating threads

ui: more ui tuning for chat window, socket manager

ui: get/delete chats logic, create testing socket

ui: testing

ui: use on click query

ui: minor fixed for chat display, rebase

ui: start kai thing

* ui: add logs, add threadid

* ui: feedback methods and ui

* ui: store, replacing messages and giving feedback

* ui: move retry btn to right corner

* ui: move kai service out for ease of code splitting

* ui: add thread id to socket connection

* ui: support state messages

* ui: cancel response generation method

* ui: fix toast str

* ui: add gfm plugin

* ui: ensure md table has max sizes to prevent overflow

* ui: revert tailwind styles on markdown block layer

* ui: export as pdf, copy text contents of a message

* ui: try to save text with formatting in secure contexts

* ui: fix types

* ui: fixup dark mode colors

* ui: add duration for msgs

* ui: take out custom jwt

* ui: removing hardcode...

* ui: change endpoints to prod

* ui: swap socket path

* ui: flip vis toggle

* ui: lock file regenerate
2025-05-13 14:00:09 +02:00

114 lines
3.3 KiB
TypeScript

import React from 'react';
import { Redirect, Route, RouteComponentProps, Switch } from 'react-router';
import { withRouter } from 'react-router-dom';
import { OB_TABS, onboarding as onboardingRoute, withSiteId } from 'App/routes';
import IdentifyUsersTab from './components/IdentifyUsersTab';
import InstallOpenReplayTab from './components/InstallOpenReplayTab';
import IntegrationsTab from './components/IntegrationsTab';
import ManageUsersTab from './components/ManageUsersTab';
import SideMenu from './components/SideMenu';
import { useTranslation } from 'react-i18next';
import { Smartphone, AppWindow } from 'lucide-react';
import { PANEL_SIZES } from 'App/constants/panelSizes';
interface Props {
match: {
params: {
activeTab: string;
siteId: string;
};
};
history: RouteComponentProps['history'];
}
const platformMap = {
ios: 'mobile',
web: 'web',
};
function Onboarding(props: Props) {
const { t } = useTranslation();
const platforms = [
{
label: (
<div className="font-semibold flex gap-2 items-center">
<AppWindow size={16} />
&nbsp;{t('Web')}
</div>
),
value: 'web',
} as const,
{
label: (
<div className="font-semibold flex gap-2 items-center">
<Smartphone size={16} />
&nbsp;{t('Mobile')}
</div>
),
value: 'mobile',
} as const,
] as const;
const [platform, setPlatform] = React.useState(platforms[0]);
const {
match: {
params: { activeTab, siteId },
},
} = props;
const route = (path: string) => withSiteId(onboardingRoute(path));
const onMenuItemClick = (tab: string) => {
props.history.push(withSiteId(onboardingRoute(tab), siteId));
};
return (
<div className="flex relative">
<SideMenu activeTab={activeTab} onClick={onMenuItemClick} />
<div className="w-full">
<div
className="bg-white w-full rounded-lg mx-auto mb-8 border"
style={{ maxWidth: PANEL_SIZES.maxWidth }}
>
<Switch>
<Route exact strict path={route(OB_TABS.INSTALLING)}>
<InstallOpenReplayTab
platforms={platforms}
platform={platform}
setPlatform={setPlatform}
platformMap={platformMap}
/>
</Route>
<Route exact strict path={route(OB_TABS.IDENTIFY_USERS)}>
<IdentifyUsersTab
platforms={platforms}
platform={platform}
setPlatform={setPlatform}
platformMap={platformMap}
/>
</Route>
<Route
exact
strict
path={route(OB_TABS.MANAGE_USERS)}
component={ManageUsersTab}
/>
<Route
exact
strict
path={route(OB_TABS.INTEGRATIONS)}
component={IntegrationsTab}
/>
<Redirect to={route(OB_TABS.INSTALLING)} />
</Switch>
</div>
</div>
{/* <div className="py-6 px-4 w-full flex items-center fixed bottom-0 bg-white border-t z-10">
<div className="ml-auto">
<OnboardingNavButton />
</div>
</div> */}
</div>
);
}
export default withRouter(Onboarding);