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