Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/(auth)/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { z } from "zod";

import { queries } from "@/entities";
import { signIn, Role, type UserInfo, setLocalUserInfo } from "@/entities/user";
import { registerFcmTokenToServer, retryPendingDeactivate } from "@/shared/lib/fcm";
import { registerFcmTokenToServer, retryPendingDeactivate } from "@/entities/fcm";
import { Button } from "@/shared/ui/buttons";
import { LoginInput } from "@/shared/ui/input";

Expand Down
2 changes: 1 addition & 1 deletion app/(tabs-care)/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ActivityIndicator, Alert, Text, View } from "react-native";

import { queries } from "@/entities";
import { removeLocalUserInfo } from "@/entities/user";
import { deactivateFcmTokenFromServer } from "@/shared/lib/fcm";
import { deactivateFcmTokenFromServer } from "@/entities/fcm";
import { Button, GradientBanner, Icon, MainHeader, MainLayout } from "@/shared/ui";

export default function AccountScreen(
Expand Down
2 changes: 1 addition & 1 deletion app/(tabs-care)/diary-list/analysis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ScrollView, Text, View } from "react-native";

import { queries } from "@/entities";
import { Role } from "@/entities/user";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/shared/lib/emotions";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/widgets/statistics";
import { BackHeader, HelpButton, MainLayout } from "@/shared/ui";

export default function DiaryAnalysisScreen() {
Expand Down
3 changes: 2 additions & 1 deletion app/(tabs-care)/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useState } from "react";
import { RefreshControl, ScrollView, Text, TouchableOpacity, View } from "react-native";

import { queries } from "@/entities";
import { emotionKorMap, EmotionIconComponent, MonthlyFrequencyStatistics, WeeklyStatistics } from "@/shared/lib/emotions";
import { emotionKorMap, EmotionIconComponent } from "@/shared/lib/emotions";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/widgets/statistics";
import { Footer, GradientBanner, MainHeader, MainLayout, RingButton } from "@/shared/ui";
import { Icon } from "@/shared/ui/svg";

Expand Down
2 changes: 1 addition & 1 deletion app/(tabs-care)/report.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { queries } from "@/entities";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/shared/lib/emotions/components";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/widgets/statistics";
import { Footer, MainHeader, MainLayout } from "@/shared/ui";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
Expand Down
2 changes: 1 addition & 1 deletion app/(tabs-user)/account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ActivityIndicator, Alert, Text, View } from "react-native";

import { queries } from "@/entities";
import { removeLocalUserInfo } from "@/entities/user";
import { deactivateFcmTokenFromServer } from "@/shared/lib/fcm";
import { deactivateFcmTokenFromServer } from "@/entities/fcm";
import { Button, HelpButton, Icon, MainHeader, MainLayout } from "@/shared/ui";

export default function AccountScreen() {
Expand Down
6 changes: 4 additions & 2 deletions app/(tabs-user)/chat-list/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ import {
} from "react-native";

import { queries } from "@/entities";
import { getChatHistory, type ChatHistoryResponse, type ChatMessage } from "@/entities/chatbot";
import {
getChatHistory,
type ChatHistoryResponse,
type ChatMessage,
cleanupExpiredPendingChatMessages,
getPendingChatMessages,
removePendingChatMessage,
} from "@/shared/lib/chat-pending";
} from "@/entities/chatbot";
import { normalizeEmotion } from "@/shared/lib/emotions";
import { BackHeader, MainLayout } from "@/shared/ui";
import { ChatBubble, ChatInput, DiaryBottomSheet, VoiceMessageModal, VoicePlaybackModal } from "@/widgets/chat";
Expand Down
3 changes: 1 addition & 2 deletions app/(tabs-user)/chat-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import {
} from "react-native";

import { queries } from "@/entities";
import { type ChatSessionItem } from "@/entities/chatbot";
import { getPendingChatMessages } from "@/shared/lib/chat-pending";
import { type ChatSessionItem, getPendingChatMessages } from "@/entities/chatbot";
import { EmotionComponentWithText, normalizeEmotion } from "@/shared/lib/emotions";
import {
cleanupExpiredPendingSessions,
Expand Down
2 changes: 1 addition & 1 deletion app/(tabs-user)/diary-list/analysis.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { queries } from "@/entities";
import { Role } from "@/entities/user/api/schema";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/shared/lib/emotions/components";
import { MonthlyFrequencyStatistics, WeeklyStatistics } from "@/widgets/statistics";
import { BackHeader, HelpButton, MainLayout } from "@/shared/ui";
import { WeeklyStory } from "@/widgets/chat/report";
import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
Expand Down
2 changes: 1 addition & 1 deletion app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { SafeAreaProvider } from "react-native-safe-area-context";

import { queries } from "@/entities";
import { type UserInfo, Role, getLocalUserInfo } from "@/entities/user";
import { FcmProvider } from "@/shared/lib/fcm";
import { FcmProvider } from "@/entities/fcm";
import { useInAppUpdates } from "@/shared/lib/useInAppUpdates";

import "../index.css";
Expand Down
2 changes: 1 addition & 1 deletion entities/chatbot/api/schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emotion } from "@/entities/voices/api";
import { type Emotion } from "@/shared/types/emotion";

// Search API Types
export interface SearchRequest {
Expand Down
1 change: 1 addition & 0 deletions entities/chatbot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import { mergeQueryKeys } from "@lukemorales/query-key-factory";
import { chatbotQueries } from "./api";

export * from "./api";
export * from "./lib";
export const queries = mergeQueryKeys(chatbotQueries);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatMessage } from "@/entities/chatbot/api/schema";
import { type ChatMessage } from "../../api/schema";
import AsyncStorage from "@react-native-async-storage/async-storage";
import {
addPendingChatMessage,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChatMessage } from "@/entities/chatbot/api/schema";
import { type ChatMessage } from "../api/schema";
import AsyncStorage from "@react-native-async-storage/async-storage";

const CHAT_PENDING_KEY = "chat-pending-messages";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion entities/fcm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { mergeQueryKeys } from "@lukemorales/query-key-factory";
import { fcmQueries } from "./api";

export * from "./api";
export * from "./lib";
export const queries = mergeQueryKeys(fcmQueries);

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProcessManager } from '@/shared/util/process';
import { ProcessManager } from "@/shared/util/process";
import messaging from '@react-native-firebase/messaging';
import { type EventSubscription } from 'expo-modules-core';
import * as Notifications from 'expo-notifications';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { registerFcmToken } from "@/entities/fcm/api";
import { registerFcmToken } from "../api";
import AsyncStorage from "@react-native-async-storage/async-storage";
import Constants from "expo-constants";
import * as Notifications from "expo-notifications";
Expand Down Expand Up @@ -95,7 +95,7 @@ export const deactivateFcmTokenFromServer = async (
username: string
): Promise<{ success: boolean; error?: Error }> => {
try {
const { deactivateFcmToken } = await import("@/entities/fcm/api");
const { deactivateFcmToken } = await import("../api");
const deviceId = await getStoredDeviceId();

await deactivateFcmToken({
Expand Down
13 changes: 4 additions & 9 deletions entities/voices/api/schema.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
import { type Emotion } from "@/shared/types/emotion";

export type { Emotion };

// Common file type for React Native FormData
export interface RNFileParam {
uri: string;
type: string;
name: string;
}

export type Emotion =
| "unknown"
| "surprise"
| "neutral"
| "happy"
| "sad"
| "anxiety"
| "angry";
// Upload voice with question (multipart/form-data + optional username query)
export interface UploadVoiceWithQuestionRequest {
file: RNFileParam;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emotion } from "@/entities/voices/api/schema";
import { type Emotion } from "@/shared/types/emotion";
import { cn } from "@/shared/util/style";
import React from "react";
import { Text, View } from "react-native";
Expand Down
2 changes: 1 addition & 1 deletion shared/lib/emotions/components/EmotionIconComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emotion } from "@/entities/voices/api/schema";
import { type Emotion } from "@/shared/types/emotion";
import { Icon } from "@/shared/ui/svg";
import React from "react";

Expand Down
2 changes: 0 additions & 2 deletions shared/lib/emotions/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
export * from "./EmotionComponentWithText";
export * from "./EmotionIconComponent";
export * from "./MonthlyFrequencyStatistics";
export * from "./WeeklyStatistics";
2 changes: 1 addition & 1 deletion shared/lib/emotions/constant.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emotion } from "@/entities/voices/api/schema";
import { type Emotion } from "@/shared/types/emotion";
export const emotionKorMap: Record<Emotion | "unknown", string> = {
happy: "즐거움",
neutral: "안정",
Expand Down
2 changes: 1 addition & 1 deletion shared/lib/emotions/mock.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emotion } from "@/entities/voices/api/schema";
import { type Emotion } from "@/shared/types/emotion";

export const emotionCharacteristics: Record<Emotion, string[]> = {
unknown: ["데이터가 없습니다."],
Expand Down
2 changes: 1 addition & 1 deletion shared/lib/emotions/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emotion } from "@/entities/voices/api/schema";
import { type Emotion } from "@/shared/types/emotion";
export const normalizeEmotion = (raw?: string | null): Emotion | null => {
if (!raw) return null;
const v = String(raw).trim().toLowerCase();
Expand Down
2 changes: 1 addition & 1 deletion shared/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./fcm";

1 change: 0 additions & 1 deletion shared/lib/session-pending/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from "./session-pending-storage";
export * from "./useSessionPending";
8 changes: 8 additions & 0 deletions shared/types/emotion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export type Emotion =
| "unknown"
| "surprise"
| "neutral"
| "happy"
| "sad"
| "anxiety"
| "angry";
1 change: 1 addition & 0 deletions shared/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./emotion";
2 changes: 1 addition & 1 deletion widgets/chat/model/useSendMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
cleanupExpiredPendingChatMessages,
getPendingChatMessages,
removePendingChatMessage,
} from "@/shared/lib/chat-pending";
} from "@/entities/chatbot";

type SendMessageOptions = {
sessionId: string;
Expand Down
1 change: 1 addition & 0 deletions widgets/statistics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./ui";
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { useQuery } from "@tanstack/react-query";
import React, { useCallback, useMemo, useState } from "react";
import { ActivityIndicator, Text, TouchableOpacity, View } from "react-native";

import { queries } from "@/entities";
import type { MonthlyFrequencyResponse as CareMonthlyFrequencyResponse } from "@/entities/care/api/schema";
import { Role } from "@/entities/user/api/schema";
import type { MonthlyFrequencyResponse as UserMonthlyFrequencyResponse } from "@/entities/user/api/schema";
import type { Emotion } from "@/entities/voices/api/schema";
import {
emotionKorMap,
emotionRawColorMap,
} from "@/shared/lib/emotions/constant";
import { emotionKorMap, emotionRawColorMap, toPercent } from "@/shared/lib/emotions";
import { type Emotion } from "@/shared/types/emotion";
import { formatYearMonth } from "@/shared/util/format";
import { useQuery } from "@tanstack/react-query";
import React, { useCallback, useMemo, useState } from "react";
import { ActivityIndicator, Text, TouchableOpacity, View } from "react-native";
import { toPercent } from "../util";

const EMOTIONS_FOR_BAR: Emotion[] = [
"happy",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { useQuery } from "@tanstack/react-query";
import { useFocusEffect } from "@react-navigation/native";
import React, { useCallback, useMemo, useState } from "react";
import { ActivityIndicator, Text, TouchableOpacity, View } from "react-native";

import { queries } from "@/entities";
import type { WeeklySummaryResponse as CareWeeklySummaryResponse } from "@/entities/care/api/schema";
import { Role } from "@/entities/user/api/schema";
import type { WeeklySummaryResponse as UserWeeklySummaryResponse } from "@/entities/user/api/schema";
import { Emotion } from "@/entities/voices/api/schema";
import { EmotionIconComponent, normalizeEmotion, toPercent } from "@/shared/lib/emotions";
import { type Emotion } from "@/shared/types/emotion";
import {
formatDateRange,
formatYearMonth,
getWeekOfMonth,
getWeekRange,
} from "@/shared/util/format";
import { cn } from "@/shared/util/style";
import { useFocusEffect } from "@react-navigation/native";
import { useQuery } from "@tanstack/react-query";
import React, { useCallback, useMemo, useState } from "react";
import { ActivityIndicator, Text, TouchableOpacity, View } from "react-native";
import { normalizeEmotion, toPercent } from "../util";
import { EmotionIconComponent } from "./EmotionIconComponent";

const WEEK_DAYS = ["일", "월", "화", "수", "목", "금", "토"] as const;
const WEEKDAYS_ORDER: number[] = [0, 1, 2, 3, 4, 5, 6];
Expand Down
2 changes: 2 additions & 0 deletions widgets/statistics/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./WeeklyStatistics";
export * from "./MonthlyFrequencyStatistics";