twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.04k stars 1.48k forks source link

Deeplink or Permalink to Note or Task #6111

Open mipmip opened 1 week ago

mipmip commented 1 week ago

Scope & Context

Having a permalink to a note would allow to refer to this note from inside a task. or to link to this note inside another application.

Current behavior

Currently it seems to be a pure javascript event which makes a note popup.

Expected behavior

A share button which includes a copy url action would make it possible to use permalinks to notes or tasks.

greptile-apps[bot] commented 1 week ago

Implementation Steps

  1. Add Share Button to Note and Task Components

    • For notes, modify the relevant component (e.g., NoteComponent.tsx). For tasks, modify TaskRow.tsx.
    • Import necessary modules:
      import { IconCopy } from 'twenty-ui';
      import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
      import { Button } from '@/ui/input/button/components/Button';
  2. Add Share Button in JSX

    • Add a Button component with an IconCopy icon and an onClick handler to copy the URL:
      <Button
      Icon={IconCopy}
      title="Copy URL"
      onClick={() => {
       const url = `${window.location.origin}/note/${noteId}`; // or `/task/${taskId}`
       navigator.clipboard.writeText(url);
       enqueueSnackBar('URL copied to clipboard', {
         variant: SnackBarVariant.Success,
         icon: <IconCopy size={theme.icon.size.md} />,
         duration: 2000,
       });
      }}
      />
  3. Snackbar Notification

    • Use the useSnackBar hook to show a notification when the URL is copied, similar to WorkspaceInviteLink.tsx and ApiKeyInput.tsx.
  4. Generate URL

    • Construct the URL dynamically based on the note or task ID.
      const url = `${window.location.origin}/note/${noteId}`; // or `/task/${taskId}`
  5. Update Styles if Necessary

    • Ensure the button is styled appropriately within the component's layout.

References

/packages/twenty-front/src/modules/workspace/components/WorkspaceInviteLink.tsx /packages/twenty-front/src/modules/settings/developers/components/ApiKeyInput.tsx /packages/twenty-front/src/pages/tasks/Tasks.tsx /packages/twenty-front/src/modules/activities/tasks/components/TaskRow.tsx

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/twentyhq/twenty/main) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)
Bonapara commented 1 week ago

Hi @mipmip, that sounds like a good idea! I think we need to release the action menu first to start working on this one.

FelixMalfait commented 21 hours ago

This would be great yes. This is linked to a bigger refactoring. Tasks should become standard objects like any others. @Bonapara has made designs for that already, relying on the standard table view and standard show page to display tasks, but this requires a significant amount of work.

mipmip commented 20 hours ago

This would be great yes. This is linked to a bigger refactoring. Tasks should become standard objects like any others. @Bonapara has made designs for that already, relying on the standard table view and standard show page to display tasks, but this requires a significant amount of work.

Sounds good. And notes too,I hope.