[hive/app] remove use client comments, remove globalThis.window checks (#5004)

This commit is contained in:
Dimitri POSTOLOV 2024-10-21 14:24:34 +03:00 committed by GitHub
parent 4c940ba070
commit 0c04caf5b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 13 additions and 50 deletions

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { ChevronDown } from 'lucide-react';
import { cn } from '@/lib/utils';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { buttonVariants } from '@/components/ui/button';
import { cn } from '@/lib/utils';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { DayPicker } from 'react-day-picker';
import { cn } from '@/lib/utils';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { Command as CommandPrimitive } from 'cmdk';
import { Search } from 'lucide-react';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { X } from 'lucide-react';
import { cn } from '@/lib/utils';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { cn } from '@/lib/utils';
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { cva, type VariantProps } from 'class-variance-authority';
import { cn } from '@/lib/utils';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { cn } from '@/lib/utils';
import * as PopoverPrimitive from '@radix-ui/react-popover';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { Circle } from 'lucide-react';
import { cn } from '@/lib/utils';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { cn } from '@/lib/utils';
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';

View file

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { cn } from '@/lib/utils';
import * as SwitchPrimitives from '@radix-ui/react-switch';

View file

@ -1,5 +1,3 @@
'use client';
import {
Toast,
ToastClose,

View file

@ -23,18 +23,18 @@ export const frontendConfig = () => {
if (
env.auth.okta !== null &&
(env.auth.okta.hidden === false ||
globalThis.window?.location.pathname === '/auth/callback/okta' ||
window.location.pathname === '/auth/callback/okta' ||
// Until we support the Okta Integration Network (OIN)
// We want to hide the log in with Okta button on the hosted platform by default to not confuse people
// We only want to show it conditionally in order to verify the integration is working for the OIN application process.
(env.auth.okta.hidden === true &&
// Only show Okta via query parameter
new URLSearchParams(globalThis.window?.location.search ?? '').get('show_okta') === '1'))
new URLSearchParams(window.location.search ?? '').get('show_okta') === '1'))
) {
providers.push(ThirdPartyEmailPasswordReact.Okta.init());
}
const url = new URL(globalThis.window.location.toString());
const url = new URL(window.location.toString());
if (
env.auth.oidc === true && // Open ID Connect linked to organization

View file

@ -1,14 +1,3 @@
function isBrowser() {
// eslint-disable-next-line no-restricted-syntax
return Boolean(
typeof window !== 'undefined' && '__ENV' in window && window['__ENV'] !== undefined,
);
}
export function getAllEnv(): Record<string, string | undefined> {
if (isBrowser()) {
return (window as any)['__ENV'] ?? {};
}
throw new Error('getAllEnv should only be called in the browser');
return (window as any).__ENV ?? {};
}

View file

@ -70,17 +70,15 @@ import { TargetInsightsOperationPage } from './pages/target-insights-operation';
import { TargetLaboratoryPage } from './pages/target-laboratory';
import { TargetSettingsPage } from './pages/target-settings';
if (globalThis.window) {
SuperTokens.init(frontendConfig());
if (env.sentry) {
init({
dsn: env.sentry.dsn,
enabled: true,
dist: 'webapp',
release: env.release,
environment: env.environment,
});
}
SuperTokens.init(frontendConfig());
if (env.sentry) {
init({
dsn: env.sentry.dsn,
enabled: true,
dist: 'webapp',
release: env.release,
environment: env.environment,
});
}
const queryClient = new QueryClient();