-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
2,772 additions
and
2,579 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
"use client" | ||
import { useProjectSlug } from "@/src/core/routes/usePagesDirectoryProjectSlug" | ||
import { getProxyImageSrc } from "@/src/core/utils/getProxyImageSrc" | ||
import getProject from "@/src/server/projects/queries/getProject" | ||
import { useQuery } from "@blitzjs/rpc" | ||
import { clsx } from "clsx" | ||
import Image from "next/image" | ||
// import { useProjectSlug } from "@/src/core/routes/usePagesDirectoryProjectSlug" | ||
// import { getProxyImageSrc } from "@/src/core/utils/getProxyImageSrc" | ||
// import getProject from "@/src/server/projects/queries/getProject" | ||
// import { useQuery } from "@blitzjs/rpc" | ||
// import { clsx } from "clsx" | ||
// import Image from "next/image" | ||
|
||
type Props = { className?: string } | ||
|
||
export const FooterLogos = ({ className }: Props) => { | ||
const projectSlug = useProjectSlug() | ||
const [project] = useQuery(getProject, { projectSlug }) | ||
// TEMP: Temporarily disabled https://github.com/FixMyBerlin/private-issues/issues/2155 | ||
return null | ||
|
||
const logos = project.partnerLogoSrcs?.filter(Boolean) | ||
if (!logos.length) return null | ||
// const projectSlug = useProjectSlug() | ||
// const [project] = useQuery(getProject, { projectSlug }) | ||
|
||
return ( | ||
<div className="flex"> | ||
<ul | ||
className={clsx( | ||
"mx-auto grid w-full grid-flow-row grid-cols-3 items-center justify-evenly gap-8 pb-4 sm:grid-cols-4 md:grid-cols-5", | ||
className, | ||
)} | ||
> | ||
{logos.map((partnerLogo) => ( | ||
<li className="relative mx-auto h-16 w-20" key={partnerLogo}> | ||
<Image | ||
className="mx-auto object-contain" | ||
fill | ||
src={getProxyImageSrc(partnerLogo)} | ||
alt="" | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
) | ||
// const logos = project.partnerLogoSrcs?.filter(Boolean) | ||
// if (!logos.length) return null | ||
|
||
// return ( | ||
// <div className="flex"> | ||
// <ul | ||
// className={clsx( | ||
// "mx-auto grid w-full grid-flow-row grid-cols-3 items-center justify-evenly gap-8 pb-4 sm:grid-cols-4 md:grid-cols-5", | ||
// className, | ||
// )} | ||
// > | ||
// {logos.map((partnerLogo) => ( | ||
// <li className="relative mx-auto h-16 w-20" key={partnerLogo}> | ||
// <Image | ||
// className="mx-auto object-contain" | ||
// fill | ||
// src={getProxyImageSrc(partnerLogo)} | ||
// alt="" | ||
// /> | ||
// </li> | ||
// ))} | ||
// </ul> | ||
// </div> | ||
// ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/app/admin/surveys/[surveyId]/responses/test/_components/DeleteButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
"use client" | ||
import { blueButtonStyles } from "@/src/core/components/links" | ||
import { AllowedSurveySlugs } from "@/src/survey-public/utils/allowedSurveySlugs" | ||
import deleteTestSurveyResponses from "@/src/survey-responses/mutations/deleteTestSurveyResponses" | ||
import { useMutation } from "@blitzjs/rpc" | ||
import clsx from "clsx" | ||
import { useRouter } from "next/navigation" | ||
|
||
type DeleteButtonProps = { | ||
testSurveyResponseIds: number[] | ||
surveySlug: AllowedSurveySlugs | ||
} | ||
|
||
export const DeleteButton = ({ testSurveyResponseIds, surveySlug }: DeleteButtonProps) => { | ||
const [deleteTestSurveyMutation] = useMutation(deleteTestSurveyResponses) | ||
const router = useRouter() | ||
const handleDelete = async () => { | ||
if ( | ||
window.confirm( | ||
`Diese ${testSurveyResponseIds.length} Beteiligungsbeiträge unwiderruflich löschen?`, | ||
) | ||
) { | ||
try { | ||
await deleteTestSurveyMutation({ slug: surveySlug, deleteIds: testSurveyResponseIds }) | ||
} catch (error) { | ||
alert("Beim Löschen ist ein Fehler aufgetreten.") | ||
} | ||
router.push("/admin/surveys") | ||
} | ||
} | ||
|
||
return ( | ||
<> | ||
<hr /> | ||
<button type="button" onClick={handleDelete} className={clsx(blueButtonStyles, "ml-2")}> | ||
Diese {testSurveyResponseIds.length} Testeinträge und dazugehörige Sessions löschen | ||
</button> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Breadcrumb } from "@/src/app/admin/_components/Breadcrumb" | ||
import { HeaderWrapper } from "@/src/app/admin/_components/HeaderWrapper" | ||
import { invoke } from "@/src/blitz-server" | ||
import { H2 } from "@/src/core/components/text" | ||
import getTestSurveyResponses from "@/src/survey-responses/queries/getTestSurveyResponses" | ||
import getAdminSurvey from "@/src/surveys/queries/getAdminSurvey" | ||
import { Metadata } from "next" | ||
import "server-only" | ||
import { DeleteButton } from "./_components/DeleteButton" | ||
|
||
export const metadata: Metadata = { title: "Beteiligung bearbeiten erstellen" } | ||
|
||
export default async function AdminSurveyEditPage({ | ||
params: { surveyId: surveyIdString }, | ||
}: { | ||
params: { surveyId: string } | ||
}) { | ||
const survey = await invoke(getAdminSurvey, { id: Number(surveyIdString) }) | ||
const testSurveyResponses = await invoke(getTestSurveyResponses, { | ||
slug: survey.slug, | ||
}) | ||
|
||
return ( | ||
<> | ||
<HeaderWrapper> | ||
<Breadcrumb | ||
pages={[ | ||
{ href: "/admin", name: "Dashboard" }, | ||
{ href: "/admin/surveys", name: "Beteiligungen" }, | ||
{ name: "Beteiligung: Testeinträge" }, | ||
]} | ||
/> | ||
</HeaderWrapper> | ||
<H2>Testeinträge</H2> | ||
<p className="mb-4 italic"> | ||
Dies sind alle Einträge, deren Hinweistext (ersten 20 Zeichen) 'test' enthält (plus | ||
die jeweils dazugehörige Umfrageteil) | ||
{survey.slug === "radnetz-brandenburg" && " / die Institution 'FixMyCity' ist"} | ||
</p> | ||
{!testSurveyResponses.length | ||
? "keine Testeinträge gefunden" | ||
: testSurveyResponses.map((response) => ( | ||
<pre key={response.id}>{JSON.stringify(response, undefined, 2)}</pre> | ||
))} | ||
{!!testSurveyResponses.length && ( | ||
<DeleteButton | ||
surveySlug={survey.slug} | ||
testSurveyResponseIds={testSurveyResponses.map((r) => r.id)} | ||
/> | ||
)} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.