Commit Graph
2425 Commits
Author SHA1 Message Date
Sivin VargheseandGitHub ba6d291e3b Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-22 10:30:45 +05:30
iamsivin 7eac4f241b chore: Fix build 2024-11-22 09:37:23 +05:30
Sivin VargheseandGitHub 137f5616bd Merge branch 'develop' into feat/contacts-redesign 2024-11-22 09:28:44 +05:30
iamsivin f375d962ab chore: Minor fix 2024-11-22 09:28:15 +05:30
iamsivin 7c94da3bc3 Revert "feat: Add Label Input components (#10480)" This reverts commit 2dae4b22a2. 2024-11-22 09:26:32 +05:30
Sivin VargheseandGitHub 6b5b53a722 chore: Fix code climate 2024-11-22 09:09:53 +05:30
0f659224a7 feat: async update of article [CW-3721] (#10435)
### The problem

Writing in the text editor can be very frustrating, the reason is that
the editor had a debounced save method which would push the article to
the backend and update the current state. This however is a bad idea,
since the can take anywhere between 100-300ms depending on network
conditions.

While this would be in progress, the article is still being edited by
the user. So at the end of the network request, the state returned from
the backend and the current state in the editor is diverged. But since
the update happens anyway, the editor would prepend older context.

```
Time   --> 

User Action:      [Edit 1] ---> [Edit 2] ---> [Edit 3]
Backend Save:           Save Req (Edit 1) ----> Response (Edit 1)
Resulting Editor State: [Edit 3] + [Edit 1] (Outdated state prepended)
```

### The solution

The solution is to unbind the article from the backend state, ensuring
that the article editor is the source of truth and ignoring the
responses. This pull request does this by adding an asynchronous save
functionality. The changes include adding a new `saveArticleAsync` event
and ensuring that the local state is not updated unnecessarily during
asynchronous saves.

```
Time   --> 

User Action:      [Edit 1] ---> [Edit 2] ---> [Edit 3]
Backend Save:           Save Req (Edit 1) ----> Response (ignored)
Resulting Editor State: [Edit 3] (Consistent and up-to-date)
```

Added the following two debounced methods

These complementary debounce methods prevent unnecessary re-renders
while ensuring backend is in sync. `saveArticleAsync` preserves the
editor as the source of truth, while `saveArticle` manages periodic
state updates from the backend with a delay large enough to safely
assume that the user has stopped typing
Method | Delay | Behavior
-- | -- | -- 
`saveArticleAsync` | 400ms | Sends data to backend and ignores the
response
`saveArticle` | 2.5s | Sends data and updates local state with the
backend response

### How to test

1. Remove the following line
https://github.com/chatwoot/chatwoot/blob/dc042f6ddcb4e108795ff83bb57f8d92c6a2b90a/app/javascript/dashboard/components-next/HelpCenter/Pages/ArticleEditorPage/ArticleEditor.vue#L64
1. Update the latency here to 400 (P.S. the diff shows the latency to be
600, but that was added as a stop-gap solution)

https://github.com/chatwoot/chatwoot/blob/dc042f6ddcb4e108795ff83bb57f8d92c6a2b90a/app/javascript/dashboard/components-next/HelpCenter/Pages/ArticleEditorPage/ArticleEditor.vue#L51
1. Set the browser network latency to Slow 3G or 3G
1. Start writing on the editor, try fixing typos with backspace or
moving around with the cursor

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: Pranav <pranav@chatwoot.com>
2024-11-21 19:38:08 -08:00
Sivin VargheseandGitHub 4156881dec Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-22 09:04:27 +05:30
iamsivin 93d1e2a032 chore: Update contact card with company name 2024-11-22 09:03:46 +05:30
iamsivin ca05be1c1a chore: Decamelize keys on contact update 2024-11-22 09:03:07 +05:30
Sivin VargheseandGitHub 7c09c42bde Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-22 08:13:07 +05:30
Sivin VargheseandGitHub ceaeba84ee Merge branch 'develop' into feat/contacts-redesign 2024-11-22 08:09:28 +05:30
Sivin VargheseandGitHub 2dae4b22a2 feat: Add Label Input components (#10480) 2024-11-21 13:57:43 -08:00
cf6ef11b9f feat: Add contact merge form component (#10478)
Co-authored-by: Pranav <pranavrajs@gmail.com>
2024-11-21 13:52:25 -08:00
497bc055a2 feat: Attributify button component (#10473)
This PR allows attributify for `variant`, `size` and `color` props. This allows using shorthands, instant of writing full props.

We also added a small computed method to ensure these does not show up
in the DOM and pollute it

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
2024-11-21 13:48:25 -08:00
Sivin VargheseandGitHub 79daf56c31 feat: Add contact note item component (#10479) 2024-11-21 13:47:57 -08:00
Sivin VargheseandGitHub 67fba33005 Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-21 22:55:50 +05:30
Sivin VargheseandGitHub 92190ec81b Merge branch 'develop' into feat/contacts-redesign 2024-11-21 22:55:36 +05:30
Sivin VargheseandGitHub 7b6195f28b fix: Component <woot-tabs /> reactivity issue. (#10476)
# Pull Request Template

## Description

This PR will fix reactivity issue with `<woot-tabs />` component.

**Cause of issue**
The `<woot-tabs />` component used an internal ref,
`internalActiveIndex` to track the `active` tab. However, it didn’t sync
with the `index` prop when updated by the parent, causing mismatched tab
selections.

**Solution**
The component now directly uses `props.index` to ensure it always
reflects the latest value from the parent. The unnecessary
`internalActiveIndex` ref has been removed. Changes to the active tab
emit a `change` event to update the parent.


## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)

## How Has This Been Tested?

**Loom video**

**Before**

https://www.loom.com/share/76eb32f1e7f7422f84055a102bf80951?sid=bc28c6ff-9640-4d3b-956c-99c1ec164971

**After**

https://www.loom.com/share/6bd8125ede5d43dc8fe115c3f1fb159b?sid=c376617a-94fb-4f71-8664-e0bd9e7af0b4

## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2024-11-21 16:25:13 +05:30
iamsivin 2d0c813300 chore: Minor fix 2024-11-21 15:54:01 +05:30
iamsivin 7083137c5a chore: Label components 2024-11-21 15:48:43 +05:30
iamsivin b9b3c43d63 feat: Contact note item component 2024-11-21 15:25:06 +05:30
iamsivin 2a724cad7c chore: Create contact merge component 2024-11-21 14:52:19 +05:30
iamsivin ef51083b3c chore: Minor fix 2024-11-21 13:34:42 +05:30
iamsivin edfb1029a7 chore: Minor fix 2024-11-21 12:43:54 +05:30
Sivin VargheseandGitHub 75cf5322c9 Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-21 12:12:03 +05:30
Sivin VargheseandGitHub 634a31a7ab Merge branch 'develop' into feat/contacts-redesign 2024-11-21 12:11:35 +05:30
iamsivin ee55e8e8ff chore: Minor fix 2024-11-21 10:58:09 +05:30
2309424cb1 feat: Add Contact card and form component (#10466)
Co-authored-by: Pranav <pranavrajs@gmail.com>
2024-11-20 21:18:25 -08:00
iamsivin 1a4f44555f chore: Minor fix 2024-11-21 10:37:20 +05:30
Shivam MishraandGitHub 3a334be582 feat: add channel icon component (#10471)
This pull request introduces a new `ChannelIcon` component and refactors the existing code to use this component, which simplifies the icon management for different channel types and providers.
2024-11-20 20:23:12 -08:00
iamsivin b919afa182 chore: Minor fix 2024-11-21 00:53:45 +05:30
Sivin VargheseandGitHub 189aa06fa3 Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-21 00:50:28 +05:30
iamsivin 257a5ccf83 chore: Minor fix 2024-11-21 00:42:01 +05:30
iamsivin e3f50da277 chore: Minor fix 2024-11-21 00:37:12 +05:30
iamsivin edcc15fab2 chore: Custom attributes story 2024-11-21 00:24:08 +05:30
iamsivin 525a979283 chore: Minor fix 2024-11-21 00:08:03 +05:30
iamsivin 7021a85da5 chore: Minor fix 2024-11-20 23:33:17 +05:30
Sivin VargheseandGitHub 93cd88253d Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-20 22:36:58 +05:30
iamsivin 2852f01026 chore: Minor fix 2024-11-20 22:34:49 +05:30
Sivin VargheseandGitHub 2538e161a2 Merge branch 'develop' into feat/contacts-redesign 2024-11-20 22:32:01 +05:30
Sivin VargheseandGitHub c3604bfcbf feat: New phone number input component (#10446) 2024-11-20 22:31:05 +05:30
iamsivin 6f4b37a6cd chore: Minor fix 2024-11-20 20:31:07 +05:30
Sivin VargheseandGitHub b9cb4cc65e Merge branch 'develop' into feat/contacts-redesign 2024-11-20 20:26:27 +05:30
Sivin VargheseandGitHub b0d6089bb6 feat: Updates on new components (#10444) 2024-11-20 20:21:35 +05:30
iamsivin e46d704573 chore: Minor fix 2024-11-20 17:03:50 +05:30
Sivin VargheseandGitHub 8f7589f173 Merge branch 'feat/contacts-redesign' into feat/compose-new-conversation 2024-11-20 08:15:51 +05:30
Sivin VargheseandGitHub 62f357fc7f Merge branch 'develop' into feat/contacts-redesign 2024-11-20 07:07:10 +05:30
759615d041 fix: Update the dropdown bg to match the design system (#10438)
This PR updates the background used in dropdown to match our design system. Previous PR failed to add this correctly.

---------

Co-authored-by: Pranav <pranav@chatwoot.com>
2024-11-19 14:29:45 -08:00
Sivin VargheseandGitHub a7e3d443c9 feat: Add the new select menu component (#10445) 2024-11-19 14:25:45 -08:00