mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Fix tournament logo upload + better flow Closes #1780
This commit is contained in:
parent
a43743b780
commit
e2ea8b1a1b
|
|
@ -5,6 +5,7 @@ import { notFoundIfFalsy } from "~/utils/remix";
|
|||
import type { Unwrapped } from "~/utils/types";
|
||||
import { Tournament } from "./Tournament";
|
||||
import { getServerTournamentManager } from "./brackets-manager/manager.server";
|
||||
import { HACKY_resolvePicture } from "~/features/tournament/tournament-utils";
|
||||
|
||||
const manager = getServerTournamentManager();
|
||||
|
||||
|
|
@ -45,10 +46,13 @@ function dataMapped({
|
|||
isAdmin(user);
|
||||
const revealInfo = tournamentHasStarted || isOrganizer;
|
||||
|
||||
const defaultLogo = HACKY_resolvePicture({ name: "default" });
|
||||
|
||||
return {
|
||||
data,
|
||||
ctx: {
|
||||
...ctx,
|
||||
logoSrc: isOrganizer || ctx.logoValidatedAt ? ctx.logoSrc : defaultLogo,
|
||||
teams: ctx.teams.map((team) => {
|
||||
const isOwnTeam = team.members.some(
|
||||
(member) => member.userId === user?.id,
|
||||
|
|
|
|||
|
|
@ -35,14 +35,26 @@ export async function findById(id: number) {
|
|||
"Tournament.mapPickingStyle",
|
||||
"Tournament.rules",
|
||||
"CalendarEvent.name",
|
||||
"CalendarEvent.avatarImgId",
|
||||
"CalendarEvent.description",
|
||||
"CalendarEventDate.startTime",
|
||||
eb
|
||||
.selectFrom("UserSubmittedImage")
|
||||
.select(["UserSubmittedImage.url"])
|
||||
.whereRef("CalendarEvent.avatarImgId", "=", "UserSubmittedImage.id")
|
||||
.selectFrom("UnvalidatedUserSubmittedImage")
|
||||
.select(["UnvalidatedUserSubmittedImage.url"])
|
||||
.whereRef(
|
||||
"CalendarEvent.avatarImgId",
|
||||
"=",
|
||||
"UnvalidatedUserSubmittedImage.id",
|
||||
)
|
||||
.as("logoUrl"),
|
||||
eb
|
||||
.selectFrom("UnvalidatedUserSubmittedImage")
|
||||
.select(["UnvalidatedUserSubmittedImage.validatedAt"])
|
||||
.whereRef(
|
||||
"CalendarEvent.avatarImgId",
|
||||
"=",
|
||||
"UnvalidatedUserSubmittedImage.id",
|
||||
)
|
||||
.as("logoValidatedAt"),
|
||||
jsonObjectFrom(
|
||||
eb
|
||||
.selectFrom("User")
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ export default function TournamentRegisterPage() {
|
|||
const startsAtEvenHour = tournament.ctx.startTime.getMinutes() === 0;
|
||||
|
||||
const showAvatarPendingApprovalText =
|
||||
!tournament.ctx.logoUrl &&
|
||||
tournament.ctx.avatarImgId &&
|
||||
tournament.ctx.logoUrl &&
|
||||
!tournament.ctx.logoValidatedAt &&
|
||||
tournament.isOrganizer(user);
|
||||
|
||||
return (
|
||||
|
|
@ -127,8 +127,8 @@ export default function TournamentRegisterPage() {
|
|||
</div>
|
||||
{showAvatarPendingApprovalText ? (
|
||||
<div className="text-warning text-sm font-semi-bold">
|
||||
Tournament logo pending moderator review. Will be shown automatically
|
||||
once approved.
|
||||
Tournament logo pending moderator review. Will be shown publicly once
|
||||
approved.
|
||||
</div>
|
||||
) : null}
|
||||
<TournamentRegisterInfoTabs />
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user