-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(date): show date last modified (#1198)
* feat(date) show date last modified * feat(date) update last modified and created * feat(date) remove console logs * feat(date) rebase * feat(date) update last active time * feat(date) meta type with meta information * feat(date) ping to update last active date * feat(date) fix consistency * feat(date) change order of last active and created * feat(date) dynamic api routes and remove last active and created from my boards * feat(date) rebase master * fix(edit) delete debug logs * fix(edit) change from date strings to number * feat(date) move logic from hook * feat(date) remove some logic * feat(date) remove comment * feat(date) update lastActive field directly * feat(date) throw error if board does not exist
- Loading branch information
1 parent
4930780
commit 0f44fe7
Showing
14 changed files
with
105 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { initializeAdminApp, setLastActive } from 'Admin/utils/firebase' | ||
import { NextApiRequest, NextApiResponse } from 'next' | ||
import { TBoardID } from 'types/settings' | ||
|
||
initializeAdminApp() | ||
|
||
export default async function handler( | ||
request: NextApiRequest, | ||
response: NextApiResponse, | ||
) { | ||
const { id } = request.query | ||
try { | ||
await setLastActive(id as TBoardID) | ||
return response.status(200).json({ message: 'Successfully updated!' }) | ||
} catch (error) { | ||
return response.status(400).json({ error: 'Could not update!' }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
next-tavla/src/Admin/scenarios/BoardList/components/Row/styles.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { useCallback, useEffect } from 'react' | ||
import { TBoardID } from 'types/settings' | ||
|
||
function useUpdateLastActive(documentId: TBoardID | undefined) { | ||
const updateLastActive = useCallback(async () => { | ||
await fetch(`/api/ping/${documentId}`, { | ||
method: 'POST', | ||
}) | ||
}, [documentId]) | ||
|
||
useEffect(() => { | ||
updateLastActive() | ||
const intervalId = setInterval(updateLastActive, 1000 * 60 * 60 * 24) | ||
return () => { | ||
clearInterval(intervalId) | ||
} | ||
}, [updateLastActive]) | ||
} | ||
|
||
export { useUpdateLastActive } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export type TMeta = { | ||
title?: string | ||
created?: number | ||
lastActive?: number | ||
dateModified?: number | ||
version?: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters