1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

invites: ui adjustments, fix duration display > 1y

This commit is contained in:
Harvey Tindall 2023-12-24 02:29:14 +00:00
parent 9092b98b28
commit 4f5d12f800
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 82 additions and 69 deletions

View File

@ -305,7 +305,8 @@ func (app *appContext) GetInvites(gc *gin.Context) {
if inv.IsReferral { if inv.IsReferral {
continue continue
} }
_, months, days, hours, minutes, _ := timeDiff(inv.ValidTill, currentTime) years, months, days, hours, minutes, _ := timeDiff(inv.ValidTill, currentTime)
months += years * 12
invite := inviteDTO{ invite := inviteDTO{
Code: inv.Code, Code: inv.Code,
Months: months, Months: months,

View File

@ -554,48 +554,48 @@
<div class="card @low dark:~d_neutral"> <div class="card @low dark:~d_neutral">
<span class="heading">{{ .strings.create }}</span> <span class="heading">{{ .strings.create }}</span>
<div class="flex flex-col md:flex-row gap-3" id="create-inv"> <div class="flex flex-col md:flex-row gap-3" id="create-inv">
<div class="card ~neutral @low col"> <div class="card ~neutral @low flex flex-col gap-2 w-1/2">
<div class="row mb-2"> <div class="flex flex-row gap-2">
<label class="col mr-2"> <label class="w-1/2">
<input type="radio" name="duration" class="unfocused" id="radio-inv-duration" checked> <input type="radio" name="duration" class="unfocused" id="radio-inv-duration" checked>
<span class="button ~neutral @high supra full-width center">{{ .strings.inviteDuration }}</span> <span class="button ~neutral @high supra full-width center">{{ .strings.inviteDuration }}</span>
</label> </label>
<label class="col ml-2"> <label class="w-1/2">
<input type="radio" name="duration" class="unfocused" id="radio-user-expiry"> <input type="radio" name="duration" class="unfocused" id="radio-user-expiry">
<span class="button ~neutral @low supra full-width center">{{ .strings.userExpiry }}</span> <span class="button ~neutral @low supra full-width center">{{ .strings.userExpiry }}</span>
</label> </label>
</div> </div>
<div id="inv-duration"> <div id="inv-duration" class="flex flex-col gap-2">
<div class="row"> <div class="flex flex-row gap-2">
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="create-months">{{ .strings.inviteMonths }}</label> <label class="label supra" for="create-months">{{ .strings.inviteMonths }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="create-months"> <select id="create-months">
<option>0</option> <option>0</option>
</select> </select>
</div> </div>
</div> </div>
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="create-days">{{ .strings.inviteDays }}</label> <label class="label supra" for="create-days">{{ .strings.inviteDays }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="create-days"> <select id="create-days">
<option>0</option> <option>0</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="flex flex-row gap-2">
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="create-hours">{{ .strings.inviteHours }}</label> <label class="label supra" for="create-hours">{{ .strings.inviteHours }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="create-hours"> <select id="create-hours">
<option>0</option> <option>0</option>
</select> </select>
</div> </div>
</div> </div>
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="create-minutes">{{ .strings.inviteMinutes }}</label> <label class="label supra" for="create-minutes">{{ .strings.inviteMinutes }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="create-minutes"> <select id="create-minutes">
<option>0</option> <option>0</option>
</select> </select>
@ -603,44 +603,46 @@
</div> </div>
</div> </div>
</div> </div>
<div id="user-expiry" class="unfocused"> <div id="user-expiry" class="unfocused flex flex-col gap-2">
<p class="support mb-2">{{ .strings.userExpiryDescription }}</p> <div class="flex flex-row gap-2">
<div class="mb-2"> <p class="support">{{ .strings.userExpiryDescription }}</p>
<label for="create-user-expiry-enabled" class="button ~neutral @low"> <div>
<input type="checkbox" id="create-user-expiry-enabled" aria-label="User duration enabled"> <label for="create-user-expiry-enabled" class="button ~neutral @low">
<span class="ml-2">{{ .strings.enabled }} </span> <input type="checkbox" id="create-user-expiry-enabled" aria-label="User duration enabled">
</label> <span class="ml-2">{{ .strings.enabled }} </span>
</label>
</div>
</div> </div>
<div class="row"> <div class="flex flex-row gap-2">
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="user-months">{{ .strings.inviteMonths }}</label> <label class="label supra" for="user-months">{{ .strings.inviteMonths }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="user-months"> <select id="user-months">
<option>0</option> <option>0</option>
</select> </select>
</div> </div>
</div> </div>
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="user-days">{{ .strings.inviteDays }}</label> <label class="label supra" for="user-days">{{ .strings.inviteDays }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="user-days"> <select id="user-days">
<option>0</option> <option>0</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="flex flex-row gap-2">
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="user-hours">{{ .strings.inviteHours }}</label> <label class="label supra" for="user-hours">{{ .strings.inviteHours }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="user-hours"> <select id="user-hours">
<option>0</option> <option>0</option>
</select> </select>
</div> </div>
</div> </div>
<div class="col"> <div class="grow flex flex-col gap-4">
<label class="label supra" for="user-minutes">{{ .strings.inviteMinutes }}</label> <label class="label supra" for="user-minutes">{{ .strings.inviteMinutes }}</label>
<div class="select ~neutral @low mb-2 mt-4"> <div class="select ~neutral @low">
<select id="user-minutes"> <select id="user-minutes">
<option>0</option> <option>0</option>
</select> </select>
@ -648,48 +650,58 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col"> <div class="flex flex-col gap-4">
<label class="label supra" for="create-label"> {{ .strings.label }}</label> <label class="label supra" for="create-label"> {{ .strings.label }}</label>
<input type="text" id="create-label" class="input ~neutral @low mb-2 mt-4"> <input type="text" id="create-label" class="input ~neutral @low">
</div> </div>
<div class="col"> <div class="flex flex-col gap-4">
<label class="label supra" for="create-user-label"> {{ .strings.userLabel }}</label> <div>
<p class="support">{{ .strings.userLabelDescription }}</p> <label class="label supra" for="create-user-label"> {{ .strings.userLabel }}</label>
<input type="text" id="create-user-label" class="input ~neutral @low mb-2 mt-4"> <p class="support">{{ .strings.userLabelDescription }}</p>
</div>
<input type="text" id="create-user-label" class="input ~neutral @low">
</div> </div>
</div> </div>
<div class="card ~neutral @low col"> <div class="card ~neutral @low flex flex-col justify-between gap-2 w-1/2">
<label class="label supra" for="create-uses">{{ .strings.inviteNumberOfUses }}</label> <div class="flex flex-col gap-2">
<div class="flex-expand mb-2 mt-4"> <div class="flex flex-col gap-4">
<input type="number" min="0" id="create-uses" class="input ~neutral @low mr-2" value=1> <label class="label supra" for="create-uses">{{ .strings.inviteNumberOfUses }}</label>
<label for="create-inf-uses" class="button ~neutral @low" title="Set uses to infinite"> <div class="flex flex-row gap-2">
<span>&infin;</span> <input type="number" min="0" id="create-uses" class="input ~neutral @low" value=1>
<input type="checkbox" class="unfocused" id="create-inf-uses" aria-label="Set uses to infinite"> <label for="create-inf-uses" class="button ~neutral @low" title="Set uses to infinite">
</label> <span>&infin;</span>
</div> <input type="checkbox" class="unfocused" id="create-inf-uses" aria-label="Set uses to infinite">
<p class="support unfocused my-2" id="create-inf-uses-warning"><span class="badge ~critical">{{ .strings.warning }}</span> {{ .strings.inviteInfiniteUsesWarning }}</p> </label>
<label class="label supra">{{ .strings.profile }}</label> </div>
<div class="select ~neutral @low mb-2 mt-4"> </div>
<select id="create-profile"> <p class="support unfocused" id="create-inf-uses-warning"><span class="badge ~critical">{{ .strings.warning }}</span> {{ .strings.inviteInfiniteUsesWarning }}</p>
</select> <div class="flex flex-col gap-4">
</div> <label class="label supra">{{ .strings.profile }}</label>
<div id="create-send-to-container"> <div class="select ~neutral @low">
<label class="label supra">{{ .strings.inviteSendToEmail }}</label> <select id="create-profile">
<div class="flex-expand mb-2 mt-4"> </select>
{{ if .discordEnabled }} </div>
<input type="text" id="create-send-to" class="input ~neutral @low mr-2" placeholder="example@example.com | user#1234"> </div>
<span id="create-send-to-search" class="button ~neutral @low mr-2"> <div id="create-send-to-container" class="flex flex-col gap-4">
<i class="icon ri-search-2-line" title="{{ .strings.search }}"></i> <label class="label supra">{{ .strings.inviteSendToEmail }}</label>
</span> <div class="flex flex-row gap-2">
{{ else }} {{ if .discordEnabled }}
<input type="email" id="create-send-to" class="input ~neutral @low mr-2" placeholder="example@example.com"> <input type="text" id="create-send-to" class="input ~neutral @low" placeholder="example@example.com | user#1234">
{{ end }} <span id="create-send-to-search" class="button ~neutral @low">
<label for="create-send-to-enabled" class="button ~neutral @low"> <i class="icon ri-search-2-line" title="{{ .strings.search }}"></i>
<input type="checkbox" id="create-send-to-enabled" aria-label="Send to address enabled"> </span>
</label> {{ else }}
<input type="email" id="create-send-to" class="input ~neutral @low" placeholder="example@example.com">
{{ end }}
<label for="create-send-to-enabled" class="button ~neutral @low">
<input type="checkbox" id="create-send-to-enabled" aria-label="Send to address enabled">
</label>
</div>
</div> </div>
</div> </div>
<span class="button ~urge @low supra full-width center lg" id="create-submit">{{ .strings.create }}</span> <div>
<span class="button ~urge @low supra full-width center lg" id="create-submit">{{ .strings.create }}</span>
</div>
</div> </div>
</div> </div>
</div> </div>