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

feat: Added Form v2 support. #292

Merged
merged 48 commits into from
Jul 4, 2024
Merged

feat: Added Form v2 support. #292

merged 48 commits into from
Jul 4, 2024

Conversation

liamcho
Copy link
Contributor

@liamcho liamcho commented Jun 27, 2024

Ticket
CLNP-3932

Changelog

  • FormInput of FormMesage now supports two new MessageFormItem.style.layout types: chip and textarea

How to test?

  • in your local chat-js root, checkout feat/CLNP-3932-form-v2 branch. PR
  • run npm run build
  • pwd to find out your path
  • in your local widget project package.json, change resolution path to your path in above step.
  • run yarn dev
  • send message 'hi' to tirgger workflow.

Dashboard

  • If you want to test your own workflow, go to preprod dashboard
  • Create form -> create workflow -> attach workflow to the below bot.
    Screenshot 2024-07-01 at 3 01 40 PM
Updated UI

Updated UI

Screenshot 2024-07-02 at 10 04 49 PM Screenshot 2024-07-02 at 10 04 46 PM Screenshot 2024-07-02 at 10 04 41 PM Screenshot 2024-07-02 at 10 04 38 PM Screenshot 2024-07-02 at 10 03 47 PM Screenshot 2024-07-02 at 10 03 42 PM Screenshot 2024-07-02 at 10 03 30 PM

Figma link

https://www.figma.com/design/7XoO6XTg2hQvTM0wH3HDUk/2405_Forms_WIP?node-id=651-18703&m=dev

@liamcho liamcho requested a review from bang9 June 27, 2024 16:46
@liamcho liamcho self-assigned this Jun 27, 2024
@liamcho liamcho added the 1.7.2 label Jul 1, 2024
src/components/FormInput.tsx Outdated Show resolved Hide resolved
src/components/FormInput.tsx Outdated Show resolved Hide resolved
@liamcho liamcho requested a review from bang9 July 1, 2024 06:19
@liamcho liamcho force-pushed the feat/CLNP-3932-form-v2 branch from a186272 to 99d167e Compare July 1, 2024 12:11
@liamcho liamcho requested a review from bang9 July 2, 2024 04:59
src/components/FormInput.tsx Outdated Show resolved Hide resolved
src/components/FormInput.tsx Outdated Show resolved Hide resolved
src/components/FormInput.tsx Outdated Show resolved Hide resolved
@liamcho liamcho requested a review from bang9 July 2, 2024 13:28
@liamcho liamcho requested a review from bang9 July 2, 2024 13:39
src/components/FormInput.tsx Outdated Show resolved Hide resolved
@liamcho liamcho requested a review from bang9 July 3, 2024 06:39

const Chip = styled.div<ChipProps>`
border-radius: 100px;
padding: ${({ isSubmitted }) => (isSubmitted ? 6 : 5)}px 16px;
Copy link
Contributor

@bang9 bang9 Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요거는 혹시 왜 1px 사이즈가 달라지는걸까요?!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isSubmitted 인 chip 은 보더가 없습니다 그래서 그만큼 패딩을 늘리는 트릭입니다. 애초에 border 를 안쓰고 shadow 를 쓰면 이럴필요없었는데 생각이 짧았네요. 나중에 리펙토링하겠습니다

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uikit 뺄때 같이 작업

src/components/FormInput.tsx Outdated Show resolved Hide resolved
packages/uikit Outdated
Copy link
Contributor

@bang9 bang9 Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래 로직외에 추가로 enableFormTypeMessage && ~ 를 disabled 에 추가해주어야 합니다.

export const isDisabledBecauseSuggestedReplies = (channel: GroupChannel | null | undefined, enableSuggestedReplies: boolean) => {
  return enableSuggestedReplies && !!channel?.lastMessage?.extendedMessagePayload?.disable_chat_input;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enableFormTypeMessage 는 아직 위젯에서는 사용안하고 있습니다. 요거 추가한 이유가 나중에 위젯에서 uikit 으로 옮길때 필요해서입니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

참고로 위의 disabled 로직은 UIKit input 에 포함된 로직입니다. 위젯은 UIKit 의 input 을 사용하고 있습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵 아직 enableFormTypeMessage 요게 uikit 에 추가 안되서 요건 나중에 해야 할것 같아요. 지금 위젯에서 enableSuggestedReplies: true 설정이 있어서 문제 없을것 같습니다

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

placeholder string issue: Form -> Please choose one from above 🙅‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ 요거 배포 이후에 추가 작업 필요

@bang9 bang9 force-pushed the feat/CLNP-3932-form-v2 branch 4 times, most recently from 6823320 to 2b16274 Compare July 3, 2024 10:32
@bang9 bang9 force-pushed the feat/CLNP-3932-form-v2 branch from 2b16274 to a6e22f9 Compare July 3, 2024 10:40
Copy link

github-actions bot commented Jul 3, 2024

Size Change: +3.3 kB (+0.54%)

Total Size: 617 kB

Filename Size Change
./dist/__bundle-2aa1a987-********.js 2.63 kB +1 B (+0.04%)
./dist/__bundle-347d730c-********.js 4.01 kB +1 B (+0.02%)
./dist/__bundle-71248836-********.js 0 B -892 B (removed) 🏆
./dist/index-********.js 311 kB +1.78 kB (+0.58%)
./dist/index.es.js 171 B +1 B (+0.59%)
./dist/index.umd.js 290 kB +1.46 kB (+0.51%)
./dist/style.css 7.95 kB +54 B (+0.68%)
./dist/__bundle-b19a958d-********.js 891 B +891 B (new file) 🆕

compressed-size-action

Comment on lines 138 to 144
if (!item.isValid(values)) {
return ErrorMessages.invalid;
}
if (!isSubmitted && required && values.length === 0) {
return ErrorMessages.emptyRequired;
}
return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://sendbird.slack.com/archives/C0772Q0BB8Q/p1718703138150459?thread_ts=1718699602.122339&cid=C0772Q0BB8Q

요거에 따르면, 제출하지 않은 케이스에 대해서는 실시간으로 validate 하지 않는것 같은데
아래처럼 로직 바뀌어야 하나요?

if (isSubmitted) return null;
if (!item.isValid(values)) return ErrorMessages.invalid;
if (required && values.length === 0) return ErrorMessages.emptyRequired;
return null;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 isSubmitted 면 onChange 가 호출이 안될거라 불필요해 보이긴 합니다 isSubmitted만 지우면 될것 같아요. 반영했습니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디자이너 분과 실제 예상동작 더블체크하기

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@liamcho liamcho requested a review from bang9 July 3, 2024 15:19
@bang9 bang9 requested review from bang9 and AhyoungRyu July 4, 2024 00:34
@liamcho liamcho merged commit af9362c into develop Jul 4, 2024
5 checks passed
@liamcho liamcho deleted the feat/CLNP-3932-form-v2 branch July 4, 2024 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants