mirror of
https://github.com/wgh136/nysoure.git
synced 2025-12-16 07:51:14 +00:00
Display created time of files.
This commit is contained in:
@@ -106,6 +106,7 @@ export interface RFile {
|
||||
resource?: Resource;
|
||||
hash?: string;
|
||||
storage_name?: string;
|
||||
created_at: number; // unix timestamp
|
||||
}
|
||||
|
||||
export interface UploadingFile {
|
||||
|
||||
@@ -25,7 +25,7 @@ import Markdown from "react-markdown";
|
||||
import "../markdown.css";
|
||||
import Loading from "../components/loading.tsx";
|
||||
import {
|
||||
MdAdd,
|
||||
MdAdd, MdOutlineAccessTime,
|
||||
MdOutlineAdd,
|
||||
MdOutlineArchive,
|
||||
MdOutlineArticle,
|
||||
@@ -776,6 +776,10 @@ function FileTile({ file }: { file: RFile }) {
|
||||
{file.storage_name}
|
||||
</Badge>
|
||||
)}
|
||||
<Badge className={"badge-soft badge-info text-xs mr-2"}>
|
||||
<MdOutlineAccessTime size={16} className={"inline-block"} />
|
||||
{new Date(file.created_at).toISOString().substring(0, 10)}
|
||||
</Badge>
|
||||
<DeleteFileDialog fileId={file.id} uploaderId={file.user.id} />
|
||||
<UpdateFileInfoDialog file={file} />
|
||||
</p>
|
||||
|
||||
@@ -31,6 +31,7 @@ type FileView struct {
|
||||
Resource *ResourceView `json:"resource,omitempty"`
|
||||
Hash string `json:"hash,omitempty"`
|
||||
StorageName string `json:"storage_name,omitempty"`
|
||||
CreatedAt int64 `json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (f *File) ToView() *FileView {
|
||||
@@ -43,6 +44,7 @@ func (f *File) ToView() *FileView {
|
||||
User: f.User.ToView(),
|
||||
Hash: f.Hash,
|
||||
StorageName: f.Storage.Name,
|
||||
CreatedAt: f.CreatedAt.Unix(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user