Merge branch 'main' into MED-105-v3
This commit is contained in:
@@ -5,6 +5,10 @@ import pathsConfig from '@/config/paths.config';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
import {
|
||||
PAGE_VIEW_ACTION,
|
||||
createPageViewLog,
|
||||
} from '~/lib/services/audit/pageView.service';
|
||||
|
||||
import MembershipConfirmationNotification from './_components/membership-confirmation-notification';
|
||||
|
||||
@@ -18,6 +22,10 @@ async function MembershipConfirmation() {
|
||||
if (!user?.id) {
|
||||
redirect(pathsConfig.app.home);
|
||||
}
|
||||
await createPageViewLog({
|
||||
accountId: user.id,
|
||||
action: PAGE_VIEW_ACTION.REGISTRATION_SUCCESS,
|
||||
});
|
||||
|
||||
return <MembershipConfirmationNotification userId={user.id} />;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import Link from 'next/link';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import { loadCurrentUserAccount } from '@/app/home/(user)/_lib/server/load-user-account';
|
||||
import { createI18nServerInstance } from '@/lib/i18n/i18n.server';
|
||||
import { withI18n } from '@/lib/i18n/with-i18n';
|
||||
|
||||
@@ -7,16 +9,18 @@ import { Trans } from '@kit/ui/makerkit/trans';
|
||||
import { PageBody } from '@kit/ui/page';
|
||||
import { Button } from '@kit/ui/shadcn/button';
|
||||
|
||||
import { loadUserAnalysis } from '../../_lib/server/load-user-analysis';
|
||||
import Analysis from './_components/analysis';
|
||||
import pathsConfig from '~/config/paths.config';
|
||||
import { redirect } from 'next/navigation';
|
||||
import { AnalysisOrder, getAnalysisOrders } from '~/lib/services/order.service';
|
||||
import { getAnalysisElements } from '~/lib/services/analysis-element.service';
|
||||
import { loadCurrentUserAccount } from '@/app/home/(user)/_lib/server/load-user-account';
|
||||
import { createPageViewLog } from '~/lib/services/audit/pageView.service';
|
||||
import {
|
||||
PAGE_VIEW_ACTION,
|
||||
createPageViewLog,
|
||||
} from '~/lib/services/audit/pageView.service';
|
||||
import { AnalysisOrder, getAnalysisOrders } from '~/lib/services/order.service';
|
||||
import { ButtonTooltip } from '~/components/ui/button-tooltip';
|
||||
|
||||
import Analysis from './_components/analysis';
|
||||
import { loadUserAnalysis } from '../../_lib/server/load-user-analysis';
|
||||
|
||||
export const generateMetadata = async () => {
|
||||
const i18n = await createI18nServerInstance();
|
||||
const title = i18n.t('analysis-results:pageTitle');
|
||||
@@ -27,13 +31,15 @@ export const generateMetadata = async () => {
|
||||
};
|
||||
|
||||
async function AnalysisResultsPage() {
|
||||
const account = await loadCurrentUserAccount()
|
||||
const account = await loadCurrentUserAccount();
|
||||
if (!account) {
|
||||
throw new Error('Account not found');
|
||||
}
|
||||
|
||||
const analysisResponses = await loadUserAnalysis();
|
||||
const analysisResponseElements = analysisResponses?.flatMap(({ elements }) => elements);
|
||||
const analysisResponseElements = analysisResponses?.flatMap(
|
||||
({ elements }) => elements,
|
||||
);
|
||||
|
||||
const analysisOrders = await getAnalysisOrders().catch(() => null);
|
||||
|
||||
@@ -43,7 +49,7 @@ async function AnalysisResultsPage() {
|
||||
|
||||
await createPageViewLog({
|
||||
accountId: account.id,
|
||||
action: 'VIEW_ANALYSIS_RESULTS',
|
||||
action: PAGE_VIEW_ACTION.VIEW_ANALYSIS_RESULTS,
|
||||
});
|
||||
|
||||
const getAnalysisElementIds = (analysisOrders: AnalysisOrder[]) => [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { User } from '@supabase/supabase-js';
|
||||
|
||||
import { ApplicationRole } from '@kit/accounts/types/accounts';
|
||||
import {
|
||||
Sidebar,
|
||||
SidebarContent,
|
||||
@@ -18,6 +19,7 @@ type AccountModel = {
|
||||
label: string | null;
|
||||
value: string | null;
|
||||
image: string | null;
|
||||
application_role: ApplicationRole | null;
|
||||
};
|
||||
|
||||
export function TeamAccountLayoutSidebar(props: {
|
||||
@@ -73,7 +75,10 @@ function SidebarContainer(props: {
|
||||
|
||||
<SidebarFooter>
|
||||
<SidebarContent>
|
||||
<ProfileAccountDropdownContainer user={props.user} />
|
||||
<ProfileAccountDropdownContainer
|
||||
user={props.user}
|
||||
accounts={accounts}
|
||||
/>
|
||||
</SidebarContent>
|
||||
</SidebarFooter>
|
||||
</Sidebar>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
BorderedNavigationMenu,
|
||||
BorderedNavigationMenuItem,
|
||||
} from '@kit/ui/bordered-navigation-menu';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { AppLogo } from '~/components/app-logo';
|
||||
import { ProfileAccountDropdownContainer } from '~/components/personal-account-dropdown-container';
|
||||
@@ -10,18 +7,22 @@ import { getTeamAccountSidebarConfig } from '~/config/team-account-navigation.co
|
||||
// local imports
|
||||
import { TeamAccountWorkspace } from '../_lib/server/team-account-workspace.loader';
|
||||
import { TeamAccountNotifications } from './team-account-notifications';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export function TeamAccountNavigationMenu(props: {
|
||||
workspace: TeamAccountWorkspace;
|
||||
}) {
|
||||
const { account, user, accounts: rawAccounts } = props.workspace;
|
||||
|
||||
const accounts = useMemo(() => rawAccounts.map((account) => ({
|
||||
label: account.name,
|
||||
value: account.slug,
|
||||
image: account.picture_url,
|
||||
})),[rawAccounts])
|
||||
const accounts = useMemo(
|
||||
() =>
|
||||
rawAccounts.map((account) => ({
|
||||
label: account.name,
|
||||
value: account.slug,
|
||||
image: account.picture_url,
|
||||
application_role: account.application_role,
|
||||
})),
|
||||
[rawAccounts],
|
||||
);
|
||||
|
||||
const routes = getTeamAccountSidebarConfig(account.slug).routes.reduce<
|
||||
Array<{
|
||||
@@ -48,7 +49,7 @@ export function TeamAccountNavigationMenu(props: {
|
||||
<AppLogo />
|
||||
</div>
|
||||
|
||||
<div className={'flex items-center justify-end space-x-2.5 gap-2'}>
|
||||
<div className={'flex items-center justify-end gap-2 space-x-2.5'}>
|
||||
<TeamAccountNotifications accountId={account.id} userId={user.id} />
|
||||
<ProfileAccountDropdownContainer
|
||||
user={user}
|
||||
|
||||
@@ -43,6 +43,7 @@ const HealthBenefitForm = ({
|
||||
amount: currentCompanyParams.benefit_amount || 0,
|
||||
},
|
||||
});
|
||||
const isDirty = form.formState.isDirty;
|
||||
|
||||
const onSubmit = (data: { occurance: string; amount: number }) => {
|
||||
const promise = async () => {
|
||||
@@ -55,6 +56,7 @@ const HealthBenefitForm = ({
|
||||
benefit_occurance: data.occurance,
|
||||
}));
|
||||
} finally {
|
||||
form.reset(data);
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
@@ -83,7 +85,11 @@ const HealthBenefitForm = ({
|
||||
<Trans i18nKey="billing:description" />
|
||||
</p>
|
||||
</div>
|
||||
<Button type="submit" className="relative" disabled={isLoading}>
|
||||
<Button
|
||||
type="submit"
|
||||
className="relative"
|
||||
disabled={!isDirty || isLoading}
|
||||
>
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<Spinner />
|
||||
|
||||
@@ -45,11 +45,14 @@ function SidebarLayout({
|
||||
const data = use(loadTeamWorkspace(account));
|
||||
const state = use(getLayoutState(account));
|
||||
|
||||
const accounts = data.accounts.map(({ name, slug, picture_url }) => ({
|
||||
label: name,
|
||||
value: slug,
|
||||
image: picture_url,
|
||||
}));
|
||||
const accounts = data.accounts.map(
|
||||
({ name, slug, picture_url, application_role }) => ({
|
||||
label: name,
|
||||
value: slug,
|
||||
image: picture_url,
|
||||
application_role,
|
||||
}),
|
||||
);
|
||||
|
||||
return (
|
||||
<TeamAccountWorkspaceContextProvider value={data}>
|
||||
@@ -91,11 +94,14 @@ function HeaderLayout({
|
||||
}>) {
|
||||
const data = use(loadTeamWorkspace(account));
|
||||
|
||||
const accounts = data.accounts.map(({ name, slug, picture_url }) => ({
|
||||
label: name,
|
||||
value: slug,
|
||||
image: picture_url,
|
||||
}));
|
||||
const accounts = data.accounts.map(
|
||||
({ name, slug, picture_url, application_role }) => ({
|
||||
label: name,
|
||||
value: slug,
|
||||
image: picture_url,
|
||||
application_role,
|
||||
}),
|
||||
);
|
||||
|
||||
return (
|
||||
<TeamAccountWorkspaceContextProvider value={data}>
|
||||
|
||||
Reference in New Issue
Block a user