-
Notifications
You must be signed in to change notification settings - Fork 126
[C-4872, C-4993, QA-1538] Add ComposerInput component and update comments and DMs to user the input #9638
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
Conversation
|
|
Preview this change https://demo.audius.co/kj-Update-chat-composer-for-comments |
|
Preview this change https://demo.audius.co/kj-Update-chat-composer-for-comments |
| return str.replace(specialChars, '\\$&') | ||
| } | ||
|
|
||
| export type LinkEntity = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This union type is nice! I dig the readability
| export type LinkEntity = | ||
| | { | ||
| link: string | ||
| type: 'track' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be an enum; could maybe use EntityType?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea i was thinking of using Kind here, but seemed like overkill
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we decided to stop using enums as much and prefer plain strings? down to debate again, but that pattern seems to be the standard
| const clearLinks = useCallback(() => { | ||
| setTrackId(null) | ||
| setCollectionId(null) | ||
| }, [setTrackId, setCollectionId]) | ||
|
|
||
| /** | ||
| * Updates the track id and/or collection id state if found in matching text | ||
| */ | ||
| useEffect(() => { | ||
| for (const [human, { data }] of Object.entries(humanToData)) { | ||
| if (value.includes(human)) { | ||
| if (instanceOfTrack(data)) { | ||
| setTrackId(decodeHashId(data.id)) | ||
| } else if (instanceOfPlaylist(data)) { | ||
| setCollectionId(decodeHashId(data.id)) | ||
| } | ||
| return | ||
| } | ||
| } | ||
| setTrackId(null) | ||
| setCollectionId(null) | ||
| }, [trackId, humanToData, value]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No context here; curious why these were removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the trackId and collectionId state was very specific to DMs so replaced it with a more general linkEntities state
| isEdit?: boolean | ||
| } | ||
|
|
||
| // TODO: KJ - There is a bit of hacky-ness here with the input. It does not actually work with the form so the form can probably be taken out |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 thats annoying; I'd be curious why it doesnt work with a form but its not really much of an issue since we can easily work around it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the useField hook from formik passes some props to the textarea normally and controls the value of the input, but that doesn't work well with the current setup of the composer input. It could probably be updated to work better with the form, but I didn't want to spend too much time on it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah that makes sense. No I agree that its totally fine to ignore; the only real reason I included a form here was for accessibility and out of the box enter->submit keyboard behavior. Easy to make sure we solve for those without a form tho
| ) | ||
|
|
||
| const handleSubmit = ({ commentMessage }: CommentFormValues) => { | ||
| if (!commentMessage) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated note (mainly for myself); if a reply comment input is an empty message we should probably trigger it to close
| @@ -0,0 +1,363 @@ | |||
| import { ChangeEvent, useCallback, useEffect, useRef, useState } from 'react' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any big changes in here to highlight from the composer component from before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly the bullet points in the PR description. Lots of small updates to how the link detections are handled and things like that. It's basically an updated version of what was in the ChatComposer component previously
| } | ||
|
|
||
| const { data, status } = useGetSearchResults(params, { | ||
| debounce: 500, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
500 seems like a lot tbh but also maybe thats just right? Looking forward to playing around with it and seeing how it feels!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was from Ray's testing, but yea it doesn't feel that long when typing unless you're trying really quick
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my 500ms was to make it feel like something was happening when things were already cached in the link unfurl. not sure if we need any debounce here. iiuc, this just searches as you're typing? Or was this value lifted from search autocomplete?
DejayJD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets brainstorm on the status Popup issue some more but I think otherwise this is looking good!
Definitely want to wait for @raymondjacobson to take a look before merging tho
raymondjacobson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JD's feedback is more valuable than mine! but nothing jumps out to me as blocking except for 1 q. looking forward to playing around w/ this
| export type LinkEntity = | ||
| | { | ||
| link: string | ||
| type: 'track' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we decided to stop using enums as much and prefer plain strings? down to debate again, but that pattern seems to be the standard
| const trackId = useMemo(() => { | ||
| const track = linkEntities.find((e) => e.type === 'track') | ||
| return track ? decodeHashId(track.data.id) : null | ||
| }, [linkEntities]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit newline
| } | ||
|
|
||
| const { data, status } = useGetSearchResults(params, { | ||
| debounce: 500, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my 500ms was to make it feel like something was happening when things were already cached in the link unfurl. not sure if we need any debounce here. iiuc, this just searches as you're typing? Or was this value lifted from search autocomplete?
|
Preview this change https://demo.audius.co/kj-Update-chat-composer-for-comments |
|
Preview this change https://demo.audius.co/kj-Update-chat-composer-for-comments |
[34d5a5a] [PAY-3213] ChatListBlastItem mobile UI (#9656) Reed [518f4d8] fix typecheck on main (#9669) Andrew Mendelsohn [f183d96] fix type for spl_usdc_payout_wallet on user adapter (#9667) Randy Schott [dab6070] [QA-1528] Move audius-query force ref tracking to useState (#9661) Andrew Mendelsohn [d9022cb] fix typecheck in ChatBlastSelectAudienceFields (#9668) Andrew Mendelsohn [cdb428a] [QA-1529] Add guard for -1 ids to audius-query api hooks (#9647) Andrew Mendelsohn [ec1dd85] [QA-1542] Fix mobile top supporters crashing profile page (#9646) Andrew Mendelsohn [7f49a62] [PAY-3416] Adds v1 account endpoint (#9651) Randy Schott [807d569] [C-5009] Add debug theme (#9611) Dylan Jeffers [9f75690] [C-5005] Add comment counts (#9630) Dylan Jeffers [dc74998] [C-4872, C-4993, QA-1538] Add ComposerInput component and update comments and DMs to user the input (#9638) Kyle Shanks [2bec1f2] [PAY-3420] Update styles on checkout UI (#9649) Raymond Jacobson [d90eeac] [QA-1545] Fix cover art size on album search results (#9654) Raymond Jacobson [842a762] Set audienceContentType=track for remix chat blasts (#9655) Reed [0e6b44e] [C-4975] Comments pagination (#9633) JD Francis [85fe0e7] Display audience counts in chat blast items (#9640) Reed [8236a47] [PAY-3401] Consolidate pay with anything tx (#9645) Raymond Jacobson [f897d8f] [PAY-3411] Enable monetization for everyone when network cut is enabled (#9644) Marcus Pasell [0902048] Add stems api for v1 (#9513) Raymond Jacobson [d04bf16] [C-4956] Add mobile comments sort ui (#9637) Sebastian Klingler [b915249] Fix purchasers count in chat blast modal (#9639) Reed [adf2207] [PAY-3370] Always use encoded content IDs in chats (#9636) Reed [53fe54e] [PAY-3388] Migrate feed to SDK (#9593) Randy Schott [59435ae] Show content title in chat blast item (#9627) Reed [824fc47] [C-4752] Reduce border width for small Avatar (#9612) Dylan Jeffers [fa9b498] [C-4952] Mobile comment overflow action confirmations (#9622) Sebastian Klingler [065e8b8] [PAY-3408][PAY-3409][PAY-3408][PAY-3405][PAY-3413] Update Sales/Purchase Modal (#9624) Marcus Pasell [04f810a] [PAY-3404] Fix floor() for negative numbers that are already floored (#9623) Marcus Pasell [fdc7cf3] Fix purchasing without network split (#9629) Marcus Pasell [682e7d4] [PAY-3410][PAY-3406] Update Sales Table help link and "Value" => "Total" (#9625) Marcus Pasell [2e621bb] [QA-1439] Don't block gated tracks from being remixes (#9620) Andrew Mendelsohn [cb753b3] [C-5008] Add single and multi lineHeight options to Text (#9610) Dylan Jeffers [11911da] [PAY-3378] Disable blast audiences radios with no recipients (#9619) Reed [826d3ae] Only add blasts to store for sender (#9617) Reed [661cca7] [PAY-3206] Populate content targeting dropdowns for blast modal (web) (#9601) Andrew Mendelsohn [f365f01] Add support for expand rounding mode to FixedDecimal (#9606) Marcus Pasell [d6344cb] Fix web external-text-link style propagation (#9609) Dylan Jeffers [90b3b41] [PAY-3324] Add copy notice around network take rate (#9608) Marcus Pasell [d876547] Release mobile apps to 113 (#9614) Dylan Jeffers [e9091d8] [C-5001] Add comment disabling for tracks (#9594) Dylan Jeffers [66b1e99] Fix broken common tests (#9605) Marcus Pasell
Description
Lots of changes. I'll run through the PR and make comments in weird spots, but for the most part this PR covers this stuff:
How Has This Been Tested?
Lots of manual testing on local stack against staging and prod