* B2B-87: add company statistics consent * add toggle for company statistics consent under profile * add toggle for company statistics consent under profile * add audit logging to accounts * change policy * add audit logging to accounts * remove full account data query and just query the entire account every time * add comment about consent toggle * make constants hardcoded, as dynamic ones do not work * add back pending check --------- Co-authored-by: Helena <helena@Helenas-MacBook-Pro.local>
25 lines
720 B
TypeScript
25 lines
720 B
TypeScript
import { requireUserInServerComponent } from '../../lib/server/require-user-in-server-component';
|
|
import ConsentDialog from './(user)/_components/consent-dialog';
|
|
import { loadUserAccount } from './(user)/_lib/server/load-user-account';
|
|
|
|
export default async function HomeLayout({
|
|
children,
|
|
}: {
|
|
children: React.ReactNode;
|
|
}) {
|
|
const user = await requireUserInServerComponent();
|
|
const account = user?.identities?.[0]?.id
|
|
? await loadUserAccount(user?.identities?.[0]?.id)
|
|
: null;
|
|
|
|
if (account && account?.has_consent_anonymized_company_statistics === null) {
|
|
return (
|
|
<div className="container">
|
|
<ConsentDialog userId={user.id} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return <>{children}</>;
|
|
}
|