From 7ec93a8139d7933e35e78de3a428d52d709d1132 Mon Sep 17 00:00:00 2001 From: yuhao Date: Fri, 17 May 2024 11:27:25 -0400 Subject: [PATCH 1/7] Added a step here to save the result, and GITHUB_TOKEN. Signed-off-by: yuhao Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- .github/workflows/transcripts-extraction.yml | 10 +++++++++- .github/workflows/transcripts-summarization.yml | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transcripts-extraction.yml b/.github/workflows/transcripts-extraction.yml index a25f2fe..f813d3a 100644 --- a/.github/workflows/transcripts-extraction.yml +++ b/.github/workflows/transcripts-extraction.yml @@ -28,10 +28,18 @@ jobs: run: | python cncf-youtube-channel-summarizer/extract_youtube_videos_info.py + - name: Upload transcript + uses: actions/upload-artifact@v4 + with: + name: CNCF_video_information.json + path: cncf-youtube-channel-summarizer/data/CNCF_video_information.json + - name: Commit Change for "CNCF_video_information.json" run: | git config --global user.name 'Yuhao Chen' git config --global user.email 'yuhao.chenyh@gmail.com' git add cncf-youtube-channel-summarizer/data/CNCF_video_information.json || exit 0 git commit -m "Add Video Information" --signoff || exit 0 - git push \ No newline at end of file + git push + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/.github/workflows/transcripts-summarization.yml b/.github/workflows/transcripts-summarization.yml index 3e5dc9f..63107d1 100644 --- a/.github/workflows/transcripts-summarization.yml +++ b/.github/workflows/transcripts-summarization.yml @@ -29,6 +29,12 @@ jobs: run: | python cncf-youtube-channel-summarizer/transcript_summarizer.py + - name: Upload transcript + uses: actions/upload-artifact@v4 + with: + name: CNCF_video_information.json + path: cncf-youtube-channel-summarizer/data/cncf_video_summary.json + - name: Commit Change for "cncf_video_summary.csv" run: | git config --global user.name 'Yuhao Chen' @@ -36,6 +42,8 @@ jobs: git add cncf-youtube-channel-summarizer/data/cncf_video_summary.csv || exit 0 git commit -m "Add Summaries and Keywords" --signoff || exit 0 git push + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Commit Change for "missed_video_id.txt" run: | @@ -44,3 +52,6 @@ jobs: git add cncf-youtube-channel-summarizer/data/missed_video_id.txt || exit 0 git commit -m "Add missed_video_id" --signoff || exit 0 git push + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + From 887314a64b3efb69bee85eb9efe0b8ceaba54d82 Mon Sep 17 00:00:00 2001 From: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Date: Fri, 17 May 2024 12:23:43 -0400 Subject: [PATCH 2/7] Update transcripts-extraction.yml Add premissions Signed-off-by: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- .github/workflows/transcripts-extraction.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/transcripts-extraction.yml b/.github/workflows/transcripts-extraction.yml index f813d3a..063dc56 100644 --- a/.github/workflows/transcripts-extraction.yml +++ b/.github/workflows/transcripts-extraction.yml @@ -5,6 +5,11 @@ env: on: workflow_dispatch: +permissions: + pull-requests: write + contents: write + repository-projects: write + packages: write jobs: run-script: @@ -42,4 +47,4 @@ jobs: git commit -m "Add Video Information" --signoff || exit 0 git push env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} From 8bcc5b87fb2252536828eabc7404cc1c5f3bf0c0 Mon Sep 17 00:00:00 2001 From: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Date: Fri, 17 May 2024 12:24:05 -0400 Subject: [PATCH 3/7] Update transcripts-summarization.yml Add premissions Signed-off-by: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- .github/workflows/transcripts-summarization.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/transcripts-summarization.yml b/.github/workflows/transcripts-summarization.yml index 63107d1..17298c0 100644 --- a/.github/workflows/transcripts-summarization.yml +++ b/.github/workflows/transcripts-summarization.yml @@ -6,6 +6,11 @@ env: on: workflow_dispatch: +permissions: + pull-requests: write + contents: write + repository-projects: write + packages: write jobs: run-script: From 3f7fcd3f5d9c57d400a10f2917b8e0e657e582c7 Mon Sep 17 00:00:00 2001 From: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Date: Fri, 17 May 2024 17:17:39 -0400 Subject: [PATCH 4/7] Update transcripts-extraction.yml Signed-off-by: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- .github/workflows/transcripts-extraction.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/transcripts-extraction.yml b/.github/workflows/transcripts-extraction.yml index 063dc56..0682d08 100644 --- a/.github/workflows/transcripts-extraction.yml +++ b/.github/workflows/transcripts-extraction.yml @@ -41,8 +41,8 @@ jobs: - name: Commit Change for "CNCF_video_information.json" run: | - git config --global user.name 'Yuhao Chen' - git config --global user.email 'yuhao.chenyh@gmail.com' + git config --global user.email "dependabot[bot]@users.noreply.github.com" + git config --global user.name "dependabot[bot]" git add cncf-youtube-channel-summarizer/data/CNCF_video_information.json || exit 0 git commit -m "Add Video Information" --signoff || exit 0 git push From 473d25c36e3b5ace4f3d0333b2f9dd27baaa7e24 Mon Sep 17 00:00:00 2001 From: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Date: Fri, 17 May 2024 17:18:09 -0400 Subject: [PATCH 5/7] Update transcripts-summarization.yml Signed-off-by: Yuhao Chen <34019138+nbcstevenchen@users.noreply.github.com> Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- .github/workflows/transcripts-summarization.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/transcripts-summarization.yml b/.github/workflows/transcripts-summarization.yml index 17298c0..5df1a57 100644 --- a/.github/workflows/transcripts-summarization.yml +++ b/.github/workflows/transcripts-summarization.yml @@ -42,8 +42,8 @@ jobs: - name: Commit Change for "cncf_video_summary.csv" run: | - git config --global user.name 'Yuhao Chen' - git config --global user.email 'yuhao.chenyh@gmail.com' + git config --global user.email "dependabot[bot]@users.noreply.github.com" + git config --global user.name "dependabot[bot]" git add cncf-youtube-channel-summarizer/data/cncf_video_summary.csv || exit 0 git commit -m "Add Summaries and Keywords" --signoff || exit 0 git push @@ -52,8 +52,8 @@ jobs: - name: Commit Change for "missed_video_id.txt" run: | - git config --global user.name 'Yuhao Chen' - git config --global user.email 'yuhao.chenyh@gmail.com' + git config --global user.email "dependabot[bot]@users.noreply.github.com" + git config --global user.name "dependabot[bot]" git add cncf-youtube-channel-summarizer/data/missed_video_id.txt || exit 0 git commit -m "Add missed_video_id" --signoff || exit 0 git push From 4a605491ba87108c03bf4ba71289213522d589e2 Mon Sep 17 00:00:00 2001 From: ShangenC <54390035+LoveYourself999@users.noreply.github.com> Date: Thu, 30 May 2024 12:49:33 -0400 Subject: [PATCH 6/7] Adding video summaries for each conferences Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- src/component/Layout.js | 16 +++++ src/component/Navbar.js | 18 ++++++ src/component/Sidebar.js | 111 +++++++++++++++++++++++++++++++++ src/pages/_app.js | 9 ++- src/pages/conferences/[id].js | 82 ++++++++++++++++++++++++ src/pages/conferences/index.js | 13 ++++ src/pages/index.js | 8 +-- src/styles/globals.css | 25 ++++++++ 8 files changed, 274 insertions(+), 8 deletions(-) create mode 100644 src/component/Layout.js create mode 100644 src/component/Navbar.js create mode 100644 src/component/Sidebar.js create mode 100644 src/pages/conferences/[id].js create mode 100644 src/pages/conferences/index.js diff --git a/src/component/Layout.js b/src/component/Layout.js new file mode 100644 index 0000000..32db2a1 --- /dev/null +++ b/src/component/Layout.js @@ -0,0 +1,16 @@ +import Navbar from "./Navbar"; +import Sidebar from "./Sidebar"; + +const Layout = ({ children }) => { + return( +
+ +
+ + {children} +
+
+ ) +} + +export default Layout; \ No newline at end of file diff --git a/src/component/Navbar.js b/src/component/Navbar.js new file mode 100644 index 0000000..cab9db6 --- /dev/null +++ b/src/component/Navbar.js @@ -0,0 +1,18 @@ +const Navbar = () => { + return ( + <> + + + ); +}; + +export default Navbar; \ No newline at end of file diff --git a/src/component/Sidebar.js b/src/component/Sidebar.js new file mode 100644 index 0000000..69dd10e --- /dev/null +++ b/src/component/Sidebar.js @@ -0,0 +1,111 @@ +import React, { useState } from 'react'; +import Papa from 'papaparse';// Make sure to install papaparse with command 'npm install papaparse' +import { useRouter } from 'next/router'; +import Link from 'next/link'; + +const Sidebar = () => { + const router = useRouter(); + // State to track the selected button, conference data, and dropdown visibility + const [selectedButton, setSelectedButton] = useState(null); + const [conferences, setConferences] = useState([]); + const [selectedDropDownButton, setSelectedDropDownButton] = useState(null); + const [dropdownVisible, setDropdownVisible] = useState(false); + + // Function to handle button click and update selectedButton state + const handleButtonClick = (buttonName) => { + setSelectedButton(buttonName); + router.push('/'); + if (buttonName === 'conference') { + // Toggle dropdown visibility + setDropdownVisible(!dropdownVisible); + // If "Conference" button is clicked, fetch and set conference data + if (!dropdownVisible) { + fetchConferences(); + } + } else { + // Hide dropdown if another button is clicked + setDropdownVisible(false); + } + }; + + // Function to fetch conference data from CSV file +// Function to fetch conference data from CSV file +const fetchConferences = () => { + // Replace the URL with the correct path to your CSV file + fetch('https://raw.githubusercontent.com/cncf-tags/cloud-native-ai/main/cncf-youtube-channel-summarizer/data/cncf_video_summary_29.csv') + .then((response) => { + if (!response.ok) { + throw new Error('Network response was not ok'); + } + return response.text(); + }) + .then((text) => { + // Parse CSV data using PapaParse and extract 'video_id' and 'conference_name' columns + Papa.parse(text, { + header: true, + skipEmptyLines: true, + complete: (result) => { + const uniqueConferences = new Set(); + const conferencesData = result.data.reduce((acc, row) => { + const name = row['conference_name'].trim(); + const videoId = row['video_id'].trim(); + if (!uniqueConferences.has(name)) { + uniqueConferences.add(name); + acc.push({ video_id: videoId, conference_name: name }); + } + return acc; + }, []); + setConferences(conferencesData); + }, + }); + }) + .catch((error) => { + console.error('Error fetching conference data:', error); + }); +}; + + // Function to handle click on dropdown button + const handleDropdownButtonClick = (name) => { + // Navigate to the new page when dropdown button is clicked + setSelectedDropDownButton(name); + }; + + return ( + <> + + + ); +}; + +export default Sidebar; diff --git a/src/pages/_app.js b/src/pages/_app.js index b97e52f..e39830b 100644 --- a/src/pages/_app.js +++ b/src/pages/_app.js @@ -1,5 +1,10 @@ import "@/styles/globals.css"; +import Layout from '../component/Layout'; export default function App({ Component, pageProps }) { - return ; -} + return ( + + + + ) +} \ No newline at end of file diff --git a/src/pages/conferences/[id].js b/src/pages/conferences/[id].js new file mode 100644 index 0000000..879c07e --- /dev/null +++ b/src/pages/conferences/[id].js @@ -0,0 +1,82 @@ +// pages/conferences/[conference_name].js + +import { useRouter } from 'next/router'; +import Papa from 'papaparse'; + +export default function Conference({ conferences, allVideos }) { + const router = useRouter(); + + if (router.isFallback) { + return
Loading...
; + } + + const sameConferences = allVideos.filter((video) => video.conference_name === conferences[0].conference_name); + + return ( +
+

{conferences[0].conference_name}

+ {sameConferences.map((conference, index) => ( +
+

Video ID: {conference.video_id}

+

Video Summary: {conference.summary}

+

-------------------------

+
+ ))} +
+ ); +} + +export async function getStaticPaths() { + try { + const response = await fetch('https://raw.githubusercontent.com/cncf-tags/cloud-native-ai/main/cncf-youtube-channel-summarizer/data/cncf_video_summary_29.csv'); + if (!response.ok) { + throw new Error('Failed to fetch CSV'); + } + const csvText = await response.text(); + const { data: videos } = Papa.parse(csvText, { header: true }); + + const paths = videos.map((video) => ({ + params: { id: video.video_id }, + })); + + return { + paths, + fallback: false, // or 'blocking' or true + }; + } catch (error) { + console.error('Error fetching or parsing CSV:', error); + return { + paths: [], + fallback: false, // or 'blocking' or true + }; + } +} + +export async function getStaticProps({ params }) { + try { + const response = await fetch('https://raw.githubusercontent.com/cncf-tags/cloud-native-ai/main/cncf-youtube-channel-summarizer/data/cncf_video_summary_29.csv'); + if (!response.ok) { + throw new Error('Failed to fetch CSV'); + } + const csvText = await response.text(); + const { data: videos } = Papa.parse(csvText, { header: true }); + const conferences = videos.filter((video) => video.video_id === params.id); + if (conferences.length === 0) { + return { + notFound: true, + }; + } + + return { + props: { + conferences, + allVideos: videos, + }, + }; + } catch (error) { + console.error('Error fetching or parsing CSV:', error); + return { + notFound: true, + }; + } +} diff --git a/src/pages/conferences/index.js b/src/pages/conferences/index.js new file mode 100644 index 0000000..50dfadc --- /dev/null +++ b/src/pages/conferences/index.js @@ -0,0 +1,13 @@ +import React from 'react'; + +const conferences = () => { + + return ( +
+

This is the home page for all conferences

+ {} +
+ ); +}; + +export default conferences; \ No newline at end of file diff --git a/src/pages/index.js b/src/pages/index.js index 051b1a4..f93f348 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -1,21 +1,17 @@ -import Sidebar from './Sidebar' -import Navbar from './Navbar' import { useEffect, useState } from 'react'; import ForceGraph from './force-graph'; const Home = () => { const [data, setData] = useState(''); useEffect(() => { // Fetch the CSV data from the server - fetch('https://raw.githubusercontent.com/cncf-tags/cloud-native-ai/main/cncf-youtube-channel-summarizer/data/sample_cncf_video_summary.csv') + fetch('https://raw.githubusercontent.com/cncf-tags/cloud-native-ai/main/cncf-youtube-channel-summarizer/data/cncf_video_summary_29.csv') .then((response) => response.text()) .then((csvData) => setData(csvData)); }, []); return ( -
{/* Changed background color to light gray */} - +
- {data && }
diff --git a/src/styles/globals.css b/src/styles/globals.css index 9a75051..953a173 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -26,6 +26,31 @@ body { rgb(var(--background-start-rgb)); } +.container { + max-width: 800px; + margin: 0 auto; + padding: 20px; + background-color: #ffffff; + border-radius: 10px; + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); +} + +h1 { + color: #333; + font-size: 2.5em; + margin-bottom: 10px; +} + +p { + color: #666; + font-size: 1.2em; + line-height: 1.6; +} + +p strong { + color: #000; +} + @layer utilities { .text-balance { text-wrap: balance; From dcc2e69005ae4f0d5d610d2a547856ec56d36c4e Mon Sep 17 00:00:00 2001 From: ShangenC <54390035+LoveYourself999@users.noreply.github.com> Date: Thu, 30 May 2024 13:22:37 -0400 Subject: [PATCH 7/7] updates Signed-off-by: ShangenC <54390035+LoveYourself999@users.noreply.github.com> --- src/component/Sidebar.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/component/Sidebar.js b/src/component/Sidebar.js index 69dd10e..106aa16 100644 --- a/src/component/Sidebar.js +++ b/src/component/Sidebar.js @@ -1,5 +1,5 @@ import React, { useState } from 'react'; -import Papa from 'papaparse';// Make sure to install papaparse with command 'npm install papaparse' +import Papa from 'papaparse'; import { useRouter } from 'next/router'; import Link from 'next/link'; @@ -28,10 +28,8 @@ const Sidebar = () => { } }; - // Function to fetch conference data from CSV file // Function to fetch conference data from CSV file const fetchConferences = () => { - // Replace the URL with the correct path to your CSV file fetch('https://raw.githubusercontent.com/cncf-tags/cloud-native-ai/main/cncf-youtube-channel-summarizer/data/cncf_video_summary_29.csv') .then((response) => { if (!response.ok) { @@ -66,7 +64,6 @@ const fetchConferences = () => { // Function to handle click on dropdown button const handleDropdownButtonClick = (name) => { - // Navigate to the new page when dropdown button is clicked setSelectedDropDownButton(name); };