import Feed from "@/components/Feed"; import SearchBar from "@/components/SearchBar"; import { ApiResponse, fetchFeedData } from "@/lib/feed"; import * as GraphicSection from "@/components/GraphicSection"; import { ArrowIcon } from "@/components/ArrowIcon"; import { Article } from "@/lib/prisma"; import Logo from "@/images/lume-logo-bg.png"; import { json, LoaderFunction, redirect } from "@remix-run/node"; import { useLoaderData } from "@remix-run/react"; import type { SiteList } from "@/types.js"; import { getAvailableSites } from "@/utils"; import { generateMetaTags } from "@/lib/meta.js"; import type { ServerRuntimeMetaArgs } from "@remix-run/server-runtime"; type LoaderData = { data: ApiResponse
; sites: SiteList; }; export function meta(meta: ServerRuntimeMetaArgs) { const title = "web3.news - Your Community Hub for Web3 & Blockchain News"; const description = "Explore the pulse of the Web3 and blockchain world on web3.news, a community-driven platform championing privacy, free speech, and informed collaboration. Dive into the latest in Crypto and DeFi with us."; return [ ...generateMetaTags({ title: title, description: description, parentMeta: meta, }), ]; } export let loader: LoaderFunction = async ({ request }) => { const url = new URL(request.url); const referer = request.headers.get("referer"); const queryParam = url.searchParams.get("q"); // Handle redirection based on referer and query parameters if (!referer && queryParam) { return redirect(`/search?q=${queryParam}`); } // Fetch your data here const data = await fetchFeedData({}); const sites = getAvailableSites(); // Return the fetched data as JSON return json({ data, sites }); }; export default function Index() { let { data, sites } = useLoaderData(); return ( <>

WEB3.NEWS is a project by Lume. Let’s build an open, user-owned web together.

Learn more about Lume and join our community
); }