feat(preview): add file preview page with metadata and styling
All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m48s
All checks were successful
Build and Publish Docker Image / deploy (push) Successful in 1m48s
Implement a rich file preview interface to allow users to view file contents directly in the browser. Changes include: - Exposing raw file size (`SizeBytes`) in the download handler's file view. - Adding comprehensive CSS styling for the preview layout and cards. - Integrating Prism.js for syntax highlighting of code files. - Updating Content Security Policy (CSP) headers to permit inline styles and frame sources required by the preview components. - Adding unit tests to ensure preview metadata attributes are correctly rendered on the download page.
This commit is contained in:
@@ -40,6 +40,7 @@ type fileView struct {
|
||||
ID string
|
||||
Name string
|
||||
Size string
|
||||
SizeBytes int64
|
||||
ContentType string
|
||||
PreviewKind string
|
||||
URL string
|
||||
@@ -404,6 +405,7 @@ func (a *App) fileViewWithReactions(box services.Box, file services.File, reacti
|
||||
ID: file.ID,
|
||||
Name: file.Name,
|
||||
Size: helpers.FormatBytes(file.Size),
|
||||
SizeBytes: file.Size,
|
||||
ContentType: file.ContentType,
|
||||
PreviewKind: file.PreviewKind,
|
||||
URL: fmt.Sprintf("/d/%s/f/%s", box.ID, file.ID),
|
||||
|
||||
Reference in New Issue
Block a user