From 7dc2a6231f9b0b6031daad569a4076aba0d2f359 Mon Sep 17 00:00:00 2001 From: Aozora Dokko <133506040+dokonosuke@users.noreply.github.com> Date: Mon, 16 Dec 2024 16:28:35 +0900 Subject: [PATCH] Delete public directory --- public/404.html | 33 -------- public/create_topic.html | 38 --------- public/css/style.css | 31 -------- public/index.html | 35 --------- public/js/app.js | 165 --------------------------------------- public/topic.html | 30 ------- 6 files changed, 332 deletions(-) delete mode 100644 public/404.html delete mode 100644 public/create_topic.html delete mode 100644 public/css/style.css delete mode 100644 public/index.html delete mode 100644 public/js/app.js delete mode 100644 public/topic.html diff --git a/public/404.html b/public/404.html deleted file mode 100644 index 829eda8..0000000 --- a/public/404.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - Page Not Found - - - - -
-

404

-

Page Not Found

-

The specified file was not found on this website. Please check the URL for mistakes and try again.

-

Why am I seeing this?

-

This page was generated by the Firebase Command-Line Interface. To modify it, edit the 404.html file in your project's configured public directory.

-
- - diff --git a/public/create_topic.html b/public/create_topic.html deleted file mode 100644 index 14fbd5b..0000000 --- a/public/create_topic.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - 掲示板 - トピック作成 - - - -

新しいトピックを作成

- -
-
- - -
-
- - -
-
-
- - -
-
- -
-
-
- トピック一覧に戻る -
- - - - - - - \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css deleted file mode 100644 index 400e056..0000000 --- a/public/css/style.css +++ /dev/null @@ -1,31 +0,0 @@ -/* 必要なスタイルを記述 */ -body { - font-family: sans-serif; -} - -h1, h2, h3 { - margin-top: 0; -} - -ul { - list-style: none; - padding: 0; -} - -li { - margin-bottom: 10px; -} - -a { - color: blue; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -textarea { - width: 100%; - height: 100px; -} \ No newline at end of file diff --git a/public/index.html b/public/index.html deleted file mode 100644 index 2f9abfe..0000000 --- a/public/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - 生命の樹 - - - - -

生命の樹

-
- - -
- - - - - - - - - diff --git a/public/js/app.js b/public/js/app.js deleted file mode 100644 index 1f4e089..0000000 --- a/public/js/app.js +++ /dev/null @@ -1,165 +0,0 @@ -// Firebase の初期化 -const firebaseConfig = { - // 自身の情報を入れる - apiKey: "AIzaSyD93jKXZVA5UKYyme1sDMrxQw0Y9WvLKAg", - authDomain: "webapp-test-9a6df.firebaseapp.com", - databaseURL: "https://webapp-test-9a6df-default-rtdb.asia-southeast1.firebasedatabase.app", - projectId: "webapp-test-9a6df", - storageBucket: "webapp-test-9a6df.appspot.com", - messagingSenderId: "738907344146", - appId: "1:738907344146:web:3d255bbbd8c8002cbf37cb" -}; -firebase.initializeApp(firebaseConfig); - -// Auth, Realtime Database のインスタンスを取得 -const auth = firebase.auth(); -const database = firebase.database(); - -// Google サインイン -const signInButton = document.getElementById('sign-in-button'); -if (signInButton) { - signInButton.addEventListener('click', () => { - const provider = new firebase.auth.GoogleAuthProvider(); - auth.signInWithPopup(provider) - .then((result) => { - // サインイン成功時の処理 - console.log('サインインしました'); - const user = result.user; - // ユーザー情報を Firebase Realtime Database に保存 - // 必要に応じて、ユーザー名などを取得して保存 - database.ref('users/' + user.uid).set({ - displayName: user.displayName, - // ... - }); - showTopicsArea(); - }) - .catch((error) => { - // サインイン失敗時の処理 - console.error(error); - // ... - }); - }); -} - - -// サインイン状態の変更を監視 -auth.onAuthStateChanged((user) => { - if (user) { - // ユーザーがサインインしている場合 - console.log('サインイン済みです'); - showTopicsArea(); - - // サインアウトボタンの処理を追加 - const signOutButton = document.getElementById('sign-out-button'); - signOutButton.addEventListener('click', () => { - auth.signOut().then(() => { - console.log('サインアウトしました'); - hideTopicsArea(); - }).catch((error) => { - console.error("サインアウトエラー:", error); - }); - }); - - } else { - // ユーザーがサインアウトしている場合 - console.log('サインアウト済みです'); - hideTopicsArea(); - } -}); - -// トピック一覧を表示する関数 -function showTopicsArea() { - document.getElementById('auth-area').style.display = 'none'; - document.getElementById('topics-area').style.display = 'block'; - fetchTopics(); -} - -// トピック一覧を非表示にする関数 -function hideTopicsArea() { - document.getElementById('auth-area').style.display = 'block'; - document.getElementById('topics-area').style.display = 'none'; -} - -// トピック一覧の取得・表示 -function fetchTopics() { - const topicsRef = database.ref('topics'); - topicsRef.on('value', (snapshot) => { - const topics = snapshot.val(); - const topicList = document.getElementById('topic-list'); - topicList.innerHTML = ''; - for (const key in topics) { - const topic = topics[key]; - const listItem = document.createElement('li'); - const topicLink = document.createElement('a'); - topicLink.href = `topic.html?id=${key}`; - topicLink.textContent = topic.title; - listItem.appendChild(topicLink); - topicList.appendChild(listItem); - } - }); -} - -// トピックの作成 -const newTopicForm = document.getElementById('new-topic-form'); -if (newTopicForm) { - newTopicForm.addEventListener('submit', (e) => { - e.preventDefault(); - const newTopicRef = database.ref('topics').push(); - newTopicRef.set({ - title: document.getElementById('topic-name').value, - description: document.getElementById('topic-description').value, - }).then(() => { - // トピック作成後、トピック一覧ページに遷移 - window.location.href = 'index.html'; - }); - }); -} - -// コメントの投稿・取得・表示 -const topicId = getQueryString('id'); -if (topicId) { - const commentsRef = database.ref(`comments/${topicId}`); - const commentList = document.getElementById('comment-list'); - - // コメントの取得と表示 - commentsRef.on('value', (snapshot) => { - const comments = snapshot.val(); - commentList.innerHTML = ''; - for (const key in comments) { - const comment = comments[key]; - const listItem = document.createElement('li'); - listItem.textContent = `${comment.displayName}: ${comment.text}`; - commentList.appendChild(listItem); - } - }); - - // コメントの投稿 - const postCommentButton = document.getElementById('post-comment'); - if (postCommentButton) { - postCommentButton.addEventListener('click', () => { - const commentText = document.getElementById('comment-text').value; - if (commentText.trim() !== '') { - const user = auth.currentUser; - commentsRef.push().set({ - text: commentText, - displayName: user.displayName, - }); - document.getElementById('comment-text').value = ''; - } - }); - } - - // トピックのタイトルと説明を表示 - const topicRef = database.ref(`topics/${topicId}`); - topicRef.once('value').then((snapshot) => { - const topic = snapshot.val(); - document.getElementById('topic-title').textContent = topic.title; - document.getElementById('topic-description').textContent = topic.description; - }); -} - -// クエリ文字列から値を取得する関数 -function getQueryString(key) { - const urlParams = new URLSearchParams(window.location.search); - return urlParams.get(key); -} \ No newline at end of file diff --git a/public/topic.html b/public/topic.html deleted file mode 100644 index d36fd32..0000000 --- a/public/topic.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - 掲示板 - <span id="topic-title"></span> - - - - トピック一覧に戻る
-

-

- -
- -
- -
-

新しいコメント

- - -
- - - - - - - \ No newline at end of file