Skip to content

Commit 8615c86

Browse files
authored
Merge pull request #53 from raduwen/admin-page
split admin/preview page
2 parents 65f954c + 7b2ca25 commit 8615c86

File tree

8 files changed

+69
-26
lines changed

8 files changed

+69
-26
lines changed

admin/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>raduwen-obs-widget</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/pages/admin/main.tsx"></script>
12+
</body>
13+
</html>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
</head>
99
<body>
1010
<div id="root"></div>
11-
<script type="module" src="/src/main.tsx"></script>
11+
<script type="module" src="/src/pages/preview/main.tsx"></script>
1212
</body>
1313
</html>

src/components/AdminApp.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
3+
import '@/global.css';
4+
import { Index } from '@/components/admin'
5+
import { FirebaseDatabaseProvider } from '@react-firebase/database';
6+
import firebase from '@/lib/firebase';
7+
8+
const AdminApp = () => {
9+
return (
10+
<FirebaseDatabaseProvider firebase={firebase}>
11+
<Index />
12+
</FirebaseDatabaseProvider>
13+
);
14+
};
15+
16+
export { AdminApp };

src/components/App.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/components/PreviewApp.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
3+
import '@/global.css';
4+
import { Preview } from '@/components/Preview'
5+
import { FirebaseDatabaseProvider } from '@react-firebase/database';
6+
import firebase from '@/lib/firebase';
7+
8+
const PreviewApp = () => {
9+
return (
10+
<FirebaseDatabaseProvider firebase={firebase}>
11+
<Preview />
12+
</FirebaseDatabaseProvider>
13+
);
14+
};
15+
16+
export { PreviewApp };

src/main.tsx renamed to src/pages/admin/main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import React from 'react';
22
import { render } from 'react-dom';
33

44
import '@/global.css';
5-
import { App } from '@/components/App';
5+
import { AdminApp } from '@/components/AdminApp';
66

77
render(
88
<React.StrictMode>
9-
<App />
9+
<AdminApp />
1010
</React.StrictMode>,
1111
document.getElementById('root')
1212
);

src/pages/preview/main.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import { render } from 'react-dom';
3+
4+
import '@/global.css';
5+
import { PreviewApp } from '@/components/PreviewApp';
6+
7+
render(
8+
<React.StrictMode>
9+
<PreviewApp />
10+
</React.StrictMode>,
11+
document.getElementById('root')
12+
);

vite.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import { defineConfig } from 'vite';
22
import reactRefresh from '@vitejs/plugin-react-refresh';
33
import tsconfigPaths from 'vite-tsconfig-paths';
4+
import { resolve } from 'path';
45

56
// https://vitejs.dev/config/
67
export default defineConfig({
8+
build: {
9+
rollupOptions: {
10+
input: {
11+
main: resolve(__dirname, 'index.html'),
12+
admin: resolve(__dirname, 'admin/index.html'),
13+
}
14+
}
15+
},
716
plugins: [tsconfigPaths(), reactRefresh()]
817
});

0 commit comments

Comments
 (0)