Skip to content

241029 UI ux #12

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

Merged
merged 20 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e3d85b9
ロゴのみ表示するヘッダーコンポーネントを追加
Daiius Oct 29, 2024
7c46440
Next.js関連の設定を削除し、Tailwind CSSデフォルトに
Daiius Oct 29, 2024
1a2ce40
未使用フォントの削除とヘッダー追加、レイアウト微調整
Daiius Oct 29, 2024
060ec1b
src/app/layout.tsxでの背景色変更に合わせて色を修正
Daiius Oct 29, 2024
e24c9bd
視聴IDが配信開始後に更新されることをアニメーションも合わせ表記
Daiius Oct 29, 2024
27967be
不要なページ説明を削除
Daiius Oct 29, 2024
0344ebc
カスタムカラー名を追加
Daiius Oct 30, 2024
6f48844
情報表示時の枠にするPanelコンポーネントを追加
Daiius Oct 30, 2024
3543b78
Panelコンポーネントを使用したUIに変更
Daiius Oct 30, 2024
2e524c8
VidemusのVをより大きくデザイン性を向上
Daiius Oct 30, 2024
ff84d17
カスタムカラーを使用したデザインに変更
Daiius Oct 30, 2024
2af6815
新規配信ID取得ボタンの表示文字列を修正
Daiius Oct 30, 2024
4886ec6
カスタムカラーを使用するように変更
Daiius Oct 30, 2024
0b51132
Next.js開発環境ホットリロードが繰り返された際の対処
Daiius Oct 30, 2024
7ddc438
見やすさ向上のためパネルタイトル文字サイズを大きく
Daiius Oct 30, 2024
c8d6e46
カスタムカラーを一部より明るく見やすく変更
Daiius Oct 30, 2024
a4a266c
配信ページの要素を複数コンポーネントに分割
Daiius Oct 30, 2024
6908df1
Next.jsホットリロード向けの対応が再度エラーを起こしたので戻す
Daiius Oct 30, 2024
be7dde1
'poolConnection is not a constructor'の本来の原因に対処
Daiius Oct 30, 2024
e3154e6
Next.js と mysql2 の相性問題を解決しつつ依存パッケージを更新
Daiius Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},
"dependencies": {
"drizzle-orm": "0.35.3",
"mysql2": "3.11.0"
"mysql2": "3.11.3"
}
}
1 change: 1 addition & 0 deletions next/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const nextConfig = {
// ...config,
// optimization: { minimize: false },
//}),
serverExternalPackages: ['mysql2'],
};

export default nextConfig;
Expand Down
2 changes: 1 addition & 1 deletion next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"drizzle-orm": "0.35.3",
"mediasoup": "^3.14.15",
"mediasoup-client": "^3.7.17",
"mysql2": "3.11.0",
"mysql2": "3.11.3",
"next": "^15.0.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
48 changes: 32 additions & 16 deletions next/src/app/broadcast/[broadcastId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
import clsx from 'clsx';

import { notFound } from 'next/navigation';
import { getBroadcastIdStatus } from '@/lib/broadcastIds';

import { getBroadcastIdStatus } from '@/lib/broadcastIds';
import StreamIdChecker from '@/components/StreamIdChecker';

import Panel from '@/components/Panel';
import BroadcastIdPanel from '@/components/BroadcastIdPanel';
import ObsBroadcastUrlPanel from '@/components/ObsBroadcastUrlPanel';
import StreamIdPanel from '@/components/StreamIdPanel';

/**
* IDを発行した配信者用のページ
*
* ID、有効無効、配信中なら視聴用URLを表示します
*
* 有効/無効はサーバサイドで取得・表示します
* リアルタイム性が有りませんが、管理者と連絡して有効化しますから
* 再読み込みしないと表示内容が変化しない方法で良いと考えました
*
* 視聴用URLは配信状況に応じてリアルタイムに変化しますので、
* クライアントサイドでポーリングする方法をとります
*/
const BroadcasterPage: React.FC<{
params: Promise<{ broadcastId: string }>
}> = async ({ params }) => {
Expand All @@ -16,23 +34,21 @@ const BroadcasterPage: React.FC<{
}

const { isAvailable } = broadcastIdStatus;
const obsBroadcastUrl = `${process.env.HOST_URL}/api/whip/${broadcastId}`;

return (
<div>
<div>あなたの配信用ページ</div>
<div>あなたの配信用ID : {broadcastId}</div>
<div>
配信用IDの有効/無効 :
{isAvailable ? '有効' : '無効'}
</div>

<div>
<div>
OBS配信URL :
{`${process.env.HOST_URL}/api/whip/${broadcastId}`}
</div>
<StreamIdChecker broadcastId={broadcastId} />
</div>
<div className={clsx(
'flex flex-col gap-2',
'lg:px-52 md:px-12',
)}>
<BroadcastIdPanel
broadcastId={broadcastId}
isAvailable={isAvailable}
/>
<ObsBroadcastUrlPanel
obsBroadcastUrl={obsBroadcastUrl}
/>
<StreamIdPanel broadcastId={broadcastId} />
</div>
);
};
Expand Down
37 changes: 18 additions & 19 deletions next/src/app/broadcast/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@

import clsx from 'clsx';
import GetIdButton from '@/components/GetIdButton';

import Panel from '@/components/Panel';
import GetNewIdButton from '@/components/GetNewIdButton';

/**
* Broadcast setting page
*
* Videmus has several routers in its webrtc server.
* To broadcast, users should reserve a router and get its id
* from webrtc server.
*
* On successful id acquisition:
* router id is returned in its searchParams.
* shown in page to broadcast & stream.
* Failure patterns:
* 1. all routers are used
* 2. wrong search parameters are given manually
*
*/
const BroadcastPage: React.FC = () => (
<div>
<div>配信ID生成用ページ</div>
<GetNewIdButton />
<div className={clsx(
'flex flex-col gap-2 items-center',
'lg:px-52 md:px-12',
)}>
<Panel
className='w-full'
title='最初の配信準備'
>
<div>
配信IDはあなた専用です、管理者以外には教えないで下さい
</div>
<div>
その代わり、同じIDで何度でも配信できます!
</div>
<GetNewIdButton />
</Panel>
</div>
);

Expand Down
23 changes: 0 additions & 23 deletions next/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,3 @@
@tailwind components;
@tailwind utilities;

:root {
--background: #ffffff;
--foreground: #171717;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}

body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
}

@layer utilities {
.text-balance {
text-wrap: balance;
}
}
37 changes: 19 additions & 18 deletions next/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import type { Metadata } from 'next';
import './globals.css';

const geistSans = localFont({
src: "./fonts/GeistVF.woff",
variable: "--font-geist-sans",
weight: "100 900",
});
const geistMono = localFont({
src: "./fonts/GeistMonoVF.woff",
variable: "--font-geist-mono",
weight: "100 900",
});
import clsx from 'clsx';
import Header from '@/components/Header';

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: 'Videmus Broadcast',
description: '小規模・低遅延動画配信サーバ',
};


export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang='jp'>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
className={clsx(
'bg-background antialiased w-full min-h-screen',
'text-foreground',
)}
>
{children}
<Header />
<div className={clsx(
'p-2',
)}>
{children}
</div>
</body>
</html>
);
}

128 changes: 34 additions & 94 deletions next/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,101 +1,41 @@
import Image from "next/image";
import clsx from 'clsx';

import Link from 'next/link';

import Panel from '@/components/Panel';
import Button from '@/components/Button';

export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
<Image
className="dark:invert"
src="https://nextjs.org/icons/next.svg"
alt="Next.js logo"
width={180}
height={38}
priority
/>
<ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
src/app/page.tsx
</code>
.
</li>
<li>Save and see your changes instantly.</li>
</ol>

<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
className="dark:invert"
src="https://nextjs.org/icons/vercel.svg"
alt="Vercel logomark"
width={20}
height={20}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a>
<div className={clsx(
'flex flex-col gap-2',
'lg:px-52 md:px-12',
)}>
<Panel title='Videmusについて'>
<div>
小規模・低遅延の動画配信Webアプリケーションです
</div>
<div>
OBSのWHIPサービスから動画配信を行えます
</div>
</main>
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org →
</a>
</footer>
</Panel>
<div className={clsx(
'flex flex-col',
'md:grid md:grid-cols-2 gap-2'
)}>
<Panel title='配信する'>
<Link href='/broadcast'>
<Button>
新規配信ページへ
</Button>
</Link>
</Panel>
<Panel title='視聴する'>
<div>
配信者から視聴用URLを教えてもらってアクセスしましょう
</div>
</Panel>
</div>
</div>
);
}
1 change: 0 additions & 1 deletion next/src/app/stream/[streamId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const StreamPage: React.FC<{

return (
<div>
<div>ストリーミング用ページ</div>
<WebRtcVideo streamId={streamId} />
</div>
);
Expand Down
Loading