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, DeFi, and the Open Web"; const description = "Discover Web3.news: Your hub for community-driven FOSS news in Web3, Crypto, and DeFi. Engage in collaboration, innovation, and uphold free speech and privacy."; 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
); }