Lazy load every instance of using ant icons. Closes #2583

This commit is contained in:
Gabe Kangas
2023-01-15 22:31:36 -08:00
parent 3986fcd032
commit 6fbd6cbbcf
43 changed files with 537 additions and 91 deletions
+19 -1
View File
@@ -1,7 +1,7 @@
import { BookTwoTone, MessageTwoTone, PlaySquareTwoTone, ProfileTwoTone } from '@ant-design/icons';
import { Card, Col, Row, Typography } from 'antd';
import Link from 'next/link';
import { FC, useContext } from 'react';
import dynamic from 'next/dynamic';
import { LogTable } from './LogTable';
import { OwncastLogo } from '../common/OwncastLogo/OwncastLogo';
import { NewsFeed } from './NewsFeed';
@@ -13,6 +13,24 @@ const { Paragraph, Text } = Typography;
const { Title } = Typography;
const { Meta } = Card;
// Lazy loaded components
const BookTwoTone = dynamic(() => import('@ant-design/icons/BookTwoTone'), {
ssr: false,
});
const MessageTwoTone = dynamic(() => import('@ant-design/icons/MessageTwoTone'), {
ssr: false,
});
const PlaySquareTwoTone = dynamic(() => import('@ant-design/icons/PlaySquareTwoTone'), {
ssr: false,
});
const ProfileTwoTone = dynamic(() => import('@ant-design/icons/ProfileTwoTone'), {
ssr: false,
});
function generateStreamURL(serverURL, rtmpServerPort) {
return `rtmp://${serverURL.replace(/(^\w+:|^)\/\//, '')}:${rtmpServerPort}/live`;
}