Skip to content

feat(client): save the last edited date #1209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 6, 2025

Conversation

AJMADHAB
Copy link
Contributor

Description

Save Last edited Date

Changes Made

1.Modified AppTileCard.tsx
2.Added project_date_last_edited in 4 files

How to Test

  1. Steps to reproduce/test the behavior:
    Go to App Landing Page
  2. Expected outcomes:
    You will be able to see published and last edited dates.

Notes

@AJMADHAB AJMADHAB self-assigned this May 23, 2025
@AJMADHAB AJMADHAB requested a review from a team as a code owner May 23, 2025 12:22
@AJMADHAB AJMADHAB linked an issue May 23, 2025 that may be closed by this pull request
Copy link

@CodiumAI-Agent /describe

@CodiumAI-Agent
Copy link

Title

feat(client): save the last edited date


User description

Description

Save Last edited Date

Changes Made

1.Modified AppTileCard.tsx
2.Added project_date_last_edited in 4 files

How to Test

  1. Steps to reproduce/test the behavior:
    Go to App Landing Page
  2. Expected outcomes:
    You will be able to see published and last edited dates.

Notes


PR Type

Enhancement


Description

  • Add project_date_last_edited to AppMetadata

  • Show last edited date in app tiles

  • Initialize project_date_last_edited in defaults


Changes walkthrough 📝

Relevant files
Enhancement
AppTemplates.tsx
Add last edited metadata to templates                                       

packages/client/src/components/app/AppTemplates.tsx

  • Inserted project_date_last_edited default field
  • Updated template metadata builder
  • +1/-0     
    AppTileCard.tsx
    Display last edited date in tile card                                       

    packages/client/src/components/app/AppTileCard.tsx

  • Added useMemo for lastEditedDate
  • Rendered "Last Edited" date below published date
  • +14/-0   
    app.types.ts
    Add last edited field to metadata type                                     

    packages/client/src/components/app/app.types.ts

  • Extended AppMetadata interface
  • Added project_date_last_edited: string field
  • +1/-0     
    HomePage.tsx
    Initialize last edited in homepage defaults                           

    packages/client/src/pages/HomePage.tsx

  • Initialized project_date_last_edited in BI defaults
  • Initialized project_date_last_edited in Terminal defaults
  • +2/-0     
    workspace.store.ts
    Initialize last edited in workspace store                               

    packages/client/src/stores/workspace/workspace.store.ts

  • Added project_date_last_edited to workspace metadata
  • Set default value to empty string
  • +1/-0     

    Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link

    @CodiumAI-Agent /review

    Copy link

    @CodiumAI-Agent /improve

    @CodiumAI-Agent
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Fallback Date Logic

    The logic falls back to the current date for missing or invalid project_date_last_edited, which may mislead users. Consider hiding the date or showing "Unknown" when no actual last edited date is available.

    const lastEditedDate = useMemo(() => {
        const d = dayjs(app.project_date_last_edited);
        if (!d.isValid()) {
            return `Last Edited ${dayjs().format('MMMM D, YYYY')}`;
        }
    
        return `Last Edited ${d.format('MMMM D, YYYY')}`;
    }, [app.project_date_last_edited]);
    Default Value Initialization

    Initializing project_date_last_edited to an empty string may be inappropriate for templates. Consider setting a meaningful default or omitting the field until a valid date is assigned.

    project_date_last_edited: '',

    @CodiumAI-Agent
    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Avoid default today date

    Return an empty string instead of defaulting to today when project_date_last_edited
    is invalid. This prevents misleading “Last Edited” dates when none is provided.

    packages/client/src/components/app/AppTileCard.tsx [262-269]

     const lastEditedDate = useMemo(() => {
         const d = dayjs(app.project_date_last_edited);
         if (!d.isValid()) {
    -        return `Last Edited ${dayjs().format('MMMM D, YYYY')}`;
    +        return '';
         }
     
         return `Last Edited ${d.format('MMMM D, YYYY')}`;
     }, [app.project_date_last_edited]);
    Suggestion importance[1-10]: 6

    __

    Why: Changing the fallback to an empty string prevents misleading “Last Edited” dates when none exists, improving UX without major impact.

    Low
    General
    Conditionally render last edited

    Only render the "Last Edited" container when a valid date string exists. This hides
    the section entirely if lastEditedDate is empty.

    packages/client/src/components/app/AppTileCard.tsx [443-449]

    -<StyledPublishedByContainer>
    +{lastEditedDate && (
    +  <StyledPublishedByContainer>
         <StyledAccessTimeIcon />
         <StyledPublishedByLabel variant={'body2'}>
    -        {lastEditedDate}
    +      {lastEditedDate}
         </StyledPublishedByLabel>
    -</StyledPublishedByContainer>
    +  </StyledPublishedByContainer>
    +)}
    Suggestion importance[1-10]: 5

    __

    Why: Wrapping the display in a conditional hides an empty “Last Edited” section, which is a minor but useful UX enhancement.

    Low

    const lastEditedDate = useMemo(() => {
    const d = dayjs(app.project_date_last_edited);
    if (!d.isValid()) {
    return `Last Edited ${dayjs().format('MMMM D, YYYY')}`;
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    If date is not valid, set it to null. Similarly do it for createdDate.

    @@ -432,6 +440,12 @@ export const AppTileCard = (props: AppTileCardProps) => {
    {createdDate}
    </StyledPublishedByLabel>
    </StyledPublishedByContainer>
    <StyledPublishedByContainer>
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Render this only if the lastEditedDate is present. Do the same for createdDate

    AJMADHAB and others added 2 commits May 24, 2025 11:25

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    @@ -253,12 +253,20 @@ export const AppTileCard = (props: AppTileCardProps) => {
    const createdDate = useMemo(() => {
    const d = dayjs(app.project_date_created);
    if (!d.isValid()) {
    return `Published ${dayjs().format('MMMM D, YYYY')}`;
    return '';
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    I agree with @anurag91jain that this should be returning null.

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy link
    Contributor

    @AAfghahi AAfghahi left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    I still do not like returning an empty string instead of null

    @anurag91jain anurag91jain merged commit efb07b9 into dev Jun 6, 2025
    3 checks passed
    @anurag91jain anurag91jain deleted the 1181-fe-save-the-last-edited-date branch June 6, 2025 13:32
    Copy link

    github-actions bot commented Jun 6, 2025

    @CodiumAI-Agent /update_changelog

    @CodiumAI-Agent
    Copy link

    Changelog updates: 🔄

    2025-06-06 *

    Added

    • Save last edited timestamp in project metadata
    • Display last edited date on app cards

    to commit the new content to the CHANGELOG.md file, please type:
    '/update_changelog --pr_update_changelog.push_changelog_changes=true'

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    [FE] Save the last edited date
    4 participants