Merge branch 'main' into feat/dtf-web
Prettier Format Check / format-check (pull_request) Canceled after 0s
Prettier Format Check / format-check (pull_request) Canceled after 0s
This commit is contained in:
@@ -27,6 +27,7 @@ Converted from CampaignCard.astro to maintain exact functionality
|
||||
key: string;
|
||||
label: string;
|
||||
kind: OwnedCardAction["kind"];
|
||||
href?: string;
|
||||
}
|
||||
|
||||
export interface OwnedCardConfig {
|
||||
@@ -227,7 +228,7 @@ Converted from CampaignCard.astro to maintain exact functionality
|
||||
{#if ownedConfig?.actions}
|
||||
<div class="flex w-full flex-col gap-4 md:flex-row">
|
||||
{#each ownedConfig.actions as action}
|
||||
<Button kind={action.kind} class="flex-1">
|
||||
<Button kind={action.kind} href={action.href} class="flex-1">
|
||||
{action.label}
|
||||
</Button>
|
||||
{/each}
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
import { t } from "../../i18n/store";
|
||||
import { apiProjectsGetCollection } from "../../openapi/client/sdk.gen.ts";
|
||||
import { toCollectionItems } from "../../utils/hydra.ts";
|
||||
import { tabStatusGroups, statusCardConfig } from "../../utils/ownedProjectCards";
|
||||
import {
|
||||
projectActionHref,
|
||||
statusCardConfig,
|
||||
tabStatusGroups,
|
||||
} from "../../utils/ownedProjectCards";
|
||||
import CampaignCard, {
|
||||
type OwnedCardActionView,
|
||||
type OwnedCardConfig,
|
||||
@@ -125,6 +129,7 @@
|
||||
key: action.key,
|
||||
label: $t(`pages.me.ownedProjects.card.${action.key}`),
|
||||
kind: action.kind,
|
||||
href: projectActionHref(action.key, campaign),
|
||||
})),
|
||||
}}
|
||||
<CampaignCard size={index === 0 ? "large" : "small"} {campaign} {ownedConfig} />
|
||||
|
||||
@@ -1985,12 +1985,12 @@
|
||||
"phone": "Telèfon",
|
||||
"remaining": "Falta per pagar",
|
||||
"btns": {
|
||||
"changeStatus": "Canviar comptes",
|
||||
"promoter": "Impulsor",
|
||||
"contributions": "Aportacions",
|
||||
"donors": "Donants de campanya",
|
||||
"financialReport": "Informe de finançament",
|
||||
"annotations": "Anotacions"
|
||||
"annotations": "Anotacions",
|
||||
"promoter": "Impulsor",
|
||||
"campaignPage": "Veure la pàgina de la campanya",
|
||||
"preview": "Previsualitzar",
|
||||
"edit": "Editar projecte"
|
||||
}
|
||||
},
|
||||
"noData": "No hi ha dades disponibles"
|
||||
|
||||
@@ -1986,12 +1986,12 @@
|
||||
"phone": "Phone",
|
||||
"remaining": "Pending payment",
|
||||
"btns": {
|
||||
"changeStatus": "Change accounts",
|
||||
"promoter": "Promoter",
|
||||
"contributions": "Contributions",
|
||||
"donors": "Campaign donors",
|
||||
"financialReport": "Funding report",
|
||||
"annotations": "Annotations"
|
||||
"annotations": "Annotations",
|
||||
"promoter": "Promoter",
|
||||
"campaignPage": "View campaign page",
|
||||
"preview": "Preview",
|
||||
"edit": "Edit project"
|
||||
}
|
||||
},
|
||||
"noData": "No data available"
|
||||
|
||||
@@ -36,6 +36,31 @@ export interface OwnedCardAction {
|
||||
kind: "primary" | "secondary" | "ghost";
|
||||
}
|
||||
|
||||
export function projectActionHref(
|
||||
actionKey: string,
|
||||
project: Pick<Project, "id" | "slug">,
|
||||
): string {
|
||||
const idOrSlug = project.slug ?? project.id;
|
||||
|
||||
if (idOrSlug === undefined || idOrSlug === null || idOrSlug === "") {
|
||||
return "#";
|
||||
}
|
||||
|
||||
switch (actionKey) {
|
||||
case "actions.edit":
|
||||
return `/project/${idOrSlug}/edit`;
|
||||
case "actions.manage":
|
||||
return `/project/${idOrSlug}/manage`;
|
||||
case "actions.publish":
|
||||
return `/project/${idOrSlug}/manage`;
|
||||
case "actions.view":
|
||||
case "actions.viewReview":
|
||||
return `/project/${idOrSlug}`;
|
||||
default:
|
||||
return `/project/${idOrSlug}`;
|
||||
}
|
||||
}
|
||||
|
||||
type StatusCards = Record<
|
||||
ProjectStatus,
|
||||
{ tagKey?: string; showMoney: boolean; actions: OwnedCardAction[] }
|
||||
|
||||
Reference in New Issue
Block a user