Skip to content
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

Release #3236

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Release #3236

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"source.organizeImports": "never",
"source.sortMembers": "never",
"organizeImports": "never",
"source.removeUnusedImports": "always"
// "source.removeUnusedImports": "always"
},
"vsicons.presets.angular": true,
"deepscan.enable": true,
Expand Down
230 changes: 102 additions & 128 deletions apps/web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,28 @@ import { JitsuOptions } from '@jitsu/jitsu-react/dist/useJitsu';

import { PHProvider } from './integration/posthog/provider';

const locales = [
'en',
'de',
'ar',
'bg',
'zh',
'nl',
'de',
'he',
'it',
'pl',
'pt',
'ru',
'es',
'fr'
];
const locales = ['en', 'de', 'ar', 'bg', 'zh', 'nl', 'de', 'he', 'it', 'pl', 'pt', 'ru', 'es', 'fr'];
interface Props {
params: { locale: string };

pageProps: {
jitsuConf?: JitsuOptions;
jitsuHost?: string;
envs: Record<string, string>;
user?: any;
};
params: { locale: string };

pageProps: {
jitsuConf?: JitsuOptions;
jitsuHost?: string;
envs: Record<string, string>;
user?: any;
};
}

const poppins = Poppins({
subsets: ['latin'],
weight: '500',
variable: '--font-poppins',
display: 'swap'
subsets: ['latin'],
weight: '500',
variable: '--font-poppins',
display: 'swap'
});

const PostHogPageView = dynamic(
() => import('./integration/posthog/page-view'),
{
ssr: false
}
);
const PostHogPageView = dynamic(() => import('./integration/posthog/page-view'), {
ssr: false
});

// export function generateStaticParams() {
// return locales.map((locale: any) => ({ locale }));
Expand All @@ -75,67 +57,63 @@ const PostHogPageView = dynamic(
// }

const LocaleLayout = ({ children, params: { locale }, pageProps }: PropsWithChildren<Props>) => {
// Validate that the incoming `locale` parameter is valid
if (!locales.includes(locale as string)) notFound();
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const { isApiWork, loading } = useCheckAPI();
// Enable static rendering
// unstable_setRequestLocale(locale);
const formatTitle = (url: string) => {
// Separate the URL into pathname and query parts
const [pathname, queryString] = url.split('?');

// Ignore language codes or any initial two-letter or specific codes like 'ru', 'ur'
const segments = pathname
.split('/')
.filter((seg) => seg && seg.length > 2)
.map((seg) => {
// Replace dashes with spaces in the segment if it looks like a UUID or has digits (likely an ID)
if (seg.includes('-') || /\d/.test(seg)) {
return ''; // Exclude IDs from title
}
return seg.charAt(0).toUpperCase() + seg.slice(1).toLowerCase(); // Capitalize non-ID segments
})
.filter((seg: string) => seg); // Remove empty strings resulting from ID exclusion

// Process query parameters, specifically looking for 'name'
let namePart = '';
if (queryString) {
const params = new URLSearchParams(queryString);
if (params?.get('name')) {
const name = params.get('name') ?? '';
const nameValue =
name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
namePart = nameValue;
}
}

// Combine the pathname segments with the name part, if present
const title = [...segments, namePart].filter((part) => part).join(' | ');

return title;
};

const name = searchParams?.get('name');

// eslint-disable-next-line @typescript-eslint/no-var-requires
const messages = require(`../../locales/${locale}.json`);

useEffect(() => {
if (!isApiWork && !loading) router.push(`/maintenance`);
else if (isApiWork && pathname?.split('/').reverse()[0] === 'maintenance')
router.replace('/');
}, [isApiWork, loading, router, pathname]);
return (
<html lang={locale} className={poppins.variable}>
<head>
<title>
{formatTitle(`${pathname}${name ? `?name=${name}` : ''}`) || 'Home'}
</title>
</head>
{/* <head>
// Validate that the incoming `locale` parameter is valid
if (!locales.includes(locale as string)) notFound();
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const { isApiWork, loading } = useCheckAPI();
// Enable static rendering
// unstable_setRequestLocale(locale);
const formatTitle = (url: string) => {
// Separate the URL into pathname and query parts
const [pathname, queryString] = url.split('?');

// Ignore language codes or any initial two-letter or specific codes like 'ru', 'ur'
const segments = pathname
.split('/')
.filter((seg) => seg && seg.length > 2)
.map((seg) => {
// Replace dashes with spaces in the segment if it looks like a UUID or has digits (likely an ID)
if (seg.includes('-') || /\d/.test(seg)) {
return ''; // Exclude IDs from title
}
return seg.charAt(0).toUpperCase() + seg.slice(1).toLowerCase(); // Capitalize non-ID segments
})
.filter((seg: string) => seg); // Remove empty strings resulting from ID exclusion

// Process query parameters, specifically looking for 'name'
let namePart = '';
if (queryString) {
const params = new URLSearchParams(queryString);
if (params?.get('name')) {
const name = params.get('name') ?? '';
const nameValue = name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
namePart = nameValue;
}
}

// Combine the pathname segments with the name part, if present
const title = [...segments, namePart].filter((part) => part).join(' | ');

return title;
};

const name = searchParams?.get('name');

// eslint-disable-next-line @typescript-eslint/no-var-requires
const messages = require(`../../locales/${locale}.json`);

useEffect(() => {
if (!isApiWork && !loading) router.push(`/maintenance`);
else if (isApiWork && pathname?.split('/').reverse()[0] === 'maintenance') router.replace('/');
}, [isApiWork, loading, router, pathname]);
return (
<html lang={locale} className={poppins.variable}>
<head>
<title>{formatTitle(`${pathname}${name ? `?name=${name}` : ''}`) || 'Home'}</title>
</head>
{/* <head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
{GA_MEASUREMENT_ID.value && (
Expand All @@ -150,39 +128,35 @@ const LocaleLayout = ({ children, params: { locale }, pageProps }: PropsWithChil
</>
)}
</head> */}
<NextIntlClientProvider
locale={locale}
messages={messages}
timeZone="Asia/Kolkata"
>
<PHProvider>
<body className={clsx('flex h-full flex-col dark:bg-[#191A20]')}>
<PostHogPageView />

<NextAuthSessionProvider>
<Provider>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{loading && !pathname?.startsWith('/auth') ? (
<GlobalSkeleton />
) : (
<>
<AppState />
<JitsuRoot pageProps={pageProps}>{children}</JitsuRoot>
</>
)}
</ThemeProvider>
</Provider>
</NextAuthSessionProvider>
</body>
</PHProvider>
</NextIntlClientProvider>
</html>
);
<NextIntlClientProvider locale={locale} messages={messages} timeZone="Asia/Kolkata">
<PHProvider>
<body className={clsx('flex h-full flex-col overflow-x-hidden min-w-fit w-full dark:bg-[#191A20]')}>
<PostHogPageView />

<NextAuthSessionProvider>
<Provider>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
disableTransitionOnChange
>
{loading && !pathname?.startsWith('/auth') ? (
<GlobalSkeleton />
) : (
<>
<AppState />
<JitsuRoot pageProps={pageProps}>{children}</JitsuRoot>
</>
)}
</ThemeProvider>
</Provider>
</NextAuthSessionProvider>
</body>
</PHProvider>
</NextIntlClientProvider>
</html>
);
};

export default LocaleLayout;
10 changes: 3 additions & 7 deletions apps/web/app/[locale]/page-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function MainPage() {
}
return (
<>
<div className="flex flex-col justify-between h-screen">
<div className="flex flex-col justify-between h-full min-h-screen">
{/* <div className="flex-grow "> */}
<MainLayout
showTimer={headerSize <= 11.8 && isTrackingEnabled}
Expand Down Expand Up @@ -119,12 +119,8 @@ function MainPage() {
<ResizableHandle withHandle />

{/* </Container> */}
<ResizablePanel
defaultSize={65}
maxSize={95}
className="!overflow-y-scroll custom-scrollbar"
>
<div>{isTeamMember ? <TeamMembers kanbanView={view} /> : <NoTeam />}</div>
<ResizablePanel defaultSize={65} maxSize={95} className="!overflow-y-auto custom-scrollbar">
{isTeamMember ? <TeamMembers kanbanView={view} /> : <NoTeam />}
</ResizablePanel>
</ResizablePanelGroup>
</div>
Expand Down
Loading
Loading