Skip to content

Commit

Permalink
feat: 리뷰 생성 통신 핸들러 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
sikkzz committed Feb 7, 2025
1 parent 3756fcc commit ba4a02a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
15 changes: 10 additions & 5 deletions src/components/SelectStyle/SelectStyle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { useState } from "react";

import classNames from "classnames";

import { AppBridgeMessageType } from "@/components/provider/AppBridgeProvider/AppBridgeMessage.types";
import { useAppBridge } from "@/components/provider/AppBridgeProvider/AppBridgeProvider";
import styles from "@/components/SelectStyle/SelectStyle.module.scss";
import Button from "@/components/ui/Button/Button";
import Icon from "@/components/ui/Icon/Icon";
import Text from "@/components/ui/Text/Text";

import { useRoute } from "@/hooks/common/useRoute";

import { useCreateReviewStore } from "@/store/useReviewStore";

interface StyleProps {
Expand All @@ -24,12 +24,14 @@ const IMG_STYLE_DATA = [
];

const SelectStyle = () => {
const { navigateToReviewResult } = useRoute();
const { send } = useAppBridge();

const { setReviewStyle } = useCreateReviewStore();
const { createReviewData, setReviewStyle } = useCreateReviewStore();

const [selectedStyle, setSelectedStyle] = useState(IMG_STYLE_DATA[0]);

const { ocrText, hashTag, reviewStyle } = createReviewData;

const handleStyleClick = (style: StyleProps) => {
setSelectedStyle((prevStyle) => (prevStyle.name === style.name ? IMG_STYLE_DATA[0] : style));
};
Expand All @@ -39,7 +41,10 @@ const SelectStyle = () => {
setReviewStyle(selectedStyle.name);
}

navigateToReviewResult();
send({
type: AppBridgeMessageType.CREATE_REVIEW,
payload: { ocrText, hashTag, reviewStyle },
});
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export interface CreateReviewMessage {
type: AppBridgeMessageType.CREATE_REVIEW;
payload: {
ocrText: string;
hastTag: string[];
reveiwStyle: string;
hashTag: string[];
reviewStyle: string;
};
}

Expand Down
2 changes: 0 additions & 2 deletions src/hooks/common/useRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export const useRoute = () => {
navigateToHome: () => navigate(PATH.HOME),
navigateToBack: () => navigate(-1),
navigateToReceiptEdit: () => navigate(PATH.RECEIPT_EDIT),
navigateToRecognitionFail: () => navigate(PATH.RECOGNITION_FAIL),
navigateToReviewResult: () => navigate(PATH.REVIEW_RESULT),
navigateToSelectStyle: () => navigate(PATH.SELECT_STYLE),
navigateToSelectTag: () => navigate(PATH.SELECT_TAG),
};
Expand Down

0 comments on commit ba4a02a

Please sign in to comment.