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

UI optimizations #30

Merged
merged 15 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ npm run dev

```
/ site root
/markdown for inline markdown input
/gist/username/... for gist
/github/owner/repo/... TODO: for github

/gist/owner/gist for gist URLs
/markdown for inline markdown or unknown external URL
/local for local file
/about about
/github/owner/repo/... TODO: for github repo URLs
/_player TODO: a remote-controllable player, with content and progress sync
```
11 changes: 11 additions & 0 deletions core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@ihate-work/slides-core",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
50 changes: 47 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
"description": "https://slides.ihate.work",
"scripts": {
"wrangler": "wrangler",
"dev": "npm run --workspace=web dev",
"test": "echo \"Error: no test specified\" && exit 1"
},
"engines": {
"node": "^18 || ^20"
},
"dependencies": {},
"devDependencies": {
"@types/jest": "^29",
"@types/node": "^20",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"gts": "^5.2.0",
"jest": "^29",
"ts-jest": "^29",
"typescript": "^5.4",
"wrangler": "^3.36.0"
},
Expand Down
35 changes: 0 additions & 35 deletions tsconfig.json

This file was deleted.

21 changes: 15 additions & 6 deletions web/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
preset: 'ts-jest/presets/js-with-ts',
roots: ['src', 'test'],
transformIgnorePatterns: ['<rootDir>/node_modules/.*\\.js', '<rootDir>/build/.*\\.js'],
transformIgnorePatterns: ['node_modules/.*\\.js', '<rootDir>/build/.*\\.js'],
testMatch: ['**/*\\.(spec|test)\\.(ts|js|tsx|jsx)'],
collectCoverageFrom: ['src/**/*.(ts|tsx)', '!out/', '!build/', '!**/node_modules', '!/coverage'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
Expand All @@ -11,11 +11,20 @@ module.exports = {
'<rootDir>/test/mocks/resolves-to-path.json',
'\\.(css|less|scss|sass)$': '<rootDir>/test/mocks/resolves-to-path.json',
},
globals: {
'ts-jest': {
tsconfig: {
jsx: 'react',
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
'ts-jest': {
tsconfig: {
isolatedModules: true,
jsx: 'react',
diagnostics: {
exclude: ['**'],
},
},
},
},
},
],
},
};
7 changes: 4 additions & 3 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@emotion/styled": "^11.11.0",
"@jokester/ts-commonutil": "^0.5.0",
"@mui/icons-material": "^5.15.0",
"@mui/lab": "^5.0.0-alpha.169",
"@mui/material": "^5.15.0",
"@next/eslint-plugin-next": "^14.0.4",
"@octokit/core": "^5.1.0",
Expand All @@ -50,19 +51,19 @@
"devDependencies": {
"@next/bundle-analyzer": "^14",
"@types/debug": "^4.1.12",
"@types/jest": "^29",
"@types/jest": "*",
"@types/lodash-es": "^4.17.12",
"@types/node": "*",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.17",
"@types/reveal.js": "^5.0.1",
"autoprefixer": "^10",
"gts": "*",
"jest": "^29",
"jest": "*",
"postcss": "^8.4.32",
"sass": "^1.69.5",
"tailwindcss": "^3.3.6",
"ts-jest": "^29",
"ts-jest": "*",
"typescript": "*",
"vercel": "^33.6",
"wrangler": "*"
Expand Down
8 changes: 7 additions & 1 deletion web/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import { PageContainer, PageHeader } from '../src/layouts';

export default function NotFoundPage() {
const router = useRouter();
Expand All @@ -9,5 +10,10 @@ export default function NotFoundPage() {
}, 5e3);
return () => clearTimeout(timer);
}, [router]);
return <div>Page not found. You will be redirected to site root shortly.</div>;
return (
<PageContainer>
<PageHeader />
<div>Page not found. You will be redirected to site root shortly.</div>
</PageContainer>
);
}
10 changes: 7 additions & 3 deletions web/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { DefaultMeta } from '../src/components/meta/default-meta';
import { SnackbarProvider } from 'notistack';
import Head from 'next/head';
import { useRevealPreload } from '../src/player/use-reveal-preload';
import { ThemeProvider } from '@mui/material';
import { globalTheme } from '../src/layouts/theme';

const CustomApp: React.FC<AppProps> & Partial<Pick<typeof App, 'getInitialProps'>> = (props) => {
useRevealPreload();
Expand All @@ -15,12 +17,14 @@ const CustomApp: React.FC<AppProps> & Partial<Pick<typeof App, 'getInitialProps'
<meta
key="meta-viewport"
name="viewport"
content="width=device-width, initial-scale=1,maximum-scale=1.5,minimum-scale=1"
content="width=device-width, initial-scale=1,maximum-scale=3,minimum-scale=1"
/>
</Head>
<DefaultMeta />
<SnackbarProvider />
<Component {...pageProps} />
<ThemeProvider theme={globalTheme}>
<SnackbarProvider />
<Component {...pageProps} />
</ThemeProvider>
</>
);
};
Expand Down
8 changes: 3 additions & 5 deletions web/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ const stylesheetPreloads = [
),
];

const defaultStyleSheets = [
// <link key="font-material-icons" rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons" />,
] as const;

export default function CustomDocument(): React.ReactElement {
return (
<Html>
<Head>
<link rel="preconnect" href="https://fonts.googleapis.com" crossOrigin="anonymous" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
<link
key="font-roboto"
rel="stylesheet"
href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
crossOrigin="anonymous"
/>
{stylesheetPreloads}
Expand Down