MarioKartCentral / MarioKartCentral

A monorepo that holds all of Mario Kart Central's open-source projects
MIT License
12 stars 1 forks source link

Finish tournament registration functionality #122

Closed cyndaquilx closed 10 months ago

cyndaquilx commented 10 months ago

Merry Christmas!!

This PR adds tournament registration functionality to the site.

On a tournament page, there is now a Register section. If you're not registered, you'll see this on a solo tournament: image

Upon registering, the register section will be updated to include your registration details: image

If you want to edit your registration, you can click the Edit button under Actions which opens this dialog box: image

If you want to unregister, you can click the Unregister button and you'll be greeted with this confirmation box before unregistering: image

Here's the registration screen for a squad tournament: image

Once you've registered as a squad, you'll see this in the register panel: image

In the invite players box, you can either search for a player by their name: image

Or their friend code: image

To accomplish this I added a name_or_fc param to the player search endpoint. I changed some of the search backend code to be a little faster in the process. I also added another search option which I'll go into later in the post.

Here's what it looks like when you have a player invited: image

You can click the "Cancel Invitation" button to cancel an invite after a confirmation dialog.

If you've been invited to a squad tournament, you'll see all your invites to that tournament along with the option to just create your own squad: image

If you click the Accept button, you'll be given a dialog box to enter your details before accepting: image

If you're the captain of a squad, you'll have 2 actions you can perform on players in your squad; you can either kick them or transfer your captain permissions to them (you'll no longer be captain in this case). image

If you try unregistering yourself (not your squad) from a tournament and you're the captain, you'll get this dialog box when trying to unregister: image

Clicking the Edit Squad button opens this dialog box: image

Clicking the Unregister Squad button will give a confirmation dialog and remove your squad from the tournament if accepted: image

I also added some filters to the tournament registrations list: image

The default view is displaying all squads, whether eligible or not. However, there are three options; All Squads, Eligible Only, Hosts Only. (Eligible only is limited to squad tournaments since all solo registrations are eligible, and hosts only is only for tournaments where the host status is required for registration).

If we change it to Eligible Only, we can see that only squads with the minimum player count (2 in this case) are displayed: image

If the filter is Hosts Only, only squads with at least 1 host are displayed: image

Team tournaments use a completely different interface for registration (although in the backend they are basically the same as regular squads, just with team roster IDs linked to them).

Under the register panel, you'll be able to select from a list of teams that you have permissions to register for tournaments: image

You can mix and match any rosters that you have registration permissions for, adding as many secondary rosters to your main registration as you want.

Once you've selected a roster, it's added to the Selected Rosters list and removed from the selection box. You can remove a roster by clicking the X button next to it, this will also add it back to the selection box. image

If you are a member of any of the rosters you've selected, you will automatically be made captain of your squad. Otherwise, you will have to select a member from the registered players of your teams: image

If the tournament requires more than 1 representative, you'll have to select more representatives from the member list of your rosters. In this example the tournament requires 2 representatives, so the register button appears after selecting an additional representative: image

After registering, all players from the selected rosters (who are not already registered for a different squad in the tournament) are automatically added to the tournament.

To register rosters you have registration permissions for separately, you can just create a 2nd squad with any rosters you haven't registered yet at the bottom of the Register panel after completing your first registration: image

As a replacement for opt-outs (used in team tournaments like MKU or Frontier), you can now just unregister yourself from your team's squad for a tournament by clicking the Unregister button next to your name. You can also kick players from your squad as the captain in team tournaments if they can't opt themselves out.

If you want to invite a player back to your squad, you can use the same Invite Players search box as regular squad tournaments. However, if a tournament has the team members only setting on, this search box will only return members that are registered for one of the rosters linked to this squad! image

Once this PR is merged all of the basic functionality is there to theoretically run tournaments on this site. Obviously there is still a long way to go before we're ready for release but this is a good milestone!

VikeMK commented 10 months ago

Given it a look over and everything seems pretty good, I am going to merge this and if there's anything I notice I'll fix it. Want to get this merged so I can upgrade us to Svelte 4 to use that components library you were talking about.