diff --git a/app/[lang]/page.tsx b/app/[lang]/page.tsx
index 7e2943f..a3c7627 100644
--- a/app/[lang]/page.tsx
+++ b/app/[lang]/page.tsx
@@ -9,11 +9,10 @@ import { siteConfig } from "@/config/site"
import { AppContent } from "@/components/ui/app-content"
import { Button } from "@/components/ui/button"
import { Icons } from "@/components/icons"
-import { News } from "@/components/sections/News"
+import { NewsSection } from "@/components/sections/NewsSection"
import { WhatWeDo } from "@/components/sections/WhatWeDo"
import { useTranslation } from "../i18n/client"
-import { LocaleTypes } from "../i18n/settings"
export default function IndexPage({ params: { lang } }: any) {
const { t } = useTranslation(lang, "homepage")
@@ -53,7 +52,7 @@ export default function IndexPage({ params: { lang } }: any) {
-
+
diff --git a/app/api/news/route.ts b/app/api/news/route.ts
new file mode 100644
index 0000000..8731d42
--- /dev/null
+++ b/app/api/news/route.ts
@@ -0,0 +1,14 @@
+import { NextResponse } from "next/server"
+import { getAnnouncementChannelMessages } from "@/common/discord"
+
+export async function GET(request: Request) {
+ try {
+ const announcements = await getAnnouncementChannelMessages()
+ return NextResponse.json(
+ { announcements: announcements ?? [] },
+ { status: 200 }
+ )
+ } catch (error) {
+ return NextResponse.json({ error }, { status: 500 })
+ }
+}
diff --git a/app/i18n/locales/en/news-section.json b/app/i18n/locales/en/news-section.json
index 36df713..b8340cb 100644
--- a/app/i18n/locales/en/news-section.json
+++ b/app/i18n/locales/en/news-section.json
@@ -5,30 +5,7 @@
"watch": "Watch",
"read": "Read",
"attend": "Attend",
- "news": [
- {
- "type": "post",
- "title": "Learnings from the KZG Ceremony",
- "action": {
- "label": "Read",
- "url": "https://mirror.xyz/privacy-scaling-explorations.eth/naTdx-u7kyirczTLSAnWwH6ZdedfTQu1yCWQj1m_n-E"
- }
- },
- {
- "type": "learn",
- "title": "Public events hosted by PSE members to learn about each other's projects, share ideas, and get feedback.",
- "action": {
- "label": "See full schedule",
- "url": "https://pse-team.notion.site/50dcf22c5191485e93406a902ae9e93b?v=453023f8227646dd949abc34a7a4a138&pvs=4"
- }
- },
- {
- "type": "learn",
- "title": "Folding Circom Circuit: A ZKML Case Study by Dr. Cathie So",
- "action": {
- "label": "Watch",
- "url": "https://www.youtube.com/live/jb6HDEtY4CI"
- }
- }
- ]
+ "recentUpdates": "Recent Updates",
+ "seeAllUpdates": "See all updates",
+ "reportOnSocial": "Report on {{socialName}}"
}
\ No newline at end of file
diff --git a/app/i18n/locales/es/news-section.json b/app/i18n/locales/es/news-section.json
index 36d490c..77a99e0 100644
--- a/app/i18n/locales/es/news-section.json
+++ b/app/i18n/locales/es/news-section.json
@@ -5,30 +5,7 @@
"watch": "Ver",
"read": "Leer",
"attend": "Asistir",
- "news": [
- {
- "type": "post",
- "title": "Lecciones de la Ceremonia KZG",
- "action": {
- "label": "Leer",
- "url": "https://mirror.xyz/privacy-scaling-explorations.eth/naTdx-u7kyirczTLSAnWwH6ZdedfTQu1yCWQj1m_n-E"
- }
- },
- {
- "type": "aprendizaje",
- "title": "Eventos públicos organizados por miembros de PSE para aprender sobre los proyectos de los demás, compartir ideas y obtener retroalimentación.",
- "action": {
- "label": "Ver calendario completo",
- "url": "https://pse-team.notion.site/50dcf22c5191485e93406a902ae9e93b?v=453023f8227646dd949abc34a7a4a138&pvs=4"
- }
- },
- {
- "type": "aprendizaje",
- "title": "Circuito Circom Plegado: Un Estudio de Caso de ZKML por la Dra. Cathie So",
- "action": {
- "label": "Ver",
- "url": "https://www.youtube.com/live/jb6HDEtY4CI"
- }
- }
- ]
-}
+ "recentUpdates": "Recent Updates",
+ "seeAllUpdates": "See all updates",
+ "reportOnSocial": "Report on {{socialName}}"
+}
\ No newline at end of file
diff --git a/app/i18n/locales/it/news-section.json b/app/i18n/locales/it/news-section.json
new file mode 100644
index 0000000..4d7ead1
--- /dev/null
+++ b/app/i18n/locales/it/news-section.json
@@ -0,0 +1,11 @@
+{
+ "learnAndShare": "Impara & condividi",
+ "event": "Eventi",
+ "blogPost": "Blog",
+ "watch": "Guarda",
+ "read": "Leggi",
+ "attend": "Partecipa",
+ "recentUpdates": "Aggiornamenti recenti",
+ "seeAllUpdates": "Ultimi aggiornamenti",
+ "reportOnSocial": "Condividi su {x}"
+}
\ No newline at end of file
diff --git a/app/i18n/locales/zh-TW/news-section.json b/app/i18n/locales/zh-TW/news-section.json
index 9e56c00..3cf532c 100644
--- a/app/i18n/locales/zh-TW/news-section.json
+++ b/app/i18n/locales/zh-TW/news-section.json
@@ -5,30 +5,7 @@
"watch": "觀看",
"read": "閱讀",
"attend": "參加",
- "news": [
- {
- "type": "post",
- "title": "KZG 儀式的經驗與挑戰",
- "action": {
- "label": "閱讀",
- "url": "https://mirror.xyz/privacy-scaling-explorations.eth/naTdx-u7kyirczTLSAnWwH6ZdedfTQu1yCWQj1m_n-E"
- }
- },
- {
- "type": "learn",
- "title": "由 PSE 成員主持的公開活動,旨在了解彼此的專案,分享想法並獲得回饋。",
- "action": {
- "label": "查看完整時間表",
- "url": "https://pse-team.notion.site/50dcf22c5191485e93406a902ae9e93b?v=453023f8227646dd949abc34a7a4a138&pvs=4"
- }
- },
- {
- "type": "learn",
- "title": "Folding 的 Circom 電路:由 Cathie So 博士分享的 ZKML 案例研究",
- "action": {
- "label": "觀看",
- "url": "https://www.youtube.com/live/jb6HDEtY4CI"
- }
- }
- ]
-}
+ "recentUpdates": "Recent Updates",
+ "seeAllUpdates": "See all updates",
+ "reportOnSocial": "Report on {{socialName}}"
+}
\ No newline at end of file
diff --git a/common/discord.js b/common/discord.js
new file mode 100644
index 0000000..ca530ac
--- /dev/null
+++ b/common/discord.js
@@ -0,0 +1,34 @@
+const { Client, Routes } = require("discord.js")
+const { config } = require("dotenv")
+const { REST } = require("@discordjs/rest")
+
+config()
+
+const TOKEN = process.env.DISCORD_TOKEN
+const MESSAGES_LIMIT = 1 // Number of messages to retrieve from the discord channel
+const GUILD_ID = process.env.DISCORD_GUILD_ID
+
+const client = new Client({
+ intents: ["Guilds", "GuildMessages", "MessageContent"],
+})
+
+const rest = new REST({ version: "10" }).setToken(TOKEN)
+
+
+
+export const getAnnouncementChannelMessages = async () => {
+ console.log("Retrieve announcements from discord channel...")
+ const MESSAGES_URL = `${Routes.channelMessages(GUILD_ID)}?limit=${MESSAGES_LIMIT}`
+ // If operating on a guild channel, this endpoint requires the current user to have the VIEW_CHANNEL permission
+ const messages = await rest.get(MESSAGES_URL)
+ return messages
+}
+
+const runDiscordBot = () => {
+ client.login(TOKEN)
+ client.on("ready", async () => {
+ await getAnnouncementChannelMessages()
+ })
+}
+
+runDiscordBot()
diff --git a/components/icons.tsx b/components/icons.tsx
index 3556b94..3645d3b 100644
--- a/components/icons.tsx
+++ b/components/icons.tsx
@@ -16,8 +16,8 @@ export const Icons = {
twitter: (props: LucideProps) => (