Merge pull request #69 from fossyy/staging

feat: implement file renaming
This commit is contained in:
2024-09-17 12:35:05 +07:00
committed by GitHub
10 changed files with 461 additions and 189 deletions

View File

@ -243,6 +243,17 @@ func (db *mySQLdb) GetFile(fileID string) (*models.File, error) {
return &file, nil return &file, nil
} }
func (db *mySQLdb) RenameFile(fileID string, name string) (*models.File, error) {
var file models.File
err := db.DB.Table("files").Where("id = ?", fileID).First(&file).Error
file.Name = name
err = db.DB.Save(&file).Error
if err != nil {
return &file, err
}
return &file, nil
}
func (db *mySQLdb) DeleteFile(fileID string) error { func (db *mySQLdb) DeleteFile(fileID string) error {
err := db.DB.Table("files").Where("id = ?", fileID).Delete(&models.File{}).Error err := db.DB.Table("files").Where("id = ?", fileID).Delete(&models.File{}).Error
if err != nil { if err != nil {
@ -411,6 +422,17 @@ func (db *postgresDB) GetFile(fileID string) (*models.File, error) {
return &file, nil return &file, nil
} }
func (db *postgresDB) RenameFile(fileID string, name string) (*models.File, error) {
var file models.File
err := db.DB.Table("files").Where("id = $1", fileID).First(&file).Error
file.Name = name
err = db.DB.Save(&file).Error
if err != nil {
return &file, err
}
return &file, nil
}
func (db *postgresDB) DeleteFile(fileID string) error { func (db *postgresDB) DeleteFile(fileID string) error {
err := db.DB.Table("files").Where("id = $1", fileID).Delete(&models.File{}).Error err := db.DB.Table("files").Where("id = $1", fileID).Delete(&models.File{}).Error
if err != nil { if err != nil {

View File

@ -93,7 +93,7 @@ func sendFileChunk(w http.ResponseWriter, saveFolder string, file *models.File,
endOffset := end % chunkSize endOffset := end % chunkSize
for i := startChunk; i <= endChunk; i++ { for i := startChunk; i <= endChunk; i++ {
chunkPath := filepath.Join(saveFolder, file.Name, fmt.Sprintf("chunk_%d", i)) chunkPath := filepath.Join(saveFolder, fmt.Sprintf("chunk_%d", i))
chunkFile, err := os.Open(chunkPath) chunkFile, err := os.Open(chunkPath)
if err != nil { if err != nil {
http.Error(w, fmt.Sprintf("Error opening chunk: %v", err), http.StatusInternalServerError) http.Error(w, fmt.Sprintf("Error opening chunk: %v", err), http.StatusInternalServerError)

View File

@ -23,7 +23,7 @@ func GET(w http.ResponseWriter, r *http.Request) {
var filesData []types.FileData var filesData []types.FileData
for _, file := range files { for _, file := range files {
saveFolder := filepath.Join("uploads", userSession.UserID.String(), file.ID.String(), file.Name) saveFolder := filepath.Join("uploads", userSession.UserID.String(), file.ID.String())
pattern := fmt.Sprintf("%s/chunk_*", saveFolder) pattern := fmt.Sprintf("%s/chunk_*", saveFolder)
chunkFiles, err := filepath.Glob(pattern) chunkFiles, err := filepath.Glob(pattern)

View File

@ -0,0 +1,65 @@
package renameFileHandler
import (
"fmt"
"github.com/fossyy/filekeeper/app"
"github.com/fossyy/filekeeper/types"
"github.com/fossyy/filekeeper/utils"
fileView "github.com/fossyy/filekeeper/view/client/file"
"net/http"
"path/filepath"
"strconv"
)
func PATCH(w http.ResponseWriter, r *http.Request) {
fileID := r.PathValue("id")
newName := r.URL.Query().Get("name")
userSession := r.Context().Value("user").(types.User)
file, err := app.Server.Database.GetFile(fileID)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
if userSession.UserID != file.OwnerID {
w.WriteHeader(http.StatusUnauthorized)
return
}
if newName == "" {
w.WriteHeader(http.StatusBadRequest)
return
}
newFile, err := app.Server.Database.RenameFile(fileID, newName)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
saveFolder := filepath.Join("uploads", userSession.UserID.String(), file.ID.String())
pattern := fmt.Sprintf("%s/chunk_*", saveFolder)
chunkFiles, err := filepath.Glob(pattern)
missingChunk := err != nil || len(chunkFiles) != int(file.TotalChunk)
fileData := types.FileData{
ID: newFile.ID.String(),
Name: newFile.Name,
Size: utils.ConvertFileSize(newFile.Size),
IsPrivate: newFile.IsPrivate,
Type: newFile.Type,
Done: !missingChunk,
Downloaded: strconv.FormatUint(newFile.Downloaded, 10),
}
component := fileView.JustFile(fileData)
err = component.Render(r.Context(), w)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
fileView.JustFile(fileData)
w.WriteHeader(http.StatusOK)
}

View File

@ -53,7 +53,7 @@ func POST(w http.ResponseWriter, r *http.Request) {
basePath := filepath.Join(currentDir, uploadDir) basePath := filepath.Join(currentDir, uploadDir)
cleanBasePath := filepath.Clean(basePath) cleanBasePath := filepath.Clean(basePath)
saveFolder := filepath.Join(cleanBasePath, userSession.UserID.String(), file.ID.String(), file.Name) saveFolder := filepath.Join(cleanBasePath, userSession.UserID.String(), file.ID.String())
cleanSaveFolder := filepath.Clean(saveFolder) cleanSaveFolder := filepath.Clean(saveFolder)

View File

@ -32,7 +32,7 @@ func PUT(w http.ResponseWriter, r *http.Request) {
app.Server.Logger.Error(err.Error()) app.Server.Logger.Error(err.Error())
return return
} }
saveFolder := filepath.Join("uploads", userSession.UserID.String(), file.ID.String(), file.Name) saveFolder := filepath.Join("uploads", userSession.UserID.String(), file.ID.String())
pattern := fmt.Sprintf("%s/chunk_*", saveFolder) pattern := fmt.Sprintf("%s/chunk_*", saveFolder)
chunkFiles, err := filepath.Glob(pattern) chunkFiles, err := filepath.Glob(pattern)

View File

@ -8,6 +8,7 @@ import (
fileHandler "github.com/fossyy/filekeeper/handler/file" fileHandler "github.com/fossyy/filekeeper/handler/file"
deleteHandler "github.com/fossyy/filekeeper/handler/file/delete" deleteHandler "github.com/fossyy/filekeeper/handler/file/delete"
downloadHandler "github.com/fossyy/filekeeper/handler/file/download" downloadHandler "github.com/fossyy/filekeeper/handler/file/download"
renameFileHandler "github.com/fossyy/filekeeper/handler/file/rename"
uploadHandler "github.com/fossyy/filekeeper/handler/file/upload" uploadHandler "github.com/fossyy/filekeeper/handler/file/upload"
visibilityHandler "github.com/fossyy/filekeeper/handler/file/visibility" visibilityHandler "github.com/fossyy/filekeeper/handler/file/visibility"
forgotPasswordHandler "github.com/fossyy/filekeeper/handler/forgotPassword" forgotPasswordHandler "github.com/fossyy/filekeeper/handler/forgotPassword"
@ -131,6 +132,10 @@ func SetupRoutes() *http.ServeMux {
middleware.Auth(visibilityHandler.PUT, w, r) middleware.Auth(visibilityHandler.PUT, w, r)
}) })
handler.HandleFunc("PATCH /file/{id}", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(renameFileHandler.PATCH, w, r)
})
handler.HandleFunc("GET /logout", func(w http.ResponseWriter, r *http.Request) { handler.HandleFunc("GET /logout", func(w http.ResponseWriter, r *http.Request) {
middleware.Auth(logoutHandler.GET, w, r) middleware.Auth(logoutHandler.GET, w, r)
}) })

View File

@ -60,6 +60,7 @@ type Database interface {
CreateFile(file *models.File) error CreateFile(file *models.File) error
GetFile(fileID string) (*models.File, error) GetFile(fileID string) (*models.File, error)
RenameFile(fileID string, name string) (*models.File, error)
DeleteFile(fileID string) error DeleteFile(fileID string) error
GetUserFile(name string, ownerID string) (*models.File, error) GetUserFile(name string, ownerID string) (*models.File, error)
GetFiles(ownerID string) ([]*models.File, error) GetFiles(ownerID string) ([]*models.File, error)

View File

@ -73,6 +73,34 @@ templ MainContent(files []types.FileData, user types.User, allowance *types.Allo
</div> </div>
</div> </div>
</div> </div>
</div>
<div id="renameModal" class="fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden opacity-0 transition-opacity duration-300 z-50">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" aria-hidden="true"></div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">&#8203;</span>
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-title">
Rename File
</h3>
<div class="mt-2">
<input id="newFileName" required type="text" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" value="">
</div>
</div>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" hx-swap="outerHTML" onClick={ hideRenameModal() } id="confirmRenameFile" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
Rename
</button>
<button type="button" onClick={ hideRenameModal() } class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancel
</button>
</div>
</div>
</div>
</div> </div>
<div class="max-w-full overflow-hidden rounded-lg shadow-md bg-white"> <div class="max-w-full overflow-hidden rounded-lg shadow-md bg-white">
<div class="overflow-x-auto"> <div class="overflow-x-auto">
@ -221,7 +249,7 @@ templ MainContent(files []types.FileData, user types.User, allowance *types.Allo
</div> </div>
} }
<div class="py-1 border-t" role="menu" aria-orientation="vertical" aria-labelledby="options-menu"> <div class="py-1 border-t" role="menu" aria-orientation="vertical" aria-labelledby="options-menu">
<button class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full" role="menuitem"> <button onClick={ showRenameModal(file.Name, file.ID) } class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-pen"><path d="M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5"></path><path d="M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-pen"><path d="M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5"></path><path d="M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"></path></svg>
<i class="ri-share-line mr-3 text-gray-400"></i> Rename <i class="ri-share-line mr-3 text-gray-400"></i> Rename
</button> </button>
@ -440,11 +468,11 @@ templ JustFile(file types.FileData) {
</div> </div>
} }
<div class="py-1 border-t" role="menu" aria-orientation="vertical" aria-labelledby="options-menu"> <div class="py-1 border-t" role="menu" aria-orientation="vertical" aria-labelledby="options-menu">
<button class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full" role="menuitem"> <button onClick={ showRenameModal(file.Name, file.ID) } class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full" role="menuitem">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-pen"><path d="M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5"></path><path d="M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-folder-pen"><path d="M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5"></path><path d="M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"></path></svg>
<i class="ri-share-line mr-3 text-gray-400"></i> Rename <i class="ri-share-line mr-3 text-gray-400"></i> Rename
</button> </button>
<button class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full" role="menuitem"> <button onClick={ showDeletionModal(file.Name, file.ID) } class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full" role="menuitem">
<svg width="16px" height="16px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path d="M20.5001 6H3.5" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> <path d="M9.5 11L10 16" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> <path d="M14.5 11L14 16" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> <path d="M6.5 6C6.55588 6 6.58382 6 6.60915 5.99936C7.43259 5.97849 8.15902 5.45491 8.43922 4.68032C8.44784 4.65649 8.45667 4.62999 8.47434 4.57697L8.57143 4.28571C8.65431 4.03708 8.69575 3.91276 8.75071 3.8072C8.97001 3.38607 9.37574 3.09364 9.84461 3.01877C9.96213 3 10.0932 3 10.3553 3H13.6447C13.9068 3 14.0379 3 14.1554 3.01877C14.6243 3.09364 15.03 3.38607 15.2493 3.8072C15.3043 3.91276 15.3457 4.03708 15.4286 4.28571L15.5257 4.57697C15.5433 4.62992 15.5522 4.65651 15.5608 4.68032C15.841 5.45491 16.5674 5.97849 17.3909 5.99936C17.4162 6 17.4441 6 17.5 6" stroke="#000000" stroke-width="1.5"></path> <path d="M18.3735 15.3991C18.1965 18.054 18.108 19.3815 17.243 20.1907C16.378 21 15.0476 21 12.3868 21H11.6134C8.9526 21 7.6222 21 6.75719 20.1907C5.89218 19.3815 5.80368 18.054 5.62669 15.3991L5.16675 8.5M18.8334 8.5L18.6334 11.5" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> </g></svg> <svg width="16px" height="16px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path d="M20.5001 6H3.5" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> <path d="M9.5 11L10 16" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> <path d="M14.5 11L14 16" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> <path d="M6.5 6C6.55588 6 6.58382 6 6.60915 5.99936C7.43259 5.97849 8.15902 5.45491 8.43922 4.68032C8.44784 4.65649 8.45667 4.62999 8.47434 4.57697L8.57143 4.28571C8.65431 4.03708 8.69575 3.91276 8.75071 3.8072C8.97001 3.38607 9.37574 3.09364 9.84461 3.01877C9.96213 3 10.0932 3 10.3553 3H13.6447C13.9068 3 14.0379 3 14.1554 3.01877C14.6243 3.09364 15.03 3.38607 15.2493 3.8072C15.3043 3.91276 15.3457 4.03708 15.4286 4.28571L15.5257 4.57697C15.5433 4.62992 15.5522 4.65651 15.5608 4.68032C15.841 5.45491 16.5674 5.97849 17.3909 5.99936C17.4162 6 17.4441 6 17.5 6" stroke="#000000" stroke-width="1.5"></path> <path d="M18.3735 15.3991C18.1965 18.054 18.108 19.3815 17.243 20.1907C16.378 21 15.0476 21 12.3868 21H11.6134C8.9526 21 7.6222 21 6.75719 20.1907C5.89218 19.3815 5.80368 18.054 5.62669 15.3991L5.16675 8.5M18.8334 8.5L18.6334 11.5" stroke="#000000" stroke-width="1.5" stroke-linecap="round"></path> </g></svg>
<i class="ri-clipboard-line mr-3 text-gray-400"></i> Remove <i class="ri-clipboard-line mr-3 text-gray-400"></i> Remove
</button> </button>
@ -472,11 +500,9 @@ templ FileIcon(fileType string) {
} }
script showDeletionModal(name string, id string) { script showDeletionModal(name string, id string) {
const deleteButton = document.getElementById('deleteButton');
const modal = document.getElementById('deleteModal'); const modal = document.getElementById('deleteModal');
const modalContent = modal.querySelector('div'); const modalContent = modal.querySelector('div');
const confirmDelete = document.getElementById('confirmDelete'); const confirmDelete = document.getElementById('confirmDelete');
const cancelDelete = document.getElementById('cancelDelete');
const fileNameToDelete = document.getElementById('fileNameToDelete'); const fileNameToDelete = document.getElementById('fileNameToDelete');
confirmDelete.setAttribute("hx-delete", "/file/" + id + "?consent=true"); confirmDelete.setAttribute("hx-delete", "/file/" + id + "?consent=true");
@ -491,12 +517,8 @@ script showDeletionModal(name string, id string) {
} }
script hideDeletionModal() { script hideDeletionModal() {
const deleteButton = document.getElementById('deleteButton');
const modal = document.getElementById('deleteModal'); const modal = document.getElementById('deleteModal');
const modalContent = modal.querySelector('div'); const modalContent = modal.querySelector('div');
const confirmDelete = document.getElementById('confirmDelete');
const cancelDelete = document.getElementById('cancelDelete');
const fileNameToDelete = document.getElementById('fileNameToDelete');
modal.classList.add('opacity-0'); modal.classList.add('opacity-0');
modalContent.classList.add('-translate-y-full', 'scale-95', 'opacity-0'); modalContent.classList.add('-translate-y-full', 'scale-95', 'opacity-0');
@ -505,6 +527,39 @@ script hideDeletionModal() {
}, 300); }, 300);
} }
script showRenameModal(name string, id string) {
const rename = document.getElementById('renameModal');
const renameModalContent = rename.querySelector('div');
const fileName = document.getElementById("newFileName");
const confirmRenameFile = document.getElementById("confirmRenameFile");
confirmRenameFile.setAttribute("hx-target", "#file-" + id);
htmx.process(confirmRenameFile);
fileName.addEventListener("change", function (event) {
event.preventDefault();
confirmRenameFile.setAttribute("hx-patch", "/file/" + id + "?name=" + event.target.value);
htmx.process(confirmRenameFile);
});
rename.classList.remove('hidden');
setTimeout(() => {
rename.classList.remove('opacity-0');
renameModalContent.classList.remove('-translate-y-full', 'scale-95', 'opacity-0');
}, 50);
fileName.value = name
}
script hideRenameModal() {
const rename = document.getElementById('renameModal');
const renameModalContent = rename.querySelector('div');
rename.classList.add('opacity-0');
renameModalContent.classList.add('-translate-y-full', 'scale-95', 'opacity-0');
setTimeout(() => {
rename.classList.add('hidden');
}, 300);
}
templ Main(title string, files []types.FileData, user types.User, allowance *types.Allowance) { templ Main(title string, files []types.FileData, user types.User, allowance *types.Allowance) {
@component(title, files, user, allowance) @component(title, files, user, allowance)
} }

View File

@ -120,7 +120,41 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"cancelDelete\" class=\"mt-3 px-4 py-2 bg-white text-gray-700 text-base font-medium rounded-md w-full shadow-sm border border-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-300 transition duration-300\">Cancel</button></div></div></div></div><div class=\"max-w-full overflow-hidden rounded-lg shadow-md bg-white\"><div class=\"overflow-x-auto\"><div class=\"inline-block min-w-full align-middle\"><div class=\"overflow-hidden\"><table class=\"w-full text-sm text-left text-gray-500\"><thead class=\"text-xs text-gray-700 uppercase bg-gray-50\"><tr><th scope=\"col\" class=\"px-6 py-3 w-[40%]\">File Name</th><th scope=\"col\" class=\"px-6 py-3 w-[10%]\">File Size</th><th scope=\"col\" class=\"px-6 py-3 w-[10%]\">Downloads</th><th scope=\"col\" class=\"px-6 py-3 w-[20%]\">Status</th><th scope=\"col\" class=\"px-6 py-3 w-[20%]\">Action</th></tr></thead> <tbody>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"cancelDelete\" class=\"mt-3 px-4 py-2 bg-white text-gray-700 text-base font-medium rounded-md w-full shadow-sm border border-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-300 transition duration-300\">Cancel</button></div></div></div></div><div id=\"renameModal\" class=\"fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full hidden opacity-0 transition-opacity duration-300 z-50\"><div class=\"flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0\"><div class=\"fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity\" aria-hidden=\"true\"></div><span class=\"hidden sm:inline-block sm:align-middle sm:h-screen\" aria-hidden=\"true\">&#8203;</span><div class=\"inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full\"><div class=\"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4\"><div class=\"sm:flex sm:items-start\"><div class=\"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full\"><h3 class=\"text-lg leading-6 font-medium text-gray-900\" id=\"modal-title\">Rename File</h3><div class=\"mt-2\"><input id=\"newFileName\" required type=\"text\" class=\"mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm\" value=\"\"></div></div></div></div><div class=\"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hideRenameModal())
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" hx-swap=\"outerHTML\" onClick=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 templ.ComponentScript = hideRenameModal()
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"confirmRenameFile\" class=\"w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm\">Rename</button> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, hideRenameModal())
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" onClick=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 templ.ComponentScript = hideRenameModal()
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var7.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm\">Cancel</button></div></div></div></div><div class=\"max-w-full overflow-hidden rounded-lg shadow-md bg-white\"><div class=\"overflow-x-auto\"><div class=\"inline-block min-w-full align-middle\"><div class=\"overflow-hidden\"><table class=\"w-full text-sm text-left text-gray-500\"><thead class=\"text-xs text-gray-700 uppercase bg-gray-50\"><tr><th scope=\"col\" class=\"px-6 py-3 w-[40%]\">File Name</th><th scope=\"col\" class=\"px-6 py-3 w-[10%]\">File Size</th><th scope=\"col\" class=\"px-6 py-3 w-[10%]\">Downloads</th><th scope=\"col\" class=\"px-6 py-3 w-[20%]\">Status</th><th scope=\"col\" class=\"px-6 py-3 w-[20%]\">Action</th></tr></thead> <tbody>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -129,12 +163,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs("file-" + file.ID) templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs("file-" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 93, Col: 37} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 121, Col: 37}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -155,12 +189,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 98, Col: 134} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 126, Col: 134}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -168,12 +202,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 99, Col: 74} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 127, Col: 74}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -194,12 +228,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 113, Col: 134} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 141, Col: 134}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -207,12 +241,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 114, Col: 74} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 142, Col: 74}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -225,12 +259,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var13 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size) templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 120, Col: 45} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 148, Col: 45}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -238,12 +272,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 128, Col: 31} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 156, Col: 31}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -274,8 +308,8 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var13 templ.ComponentScript = toggleDropDown() var templ_7745c5c3_Var15 templ.ComponentScript = toggleDropDown()
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var13.Call) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var15.Call)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -288,8 +322,8 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var14 templ.SafeURL = templ.SafeURL("/file/" + file.ID) var templ_7745c5c3_Var16 templ.SafeURL = templ.SafeURL("/file/" + file.ID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var14))) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var16)))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -298,37 +332,6 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if file.IsPrivate { if file.IsPrivate {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\" hx-put=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 183, Col: 220}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 183, Col: 253}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-gray-600\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"></path></svg> <i class=\"ri-delete-bin-line mr-3 text-gray-400\"></i> Make Public</button> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\" hx-put=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\" hx-put=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@ -336,7 +339,7 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
var templ_7745c5c3_Var17 string var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 200, Col: 220} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 211, Col: 220}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -349,12 +352,43 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
var templ_7745c5c3_Var18 string var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 200, Col: 253} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 211, Col: 253}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-gray-600\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064M21 12a9 9 0 11-18 0 9 9 0 0118 0z\"></path></svg> <i class=\"ri-delete-bin-line mr-3 text-gray-400\"></i> Make Public</button> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\" hx-put=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var19 string
templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 228, Col: 220}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var20 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 228, Col: 253}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-gray-600\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z\"></path></svg> <i class=\"ri-delete-bin-line mr-3 text-gray-400\"></i> Make Private</button> ") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"h-4 w-4 text-gray-600\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\"><path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z\"></path></svg> <i class=\"ri-delete-bin-line mr-3 text-gray-400\"></i> Make Private</button> ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
@ -365,7 +399,24 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"py-1 border-t\" role=\"menu\" aria-orientation=\"vertical\" aria-labelledby=\"options-menu\"><button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-folder-pen\"><path d=\"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5\"></path><path d=\"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z\"></path></svg> <i class=\"ri-share-line mr-3 text-gray-400\"></i> Rename</button> ") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"py-1 border-t\" role=\"menu\" aria-orientation=\"vertical\" aria-labelledby=\"options-menu\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, showRenameModal(file.Name, file.ID))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button onClick=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var21 templ.ComponentScript = showRenameModal(file.Name, file.ID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var21.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-folder-pen\"><path d=\"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5\"></path><path d=\"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z\"></path></svg> <i class=\"ri-share-line mr-3 text-gray-400\"></i> Rename</button> ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -377,8 +428,8 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var19 templ.ComponentScript = showDeletionModal(file.Name, file.ID) var templ_7745c5c3_Var22 templ.ComponentScript = showDeletionModal(file.Name, file.ID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var19.Call) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var22.Call)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -391,12 +442,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var20 string var templ_7745c5c3_Var23 string
templ_7745c5c3_Var20, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(files))) templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(len(files)))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 244, Col: 120} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 272, Col: 120}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var20)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -404,12 +455,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var21 string var templ_7745c5c3_Var24 string
templ_7745c5c3_Var21, templ_7745c5c3_Err = templ.JoinStringErrs(allowance.AllowanceUsedByte) templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(allowance.AllowanceUsedByte)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 245, Col: 123} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 273, Col: 123}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var21)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -417,12 +468,12 @@ func MainContent(files []types.FileData, user types.User, allowance *types.Allow
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var22 string var templ_7745c5c3_Var25 string
templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(allowance.AllowanceByte) templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(allowance.AllowanceByte)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 246, Col: 123} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 274, Col: 123}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -476,21 +527,21 @@ func JustFile(file types.FileData) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var23 := templ.GetChildren(ctx) templ_7745c5c3_Var26 := templ.GetChildren(ctx)
if templ_7745c5c3_Var23 == nil { if templ_7745c5c3_Var26 == nil {
templ_7745c5c3_Var23 = templ.NopComponent templ_7745c5c3_Var26 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr id=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr id=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var24 string var templ_7745c5c3_Var27 string
templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs("file-" + file.ID) templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs("file-" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 313, Col: 27} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 341, Col: 27}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -511,12 +562,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var25 string var templ_7745c5c3_Var28 string
templ_7745c5c3_Var25, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 318, Col: 94} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 346, Col: 94}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var25)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -524,12 +575,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var26 string var templ_7745c5c3_Var29 string
templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 319, Col: 34} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 347, Col: 34}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -550,12 +601,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var27 string var templ_7745c5c3_Var30 string
templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 333, Col: 94} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 361, Col: 94}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -563,12 +614,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var28 string var templ_7745c5c3_Var31 string
templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name) templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(file.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 334, Col: 34} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 362, Col: 34}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -581,12 +632,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var29 string var templ_7745c5c3_Var32 string
templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size) templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(file.Size)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 339, Col: 35} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 367, Col: 35}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -594,12 +645,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var30 string var templ_7745c5c3_Var33 string
templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded) templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs(file.Downloaded)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 347, Col: 21} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 375, Col: 21}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -630,8 +681,8 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var31 templ.ComponentScript = toggleDropDown() var templ_7745c5c3_Var34 templ.ComponentScript = toggleDropDown()
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var31.Call) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var34.Call)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -644,8 +695,8 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var32 templ.SafeURL = templ.SafeURL("/file/" + file.ID) var templ_7745c5c3_Var35 templ.SafeURL = templ.SafeURL("/file/" + file.ID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var32))) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var35)))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -658,12 +709,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var33 string var templ_7745c5c3_Var36 string
templ_7745c5c3_Var33, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 402, Col: 180} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 430, Col: 180}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var33)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -671,12 +722,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var34 string var templ_7745c5c3_Var37 string
templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 402, Col: 213} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 430, Col: 213}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -689,12 +740,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var35 string var templ_7745c5c3_Var38 string
templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID) templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs("/file/" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 419, Col: 180} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 447, Col: 180}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -702,12 +753,12 @@ func JustFile(file types.FileData) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var36 string var templ_7745c5c3_Var39 string
templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID) templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs("#file-" + file.ID)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 419, Col: 213} return templ.Error{Err: templ_7745c5c3_Err, FileName: `view/client/file/file.templ`, Line: 447, Col: 213}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -721,7 +772,41 @@ func JustFile(file types.FileData) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"py-1 border-t\" role=\"menu\" aria-orientation=\"vertical\" aria-labelledby=\"options-menu\"><button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-folder-pen\"><path d=\"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5\"></path><path d=\"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z\"></path></svg> <i class=\"ri-share-line mr-3 text-gray-400\"></i> Rename</button> <button class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\"><svg width=\"16px\" height=\"16px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke-width=\"0\"></g><g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g><g><path d=\"M20.5001 6H3.5\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M9.5 11L10 16\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M14.5 11L14 16\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M6.5 6C6.55588 6 6.58382 6 6.60915 5.99936C7.43259 5.97849 8.15902 5.45491 8.43922 4.68032C8.44784 4.65649 8.45667 4.62999 8.47434 4.57697L8.57143 4.28571C8.65431 4.03708 8.69575 3.91276 8.75071 3.8072C8.97001 3.38607 9.37574 3.09364 9.84461 3.01877C9.96213 3 10.0932 3 10.3553 3H13.6447C13.9068 3 14.0379 3 14.1554 3.01877C14.6243 3.09364 15.03 3.38607 15.2493 3.8072C15.3043 3.91276 15.3457 4.03708 15.4286 4.28571L15.5257 4.57697C15.5433 4.62992 15.5522 4.65651 15.5608 4.68032C15.841 5.45491 16.5674 5.97849 17.3909 5.99936C17.4162 6 17.4441 6 17.5 6\" stroke=\"#000000\" stroke-width=\"1.5\"></path> <path d=\"M18.3735 15.3991C18.1965 18.054 18.108 19.3815 17.243 20.1907C16.378 21 15.0476 21 12.3868 21H11.6134C8.9526 21 7.6222 21 6.75719 20.1907C5.89218 19.3815 5.80368 18.054 5.62669 15.3991L5.16675 8.5M18.8334 8.5L18.6334 11.5\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></g></svg> <i class=\"ri-clipboard-line mr-3 text-gray-400\"></i> Remove</button></div></div></div></td></tr>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"py-1 border-t\" role=\"menu\" aria-orientation=\"vertical\" aria-labelledby=\"options-menu\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, showRenameModal(file.Name, file.ID))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button onClick=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var40 templ.ComponentScript = showRenameModal(file.Name, file.ID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var40.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" class=\"lucide lucide-folder-pen\"><path d=\"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5\"></path><path d=\"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z\"></path></svg> <i class=\"ri-share-line mr-3 text-gray-400\"></i> Rename</button> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, showDeletionModal(file.Name, file.ID))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button onClick=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var41 templ.ComponentScript = showDeletionModal(file.Name, file.ID)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var41.Call)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" class=\"flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900 w-full\" role=\"menuitem\"><svg width=\"16px\" height=\"16px\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"><g stroke-width=\"0\"></g><g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g><g><path d=\"M20.5001 6H3.5\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M9.5 11L10 16\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M14.5 11L14 16\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path> <path d=\"M6.5 6C6.55588 6 6.58382 6 6.60915 5.99936C7.43259 5.97849 8.15902 5.45491 8.43922 4.68032C8.44784 4.65649 8.45667 4.62999 8.47434 4.57697L8.57143 4.28571C8.65431 4.03708 8.69575 3.91276 8.75071 3.8072C8.97001 3.38607 9.37574 3.09364 9.84461 3.01877C9.96213 3 10.0932 3 10.3553 3H13.6447C13.9068 3 14.0379 3 14.1554 3.01877C14.6243 3.09364 15.03 3.38607 15.2493 3.8072C15.3043 3.91276 15.3457 4.03708 15.4286 4.28571L15.5257 4.57697C15.5433 4.62992 15.5522 4.65651 15.5608 4.68032C15.841 5.45491 16.5674 5.97849 17.3909 5.99936C17.4162 6 17.4441 6 17.5 6\" stroke=\"#000000\" stroke-width=\"1.5\"></path> <path d=\"M18.3735 15.3991C18.1965 18.054 18.108 19.3815 17.243 20.1907C16.378 21 15.0476 21 12.3868 21H11.6134C8.9526 21 7.6222 21 6.75719 20.1907C5.89218 19.3815 5.80368 18.054 5.62669 15.3991L5.16675 8.5M18.8334 8.5L18.6334 11.5\" stroke=\"#000000\" stroke-width=\"1.5\" stroke-linecap=\"round\"></path></g></svg> <i class=\"ri-clipboard-line mr-3 text-gray-400\"></i> Remove</button></div></div></div></td></tr>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -745,9 +830,9 @@ func FileIcon(fileType string) templ.Component {
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var37 := templ.GetChildren(ctx) templ_7745c5c3_Var42 := templ.GetChildren(ctx)
if templ_7745c5c3_Var37 == nil { if templ_7745c5c3_Var42 == nil {
templ_7745c5c3_Var37 = templ.NopComponent templ_7745c5c3_Var42 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
if fileType == "jpg" || fileType == "jpeg" || fileType == "png" || fileType == "gif" || fileType == "bmp" || fileType == "tiff" { if fileType == "jpg" || fileType == "jpeg" || fileType == "png" || fileType == "gif" || fileType == "bmp" || fileType == "tiff" {
@ -787,12 +872,10 @@ func FileIcon(fileType string) templ.Component {
func showDeletionModal(name string, id string) templ.ComponentScript { func showDeletionModal(name string, id string) templ.ComponentScript {
return templ.ComponentScript{ return templ.ComponentScript{
Name: `__templ_showDeletionModal_c813`, Name: `__templ_showDeletionModal_42e1`,
Function: `function __templ_showDeletionModal_c813(name, id){const deleteButton = document.getElementById('deleteButton'); Function: `function __templ_showDeletionModal_42e1(name, id){const modal = document.getElementById('deleteModal');
const modal = document.getElementById('deleteModal');
const modalContent = modal.querySelector('div'); const modalContent = modal.querySelector('div');
const confirmDelete = document.getElementById('confirmDelete'); const confirmDelete = document.getElementById('confirmDelete');
const cancelDelete = document.getElementById('cancelDelete');
const fileNameToDelete = document.getElementById('fileNameToDelete'); const fileNameToDelete = document.getElementById('fileNameToDelete');
confirmDelete.setAttribute("hx-delete", "/file/" + id + "?consent=true"); confirmDelete.setAttribute("hx-delete", "/file/" + id + "?consent=true");
@ -805,20 +888,16 @@ func showDeletionModal(name string, id string) templ.ComponentScript {
}, 50); }, 50);
fileNameToDelete.textContent = name; fileNameToDelete.textContent = name;
}`, }`,
Call: templ.SafeScript(`__templ_showDeletionModal_c813`, name, id), Call: templ.SafeScript(`__templ_showDeletionModal_42e1`, name, id),
CallInline: templ.SafeScriptInline(`__templ_showDeletionModal_c813`, name, id), CallInline: templ.SafeScriptInline(`__templ_showDeletionModal_42e1`, name, id),
} }
} }
func hideDeletionModal() templ.ComponentScript { func hideDeletionModal() templ.ComponentScript {
return templ.ComponentScript{ return templ.ComponentScript{
Name: `__templ_hideDeletionModal_a203`, Name: `__templ_hideDeletionModal_0159`,
Function: `function __templ_hideDeletionModal_a203(){const deleteButton = document.getElementById('deleteButton'); Function: `function __templ_hideDeletionModal_0159(){const modal = document.getElementById('deleteModal');
const modal = document.getElementById('deleteModal');
const modalContent = modal.querySelector('div'); const modalContent = modal.querySelector('div');
const confirmDelete = document.getElementById('confirmDelete');
const cancelDelete = document.getElementById('cancelDelete');
const fileNameToDelete = document.getElementById('fileNameToDelete');
modal.classList.add('opacity-0'); modal.classList.add('opacity-0');
modalContent.classList.add('-translate-y-full', 'scale-95', 'opacity-0'); modalContent.classList.add('-translate-y-full', 'scale-95', 'opacity-0');
@ -826,8 +905,53 @@ func hideDeletionModal() templ.ComponentScript {
modal.classList.add('hidden'); modal.classList.add('hidden');
}, 300); }, 300);
}`, }`,
Call: templ.SafeScript(`__templ_hideDeletionModal_a203`), Call: templ.SafeScript(`__templ_hideDeletionModal_0159`),
CallInline: templ.SafeScriptInline(`__templ_hideDeletionModal_a203`), CallInline: templ.SafeScriptInline(`__templ_hideDeletionModal_0159`),
}
}
func showRenameModal(name string, id string) templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_showRenameModal_e95d`,
Function: `function __templ_showRenameModal_e95d(name, id){const rename = document.getElementById('renameModal');
const renameModalContent = rename.querySelector('div');
const fileName = document.getElementById("newFileName");
const confirmRenameFile = document.getElementById("confirmRenameFile");
confirmRenameFile.setAttribute("hx-target", "#file-" + id);
htmx.process(confirmRenameFile);
fileName.addEventListener("change", function (event) {
event.preventDefault();
confirmRenameFile.setAttribute("hx-patch", "/file/" + id + "?name=" + event.target.value);
htmx.process(confirmRenameFile);
});
rename.classList.remove('hidden');
setTimeout(() => {
rename.classList.remove('opacity-0');
renameModalContent.classList.remove('-translate-y-full', 'scale-95', 'opacity-0');
}, 50);
fileName.value = name
}`,
Call: templ.SafeScript(`__templ_showRenameModal_e95d`, name, id),
CallInline: templ.SafeScriptInline(`__templ_showRenameModal_e95d`, name, id),
}
}
func hideRenameModal() templ.ComponentScript {
return templ.ComponentScript{
Name: `__templ_hideRenameModal_e2c4`,
Function: `function __templ_hideRenameModal_e2c4(){const rename = document.getElementById('renameModal');
const renameModalContent = rename.querySelector('div');
rename.classList.add('opacity-0');
renameModalContent.classList.add('-translate-y-full', 'scale-95', 'opacity-0');
setTimeout(() => {
rename.classList.add('hidden');
}, 300);
}`,
Call: templ.SafeScript(`__templ_hideRenameModal_e2c4`),
CallInline: templ.SafeScriptInline(`__templ_hideRenameModal_e2c4`),
} }
} }
@ -847,9 +971,9 @@ func Main(title string, files []types.FileData, user types.User, allowance *type
}() }()
} }
ctx = templ.InitializeContext(ctx) ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var38 := templ.GetChildren(ctx) templ_7745c5c3_Var43 := templ.GetChildren(ctx)
if templ_7745c5c3_Var38 == nil { if templ_7745c5c3_Var43 == nil {
templ_7745c5c3_Var38 = templ.NopComponent templ_7745c5c3_Var43 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = component(title, files, user, allowance).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = component(title, files, user, allowance).Render(ctx, templ_7745c5c3_Buffer)