Skip to content
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

fix: attachment preview issue #4282

Merged
merged 3 commits into from
Dec 17, 2024
Merged

Conversation

louis-jan
Copy link
Contributor

Describe Your Changes

  • This PR fixed the attachment open path for new thread structures. Previously, files were located at threads/{id}/files. Now, we're introducing a new files folder.

Self Checklist

  1. usePath.ts:

    • Added import { fs } from '@janhq/core' and import { getFileInfo } from '@/utils/file'.
    • Modified the onViewFile function to handle new ID systems, using getFileInfo to retrieve file information.
  2. ChatInput/index.tsx:

    • Changed the way fileUpload is accessed in renderPreview.
  3. DocMessage.tsx:

    • Removed memoization and replaced with functional component.
    • Used useState and useEffect to handle file info fetching dynamically.
    • Updated rendering logic to use fetched file information.
  4. ImageMessage.tsx:

    • Simplified the component by removing unused logic and ensuring proper type definitions.
  5. RelativeImage.tsx:

    • Added a conditional class for cursor styling based on whether onClick is provided.
  6. TextMessage/index.tsx:

    • Updated the way attachedFile is handled in the message rendering logic.
  7. file.ts:

    • Added a new function getFileInfo to fetch file information from the server.

These changes involve adding utility functions, refactoring components for better performance and readability, and handling dynamic data fetching more effectively.

@louis-jan louis-jan requested a review from urmauur December 17, 2024 09:22
@github-actions github-actions bot added the type: bug Something isn't working label Dec 17, 2024
Copy link
Contributor

This is the build for this pull request. You can download it from the Artifacts section here: Build URL.

@louis-jan louis-jan force-pushed the fix/message-attachments-preview branch from beaf811 to 3a9c999 Compare December 17, 2024 11:59
@louis-jan louis-jan merged commit 0cd0ff0 into dev Dec 17, 2024
10 checks passed
@louis-jan louis-jan deleted the fix/message-attachments-preview branch December 17, 2024 14:22
@github-actions github-actions bot added this to the v0.5.12 milestone Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants