Fix: Removed updatedAt from project list (#853)

This commit is contained in:
Ary
2024-04-03 13:35:18 -06:00
committed by GitHub
parent 8b8b3347fb
commit 9f207dd39a
5 changed files with 3 additions and 12 deletions
@@ -43,8 +43,7 @@ export default function ProjectList() {
<thead> <thead>
<tr> <tr>
<th className={style.containCell}>Project Name</th> <th className={style.containCell}>Project Name</th>
<th>Date Created</th> <th>Last Used</th>
<th>Date Modified</th>
<th /> <th />
</tr> </tr>
</thead> </thead>
@@ -53,7 +52,6 @@ export default function ProjectList() {
<ProjectListItem <ProjectListItem
key={project.filename} key={project.filename}
filename={project.filename} filename={project.filename}
createdAt={project.createdAt}
updatedAt={project.updatedAt} updatedAt={project.updatedAt}
onToggleEditMode={handleToggleEditMode} onToggleEditMode={handleToggleEditMode}
onSubmit={handleClear} onSubmit={handleClear}
@@ -21,7 +21,6 @@ export type EditMode = 'rename' | 'duplicate' | null;
interface ProjectListItemProps { interface ProjectListItemProps {
current?: boolean; current?: boolean;
filename: string; filename: string;
createdAt: string;
updatedAt: string; updatedAt: string;
onToggleEditMode: (editMode: EditMode, filename: string | null) => void; onToggleEditMode: (editMode: EditMode, filename: string | null) => void;
onSubmit: () => void; onSubmit: () => void;
@@ -32,14 +31,13 @@ interface ProjectListItemProps {
export default function ProjectListItem({ export default function ProjectListItem({
current, current,
createdAt, updatedAt,
editingFilename, editingFilename,
editingMode, editingMode,
filename, filename,
onRefetch, onRefetch,
onSubmit, onSubmit,
onToggleEditMode, onToggleEditMode,
updatedAt,
}: ProjectListItemProps) { }: ProjectListItemProps) {
const [submitError, setSubmitError] = useState<string | null>(null); const [submitError, setSubmitError] = useState<string | null>(null);
@@ -102,7 +100,6 @@ export default function ProjectListItem({
) : ( ) : (
<> <>
<td className={style.containCell}>{filename}</td> <td className={style.containCell}>{filename}</td>
<td>{new Date(createdAt).toLocaleString()}</td>
<td>{new Date(updatedAt).toLocaleString()}</td> <td>{new Date(updatedAt).toLocaleString()}</td>
<td className={style.actionButton}> <td className={style.actionButton}>
<ActionMenu <ActionMenu
@@ -67,8 +67,7 @@ export async function handleUploadedFile(filePath: string, name: string) {
* *
* @returns {Promise<Array<ProjectFile>>} A promise that resolves to an array of ProjectFile objects, * @returns {Promise<Array<ProjectFile>>} A promise that resolves to an array of ProjectFile objects,
* each representing a file in the 'uploads' folder with its metadata. * each representing a file in the 'uploads' folder with its metadata.
* The metadata includes the filename, creation time (createdAt), * The metadata includes the filename, creation or overwriting time (updatedAt)
* and last modification time (updatedAt) of each file.
* *
* @throws {Error} Throws an error if there is an issue in reading the directory or fetching file statistics. * @throws {Error} Throws an error if there is an issue in reading the directory or fetching file statistics.
*/ */
@@ -83,7 +82,6 @@ export async function getProjectFiles(): Promise<ProjectFile[]> {
projectFiles.push({ projectFiles.push({
filename: removeFileExtension(file), filename: removeFileExtension(file),
createdAt: stats.birthtime.toISOString(),
updatedAt: stats.mtime.toISOString(), updatedAt: stats.mtime.toISOString(),
}); });
} }
@@ -23,7 +23,6 @@ describe('getProjectFiles test', () => {
const expectedFiles = ['file1', 'file2', 'file3'].map((file) => ({ const expectedFiles = ['file1', 'file2', 'file3'].map((file) => ({
filename: file, filename: file,
createdAt: new Date('2020-01-01').toISOString(),
updatedAt: new Date('2021-01-01').toISOString(), updatedAt: new Date('2021-01-01').toISOString(),
})); }));
@@ -15,7 +15,6 @@ export interface GetInfo {
export type ProjectFile = { export type ProjectFile = {
filename: string; filename: string;
createdAt: string;
updatedAt: string; updatedAt: string;
}; };