mattermost-mobile/app/components
Daniel Espino García e2e54b3bca
[Gekidou MM-39733] Port Create Channel from V1 (#6067)
* copy directly from v1. will get working and then convert class to functional components

* screen showing up correctly.  Need to convert lifestyle methods

* create channel button working

* save before refactor in prep for bringing in edit_channel functionality

* change function naming

* clean up lint

* clean up for PR review

* clean up for PR review

* remove hoardcoded styles

* add edit_channel screen

* add handlePatchChannel

* add custom useFormInput hook. use edit screen for both create and edit screens. edit or create screen mode determined by channel prop passed in as a channel or null

* rename edit_channel to create_or_edit_channel

* displayname, header, and purpose are now an object with value and onChange props, created from the useFormInput hook. Now only need to pass this new FormInput Prop to the edit_channel_info component and deconstruct there to get the onChange and value

* fix some lint errors

* fix some lint errors

* remove empty line

* pass intl into utils validate functions because they are not Hooks.  add validation for displayName including translations.

* Move useFormInput hook to its own hooks file and import

* simplify

* remove editing prop.  Was used to determine if the right button was enabled. It was always true for edit_channel screen and always false for create channel screen.  The enableRightButton prop call back is was also used for the same reason.

* remove channeUrl editing references.  This was not implemented on v1

* pass editing prop back into component and add back logic. When editing one field must change.  when creating, just need to check that name is provided

* lint fixes

* fix typing issue for channel types

* scrolling ref should be fixed.  Linting should pass now

* Linting should pass now

* require id field in partial Channel. fixes tsc

* remove everything related to renaming the channel URL.  This has never been requred for mobile

* manage state with useReducer so that all actions/state in one location. This also removes the number of onXXX functions and reduces the number of functions in the component

* reorganize code. useEffects are at top.  Move type and interfaces outside of function component

* Fix lint

* nit: invert if statement checking a negative

* use cneterChannelColor. in figma this is center channel text, but I verified theme color by comparing to SSO login text color

* Simple snapshot tests as a start

* Add more tests

* update snapshot

* add snapshot tests. Add tests for button enabling and disabling

* simplify test with destructuring.

* PR feedback. formatting changes. get user and teamid from one call

* remove FormInput hook and use value/setvalue convention for controlled components

* no need to setChannelDisplayName after creating/updating channel

* Just pass the setXXX function.  Don't need to create as separate callback

* modify floatingTextInput component to allow placeholder text

* remove InteractionManager. PR nits

* mv EditChannelComponent into create_or_edit screen.  Rename component from EditChannelInfo to ChannelInfoForm

* correct import path

* add IntlShape Type to function input. Wrap screen with withServerDatabase, not withIntl

* remove state setting function calls from inside the reducer.  move close function outside of the component. remove setRightButton and rightButton and place rightbutton in initial appState

* move editing const after useX oneliners and before useCallback, useEffect, and useReducers

* rightButton
  - useMemo to memoize an object with dependencies
  - move out of the appState
emitCanSaveChannel
  - wrap with useCallback
onCreateChannel
  - wrap with useCallback
onUpdateChannel
  - wrap with useCallback
useEffect Navigation
  - use the callbacks as dependencies in stead of the depencies of those
    callbacks.

* wrap all formatted message with useMemo()
wrap all onXXXChangeText with useCallback and add deps
move all oneliner derived constants directly after useState useMemo

* remove useMemo from formatted text

* switchToCHannel is still not working.  failing at
  const channel: ChannelModel = await member.channel.fetch();

* use prepareMyChannelsForTeam to update db tables for new channel

* add placeholder text color

* Attach open edit channel screen to `Set Header` button in channel intro view
port SectionItem from V1 and us to add a Switch for setting private/public channel
hook up the plus icon in the channel list header to create a channel (temporary fix to allow debugging)
add new queryChannelsInfoById and queryCurrentChannelInfo query functions
update text for create screen text inputs

* Fix styles and fix actions

* Add autocomplete, fix patch, and address design feedback

* Address feedback

* Add margin between icon and label on Make Private

* Address feedback

* Address feedback

* Address feedback and fix channel list not updating when the channel gets created

* Address feedback and directly add the channel to the default category

* Render at-mentions as Members if no channelId is set

* Display autocomplete on iOS

Co-authored-by: Jason Frerich <jason.frerich@mattermost.com>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2022-03-31 10:06:02 +02:00
..
app_version update snapshot 2021-12-14 11:57:14 +02:00
autocomplete [Gekidou MM-39733] Port Create Channel from V1 (#6067) 2022-03-31 10:06:02 +02:00
autocomplete_selector [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
badge Detox/E2E: Migrate e2e javascript to typescript (#6059) 2022-03-17 17:35:26 -07:00
channel_icon [Gekidou] Address performance improvements on team switch action (#6101) 2022-03-30 08:05:31 -03:00
channel_list [Gekidou MM-39733] Port Create Channel from V1 (#6067) 2022-03-31 10:06:02 +02:00
compass_icon [Gekidou] compass icons (#5940) 2022-02-08 16:16:30 -03:00
custom_status [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
emoji [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
emoji_picker [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
error_text MM-41991 Gekidou Edit Post Screen (#6016) 2022-03-12 17:22:24 -03:00
floating_text_input_label [Gekidou MM-39733] Port Create Channel from V1 (#6067) 2022-03-31 10:06:02 +02:00
formatted_date [Gekidou] post list (#5893) 2022-01-17 07:06:26 -03:00
formatted_markdown_text [Gekidou] Markdown and Touchables (#6047) 2022-03-14 16:32:06 -03:00
formatted_text Gekidou fixes (#5748) 2021-10-13 14:13:39 -03:00
formatted_time [Gekidou] post component tree and partial postList (#5637) 2021-09-06 08:22:55 -03:00
freeze_screen [Gekidou] Gallery (#6008) 2022-03-01 13:55:44 -03:00
jumbo_emoji [Gekidou] post list (#5893) 2022-01-17 07:06:26 -03:00
loading Gekidou servers (#5960) 2022-02-14 16:39:29 -03:00
markdown Update dependencies 2022-03-26 20:33:13 -03:00
menu_item MM-41602 Gekidou long press menu UI only (#5950) 2022-02-14 17:26:16 -03:00
navigation_header Performance improvements on Home to Channel (#6106) 2022-03-31 10:01:22 +02:00
post_draft Performance improvements on Home to Channel (#6106) 2022-03-31 10:01:22 +02:00
post_list Performance improvements on Home to Channel (#6106) 2022-03-31 10:01:22 +02:00
post_with_channel_info Update dependencies 2022-03-26 20:33:13 -03:00
profile_picture Handle system ephemeral post 2022-03-24 19:24:54 -03:00
progress_bar [Gekidou] Post input (#5844) 2022-02-03 08:59:15 -03:00
progressive_image [Gekidou] Gallery (#6008) 2022-03-01 13:55:44 -03:00
search [Gekidou] post list (#5893) 2022-01-17 07:06:26 -03:00
search_bar Gekidou - Account Screen (#5708) 2021-10-12 19:24:24 +04:00
section_item [Gekidou MM-39733] Port Create Channel from V1 (#6067) 2022-03-31 10:06:02 +02:00
server_icon Detox/E2E: Migrate e2e javascript to typescript (#6059) 2022-03-17 17:35:26 -07:00
server_version [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
slide_up_panel_item [Gekidou] [MM-39717] Add Channel Browser screen (#5868) 2022-02-10 12:45:07 +01:00
status_label Gekidou - Account Screen (#5708) 2021-10-12 19:24:24 +04:00
system_avatar [Gekidou] post list (#5893) 2022-01-17 07:06:26 -03:00
system_header [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
tablet_title MM-39710: saved posts screen and DB (#6020) 2022-03-12 16:40:24 -03:00
tag Corrects SemiBold to Semibold (#5903) 2022-01-20 09:28:08 -03:00
team_sidebar [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
toast [Gekidou] Extract common observers to queries (#5984) 2022-03-23 09:19:29 -03:00
touchable_with_feedback [Gekidou] - Custom navigation header (#5820) 2021-11-10 10:16:58 -03:00
tutorial_highlight Gekidou MultiServers second part (#5963) 2022-02-17 10:42:06 -03:00
user_item Merge branch 'gekidou' into gekidou-reactions 2022-03-23 09:52:09 -03:00
user_list_row [Gekidou] [MM-39718] Add Create DM screen (#5900) 2022-03-11 12:57:31 -03:00
user_status Add import order lint rules (#5672) 2021-09-13 10:18:03 +02:00