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"; type LoaderData = { data: ApiResponse
; sites: SiteList; }; 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
); }