Skip to content

Commit

Permalink
Merge pull request #1284 from thunderstore-io/01-09-enable_all_curren…
Browse files Browse the repository at this point in the history
…tuser_related_code_and_fix_package_liking

Enable all CurrentUser related code and fix package liking
  • Loading branch information
Oksamies authored Jan 15, 2025
2 parents 45a59d3 + 0e43077 commit 270072a
Show file tree
Hide file tree
Showing 54 changed files with 774 additions and 758 deletions.
12 changes: 7 additions & 5 deletions apps/cyberstorm-remix/app/c/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
NewLink,
} from "@thunderstore/cyberstorm";
import "./Community.css";
import { getDapper } from "cyberstorm/dapper/sessionUtils";
import { PackageSearch } from "~/commonComponents/PackageSearch/PackageSearch";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faBook } from "@fortawesome/free-solid-svg-icons";
Expand All @@ -16,6 +15,7 @@ import { ApiError } from "@thunderstore/thunderstore-api";
import { PackageOrderOptions } from "~/commonComponents/PackageSearch/PackageOrder";
import { faArrowUpRight } from "@fortawesome/pro-solid-svg-icons";
import { PageHeader } from "~/commonComponents/PageHeader/PageHeader";
import { DapperTs } from "@thunderstore/dapper-ts";

export const meta: MetaFunction<typeof loader> = ({ data }) => {
return [
Expand All @@ -27,7 +27,11 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => {
export async function loader({ request, params }: LoaderFunctionArgs) {
if (params.communityId) {
try {
const dapper = await getDapper();
const dapper = new DapperTs({
apiHost: process.env.PUBLIC_API_URL,
sessionId: undefined,
csrfToken: undefined,
});
const searchParams = new URL(request.url).searchParams;
const ordering =
searchParams.get("ordering") ?? PackageOrderOptions.Updated;
Expand Down Expand Up @@ -68,7 +72,6 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
if (error instanceof ApiError) {
throw new Response("Community not found", { status: 404 });
} else {
// REMIX TODO: Add sentry
throw error;
}
}
Expand All @@ -79,7 +82,7 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
export async function clientLoader({ request, params }: LoaderFunctionArgs) {
if (params.communityId) {
try {
const dapper = await getDapper(true);
const dapper = window.Dapper;
const searchParams = new URL(request.url).searchParams;
const ordering =
searchParams.get("ordering") ?? PackageOrderOptions.Updated;
Expand Down Expand Up @@ -120,7 +123,6 @@ export async function clientLoader({ request, params }: LoaderFunctionArgs) {
if (error instanceof ApiError) {
throw new Response("Community not found", { status: 404 });
} else {
// REMIX TODO: Add sentry
throw error;
}
}
Expand Down
19 changes: 7 additions & 12 deletions apps/cyberstorm-remix/app/communities/communities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
useSearchParams,
} from "@remix-run/react";
import { Communities } from "@thunderstore/dapper/types";
import { getDapper } from "cyberstorm/dapper/sessionUtils";
import { PageHeader } from "~/commonComponents/PageHeader/PageHeader";
import { DapperTs } from "@thunderstore/dapper-ts";

export const meta: MetaFunction = () => {
return [
Expand Down Expand Up @@ -69,21 +69,21 @@ export async function loader({ request }: LoaderFunctionArgs) {
const order = searchParams.get("order") ?? SortOptions.Popular;
const search = searchParams.get("search");
const page = undefined;
const dapper = await getDapper();
const dapper = new DapperTs({
apiHost: process.env.PUBLIC_API_URL,
sessionId: undefined,
csrfToken: undefined,
});
return await dapper.getCommunities(page, order ?? "", search ?? "");
// REMIX TODO: Add sentry and try except so, that we get a proper error page
// throw new Response("Community not found", { status: 404 });
}

export async function clientLoader({ request }: LoaderFunctionArgs) {
const searchParams = new URL(request.url).searchParams;
const order = searchParams.get("order") ?? SortOptions.Popular;
const search = searchParams.get("search");
const page = undefined;
const dapper = await getDapper(true);
const dapper = window.Dapper;
return await dapper.getCommunities(page, order ?? "", search ?? "");
// REMIX TODO: Add sentry and try except so, that we get a proper error page
// throw new Response("Community not found", { status: 404 });
}

export default function CommunitiesPage() {
Expand Down Expand Up @@ -129,11 +129,6 @@ export default function CommunitiesPage() {
Communities
</NewBreadCrumbs>
<PageHeader heading="Communities" headingLevel="1" headingSize="2" />
{/* <header className="nimbus-root__page-header">
<Heading csLevel="1" csSize="2" csVariant="primary" mode="display">
Communities
</Heading>
</header> */}
<main className="nimbus-root__main">
<div className={searchAndOrderStyles.root}>
<div className={searchAndOrderStyles.searchTextInput}>
Expand Down
Loading

0 comments on commit 270072a

Please sign in to comment.