Skip to content

Commit

Permalink
Merge pull request #2429 from zetkin/release-241217
Browse files Browse the repository at this point in the history
241217 Release
  • Loading branch information
richardolsson authored Dec 17, 2024
2 parents a61ec4d + 33d309a commit c353c8b
Show file tree
Hide file tree
Showing 82 changed files with 2,749 additions and 246 deletions.
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ZETKIN_APP_DOMAIN=http://www.dev.zetkin.org
ZETKIN_GEN2_ORGANIZE_URL=http://organize.dev.zetkin.org
ZETKIN_GEN2_CALL_URL=http://call.dev.zetkin.org

ZETKIN_PRIVACY_POLICY_LINK=https://zetkin.org/privacy

Expand Down
51 changes: 0 additions & 51 deletions docs/architecture/ui-model-cache.puml

This file was deleted.

5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ module.exports = {
},
async redirects() {
return [
{
source: '/my',
destination: '/my/home',
permanent: false,
},
{
source: '/:prevPath*/calendar/events',
destination: '/:prevPath*/calendar',
Expand Down
13 changes: 13 additions & 0 deletions src/app/call/[callAssId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { redirect } from 'next/navigation';

interface PageProps {
params: {
callAssId: string;
};
}

export default async function Page({ params }: PageProps) {
const callUrl = process.env.ZETKIN_GEN2_CALL_URL;
const assignmentUrl = callUrl + '/assignments/' + params.callAssId;
redirect(assignmentUrl);
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ export default async function Page({ params }: PageProps) {

return <MyCanvassAssignmentPage canvassAssId={canvassAssId} />;
} catch (err) {
return redirect(`/login?redirect=/my/canvassassignments/${canvassAssId}`);
return redirect(`/login?redirect=/canvass/${canvassAssId}`);
}
}
21 changes: 0 additions & 21 deletions src/app/my/canvassassignments/page.tsx

This file was deleted.

8 changes: 8 additions & 0 deletions src/app/my/feed/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import redirectIfLoginNeeded from 'core/utils/redirectIfLoginNeeded';
import AllEventsPage from 'features/home/pages/AllEventsPage';

export default async function Page() {
await redirectIfLoginNeeded();

return <AllEventsPage />;
}
8 changes: 8 additions & 0 deletions src/app/my/home/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import redirectIfLoginNeeded from 'core/utils/redirectIfLoginNeeded';
import HomePage from 'features/home/pages/HomePage';

export default async function Page() {
await redirectIfLoginNeeded();

return <HomePage />;
}
35 changes: 35 additions & 0 deletions src/app/my/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { FC, ReactNode } from 'react';
import { Metadata } from 'next';
import { headers } from 'next/headers';

import HomeLayout from 'features/home/layouts/HomeLayout';
import HomeThemeProvider from 'features/home/components/HomeThemeProvider';
import { getBrowserLanguage } from 'utils/locale';
import getServerMessages from 'core/i18n/server';
import messageIds from 'features/home/l10n/messageIds';

export async function generateMetadata(): Promise<Metadata> {
const lang = getBrowserLanguage(headers().get('accept-language') || '');
const messages = await getServerMessages(lang, messageIds);

return {
icons: [{ url: '/logo-zetkin.png' }],
title: process.env.HOME_TITLE || messages.title(),
};
}

type Props = {
children: ReactNode;
};

const MyHomeLayout: FC<Props> = ({ children }) => {
const homeTitle = process.env.HOME_TITLE;

return (
<HomeThemeProvider>
<HomeLayout title={homeTitle}>{children}</HomeLayout>
</HomeThemeProvider>
);
};

export default MyHomeLayout;
6 changes: 3 additions & 3 deletions src/core/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import { EventPopperProvider } from 'features/events/components/EventPopper/Even
import { MessageList } from 'utils/locale';
import { Store } from './store';
import { themeWithLocale } from '../theme';
import { UserContext } from 'utils/hooks/useFocusDate';
import { ZetkinUser } from 'utils/types/zetkin';
import { ZUIConfirmDialogProvider } from 'zui/ZUIConfirmDialogProvider';
import { ZUISnackbarProvider } from 'zui/ZUISnackbarContext';
import { UserProvider } from './env/UserContext';

type ProviderData = {
env: Environment;
Expand Down Expand Up @@ -63,7 +63,7 @@ const Providers: FC<ProvidersProps> = ({
return (
<ReduxProvider store={store}>
<EnvProvider env={env}>
<UserContext.Provider value={user}>
<UserProvider user={user}>
<StyledEngineProvider injectFirst>
<CacheProvider value={cache}>
<ThemeProvider theme={themeWithLocale(lang)}>
Expand All @@ -87,7 +87,7 @@ const Providers: FC<ProvidersProps> = ({
</ThemeProvider>
</CacheProvider>
</StyledEngineProvider>
</UserContext.Provider>
</UserProvider>
</EnvProvider>
</ReduxProvider>
);
Expand Down
25 changes: 17 additions & 8 deletions src/core/env/ClientContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
Theme,
ThemeProvider,
} from '@mui/material/styles';
import { LicenseInfo, LocalizationProvider } from '@mui/x-date-pickers-pro';
import { AdapterDayjs } from '@mui/x-date-pickers-pro/AdapterDayjs';

import BrowserApiClient from 'core/api/client/BrowserApiClient';
import Environment from 'core/env/Environment';
Expand Down Expand Up @@ -56,21 +58,28 @@ const ClientContext: FC<ClientContextProps> = ({
const env = new Environment(apiClient, envVars);
const cache = createCache({ key: 'css', prepend: true });

// MUI-X license
if (env.vars.MUIX_LICENSE_KEY) {
LicenseInfo.setLicenseKey(env.vars.MUIX_LICENSE_KEY);
}

return (
<ReduxProvider store={store}>
<StyledEngineProvider injectFirst>
<CacheProvider value={cache}>
<ThemeProvider theme={themeWithLocale(lang)}>
<EnvProvider env={env}>
<UserProvider user={user}>
<IntlProvider
defaultLocale="en"
locale={lang}
messages={messages}
>
<CssBaseline />
{children}
</IntlProvider>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<IntlProvider
defaultLocale="en"
locale={lang}
messages={messages}
>
<CssBaseline />
{children}
</IntlProvider>
</LocalizationProvider>
</UserProvider>
</EnvProvider>
</ThemeProvider>
Expand Down
2 changes: 2 additions & 0 deletions src/core/env/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type EnvVars = {
MUIX_LICENSE_KEY: string | null;
ZETKIN_APP_DOMAIN: string | null;
ZETKIN_GEN2_ORGANIZE_URL?: string | null;
ZETKIN_PRIVACY_POLICY_LINK?: string | null;
};

export default class Environment {
Expand All @@ -22,6 +23,7 @@ export default class Environment {
MUIX_LICENSE_KEY: null,
ZETKIN_APP_DOMAIN: null,
ZETKIN_GEN2_ORGANIZE_URL: null,
ZETKIN_PRIVACY_POLICY_LINK: null,
};
}

Expand Down
Loading

0 comments on commit c353c8b

Please sign in to comment.