Skip to content

Commit

Permalink
Fix chunk splitting (#351)
Browse files Browse the repository at this point in the history
* Fix chunk splitting

* Remove CommunityPage
  • Loading branch information
sonic16x authored Nov 29, 2024
1 parent eecfa82 commit 21e7bd9
Show file tree
Hide file tree
Showing 23 changed files with 534 additions and 336 deletions.
531 changes: 521 additions & 10 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interslavic",
"version": "1.24.2",
"version": "1.24.3",
"description": "Interslavic Dictionary",
"license": "MIT",
"author": {
Expand All @@ -12,7 +12,7 @@
"build-storybook": "storybook build",
"deploy-api": "wrangler deploy ./src/server/index.ts --name api --compatibility-date 2024-11-12",
"dev": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress",
"generate-dictionary": "ts-node -r tsconfig-paths/register ./src/services/generateDictionary.ts",
"generate-dictionary": "tsx -r tsconfig-paths/register ./src/services/generateDictionary.ts",
"lint": "eslint src/**/*.{ts,tsx}",
"lint:fix": "eslint src/**/*.{ts,tsx} --fix",
"stylelint": "stylelint \"**/*.scss\"",
Expand Down Expand Up @@ -101,8 +101,8 @@
"stylelint-order": "^6.0.4",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tsx": "^4.19.2",
"typescript": "^5.6.3",
"webpack": "^5.96.1",
"webpack-cli": "^5.1.4",
Expand Down
8 changes: 0 additions & 8 deletions src/actions/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export enum ActionTypes {
CHANGE_CASE_QUESTIONS = 'CHANGE_CASE_QUESTIONS',
DICTIONARY_LANGUAGES = 'DICTIONARY_LANGUAGES',
TOGGLE_PAGE = 'TOGGLE_PAGE',
SET_COMMUNITY_LINKS = 'SET_COMMUNITY_LINKS',
SET_BADGES = 'SET_BADGES',
TOGGLE_THEME = 'TOGGLE_THEME',
}
Expand Down Expand Up @@ -187,13 +186,6 @@ export function togglePage(data) {
};
}

export function setCommunityLinks(data) {
return {
type: ActionTypes.SET_COMMUNITY_LINKS,
data,
};
}

export function setBadges(data) {
return {
type: ActionTypes.SET_BADGES,
Expand Down
11 changes: 2 additions & 9 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,8 @@ export const Header =
}, [navRef, logoRef, enabledPages, onResize]);

const filteredPages = useMemo(() => (
pages
.filter(({ value }) => {
if (value === 'community' && !IS_COM) {
return false
}

return (defaultPages.includes(value) || enabledPages.includes(value))
})
), [IS_COM, pages, enabledPages])
pages.filter(({ value }) => (defaultPages.includes(value) || enabledPages.includes(value)))
), [pages, enabledPages])

const showBadges = useMemo(() => (
filteredPages.some(({ value }) => (badges.includes(value)))
Expand Down
7 changes: 0 additions & 7 deletions src/components/Main/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useEffect } from 'react';
import { useDispatch } from 'react-redux';

import { fetchCommunityLinks } from 'services/fetchCommunityLinks';
import { fetchDictionary } from 'services/fetchDictionary';

import { useCommunityLinks } from 'hooks/useCommunityLinks';
import { useDarkTheme } from 'hooks/useDarkTheme';
import { useDictionaryLanguages } from 'hooks/useDictionaryLanguages';

Expand All @@ -20,7 +18,6 @@ export const Main =
() => {
const dispatch = useDispatch();
const dictionaryLanguages = useDictionaryLanguages();
const communityLinks = useCommunityLinks();
const isDarkTheme = useDarkTheme();
const theme = isDarkTheme ? 'dark' : 'light';

Expand All @@ -29,10 +26,6 @@ export const Main =

(async () => {
await fetchDictionary(dispatch, dictionaryLanguages);

if (IS_COM) {
await fetchCommunityLinks(dispatch, communityLinks);
}
})()
}, [dispatch, dictionaryLanguages, theme]);

Expand Down
61 changes: 0 additions & 61 deletions src/components/Pages/CommunityPage/CommunityPage.scss

This file was deleted.

104 changes: 0 additions & 104 deletions src/components/Pages/CommunityPage/CommunityPage.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Pages/CommunityPage/index.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/components/Pages/Viewer/Viewer.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@import '~@ag-grid-community/core/dist/styles/ag-grid.min.css';
@import '~@ag-grid-community/core/dist/styles/ag-theme-balham.min.css';

.viewer {
position: relative;
display: flex;
Expand Down
2 changes: 0 additions & 2 deletions src/components/Pages/Viewer/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import { Button } from 'components/Button';
import { OfflinePlaceholder } from 'components/OfflinePlaceholder';
import { Spinner } from 'components/Spinner';

import '@ag-grid-community/core/dist/styles/ag-grid.css';
import '@ag-grid-community/core/dist/styles/ag-theme-balham.css';
import './Viewer.scss';

import { ViewerContextMenu } from './ViewerContextMenu';
Expand Down
9 changes: 1 addition & 8 deletions src/components/Router/Router.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lazy, Suspense,useEffect, useState } from 'react';
import { lazy, Suspense, useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';

import { setPageAction } from 'actions';
Expand All @@ -15,7 +15,6 @@ import { Settings } from 'components/Pages/Settings';
import './Router.scss';

const Grammar = lazy(() => import(/* webpackChunkName: "grammarComponent" */'components/Pages/Grammar/Grammar'));
const CommunityPage = lazy(() => import(/* webpackChunkName: "communityComponent" */'components/Pages/CommunityPage/CommunityPage'));
const Viewer = lazy(() => import(/* webpackChunkName: "viewerComponent" */'components/Pages/Viewer/Viewer'));

function renderPageContent(page: string) {
Expand All @@ -30,12 +29,6 @@ function renderPageContent(page: string) {
return (
<DictionaryPage/>
);
case 'community':
return (
<Suspense fallback={<div>&nbsp;</div>}>
<CommunityPage/>
</Suspense>
);
case 'viewer':
return (
<Suspense fallback={<div>&nbsp;</div>}>
Expand Down
8 changes: 0 additions & 8 deletions src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,6 @@ export const tablesData: ITableData[] = [
},
];

export const communityLinksTableHeader = ['link', 'text'];

export const communityLinksTable: ITableData = {
spreadsheetId: '199XwtnfJEH2U41GG1-lFjc-s7snAdKlB9_VXwHVG2ZA',
sheetId: '0',
fields: communityLinksTableHeader,
};

export const tableColumnsLetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');

export const wordErrorsTypes = [
Expand Down
7 changes: 0 additions & 7 deletions src/hooks/useCommunityLinks.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/index.html.ejs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!doctype html>
<html lang="en" style="height: 100%">
<head>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v12.0" nonce="EM9STMex"></script>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js?compat=recaptcha" async defer></script>
<script src="is_com.js"></script>
<meta charset="UTF-8">
Expand Down
12 changes: 0 additions & 12 deletions src/reducers/reducers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ export interface INotification {
type?: 'error' | 'valid';
}

export interface ICommunityLink {
link: string;
text?: string;
}

export interface IMainState {
lang: ILang;
interfaceLang: string;
Expand Down Expand Up @@ -69,7 +64,6 @@ export interface IMainState {
orderOfCases: string[];
enabledPages: string[];
badges: string[];
communityLinks: ICommunityLink[];
}

export function mainReducer(state: IMainState, { type, data }) {
Expand Down Expand Up @@ -380,12 +374,6 @@ export function mainReducer(state: IMainState, { type, data }) {
[...enabledPages, data],
};
}
case ActionTypes.SET_COMMUNITY_LINKS: {
return {
...state,
communityLinks: data,
};
}
case ActionTypes.SET_BADGES: {
return {
...state,
Expand Down
8 changes: 1 addition & 7 deletions src/routing/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ export const pages: IPage[] = [
value: 'dictionary',
path: '/',
},
{
title: 'communityTitle',
value: 'community',
path: '/community',
online: true,
},
{
title: 'grammarTitle',
value: 'grammar',
Expand All @@ -41,7 +35,7 @@ export const pages: IPage[] = [
},
];

export const defaultPages = ['dictionary', 'community', 'grammar', 'settings', 'about'];
export const defaultPages = ['dictionary', 'grammar', 'settings', 'about'];

export function goToPage(path: string) {
window.history.pushState({}, document.title, `${path}`);
Expand Down
Loading

0 comments on commit 21e7bd9

Please sign in to comment.