fix: Navbar on mobile

Signed-off-by: Ben Hall <ben@benh.codes>
This commit is contained in:
Ben Hall 2025-02-18 20:00:52 +00:00
parent 1ddb9b80f1
commit 97492174a6
3 changed files with 19 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"strconv"
"time" "time"
database2 "github.com/TicketsBot-cloud/database" database2 "github.com/TicketsBot-cloud/database"
@ -38,6 +39,19 @@ import (
func PresignTranscriptURL(ctx *gin.Context) { func PresignTranscriptURL(ctx *gin.Context) {
guildId, userId := ctx.Keys["guildid"].(uint64), ctx.Keys["userid"].(uint64) guildId, userId := ctx.Keys["guildid"].(uint64), ctx.Keys["userid"].(uint64)
// Get "file_size" query parameter
fileSize, err := strconv.ParseInt(ctx.Query("file_size"), 10, 64)
if err != nil {
ctx.JSON(400, utils.ErrorJson(err))
return
}
// Check if file is over 1GB
if fileSize > 1024*1024*1024 {
ctx.JSON(400, utils.ErrorStr("File size too large"))
return
}
botCtx, err := botcontext.ContextForGuild(guildId) botCtx, err := botcontext.ContextForGuild(guildId)
if err != nil { if err != nil {
ctx.JSON(500, utils.ErrorJson(err)) ctx.JSON(500, utils.ErrorJson(err))

View File

@ -20,6 +20,7 @@
<NavElement icon="fas fa-poll-h" link="/manage/{guildId}/forms" on:click={closeDropdown}>Forms</NavElement> <NavElement icon="fas fa-poll-h" link="/manage/{guildId}/forms" on:click={closeDropdown}>Forms</NavElement>
<NavElement icon="fas fa-users" link="/manage/{guildId}/teams" on:click={closeDropdown}>Staff Teams</NavElement> <NavElement icon="fas fa-users" link="/manage/{guildId}/teams" on:click={closeDropdown}>Staff Teams</NavElement>
<NavElement icon="fas fa-robot" link="/manage/{guildId}/integrations" on:click={closeDropdown}>Integrations</NavElement> <NavElement icon="fas fa-robot" link="/manage/{guildId}/integrations" on:click={closeDropdown}>Integrations</NavElement>
<NavElement icon="fas fa-file-import" link="/manage/{guildId}/import" on:click={closeDropdown}>Import</NavElement>
{/if} {/if}
<NavElement icon="fas fa-ticket-alt" link="/manage/{guildId}/tickets" on:click={closeDropdown}>Tickets</NavElement> <NavElement icon="fas fa-ticket-alt" link="/manage/{guildId}/tickets" on:click={closeDropdown}>Tickets</NavElement>

View File

@ -164,13 +164,13 @@
if (queryLoading) { if (queryLoading) {
notify( notify(
"Importing...", "Importing...",
"Your data is taking longer than expected to import, you can safely navigate away from this page and check back later.", "Your data is taking longer than expected to import, if you uploaded transcripts, please wait until you get an import successful message before navigating away from this page.",
); );
} }
}, 60 * 1000); }, 60 * 1000);
if (transcriptFileInput.files.length > 0) { if (transcriptFileInput.files.length > 0) {
const presignRes = await axios.get(`${API_URL}/api/${guildId}/import/presign`); const presignRes = await axios.get(`${API_URL}/api/${guildId}/import/presign?file_size=${transcriptFileInput.files[0].size}`);
if (presignRes.status !== 200) { if (presignRes.status !== 200) {
notifyError(`Failed to upload transcripts: ${presignRes.data.error}`); notifyError(`Failed to upload transcripts: ${presignRes.data.error}`);
queryLoading = false; queryLoading = false;
@ -189,6 +189,8 @@
queryLoading = false; queryLoading = false;
return; return;
} }
notifySuccess("Transcripts uploaded successfully");
}); });
} }