refactor(routes): move shared pages to global scope
This commit is contained in:
@@ -17,8 +17,11 @@ import {
|
||||
import { BackButton } from "@/app/_components";
|
||||
import { MobileShell } from "@/app/_components/core";
|
||||
import type { FeedbackCategory } from "@/data/schemas/feedback";
|
||||
import { useActiveCharacterRoutes } from "@/providers/character-provider";
|
||||
import { useAppNavigator } from "@/router/use-app-navigator";
|
||||
import {
|
||||
resolveGlobalRouteContext,
|
||||
type GlobalReturnToValue,
|
||||
} from "@/router/global-route-context";
|
||||
import { useGlobalAppNavigator } from "@/router/use-global-app-navigator";
|
||||
|
||||
import {
|
||||
FEEDBACK_IMAGE_ACCEPT,
|
||||
@@ -45,9 +48,13 @@ const CATEGORY_OPTIONS: readonly CategoryOption[] = [
|
||||
{ value: "other", label: "Other", icon: MessageCircleMore },
|
||||
];
|
||||
|
||||
export function FeedbackScreen() {
|
||||
const navigator = useAppNavigator();
|
||||
const characterRoutes = useActiveCharacterRoutes();
|
||||
export interface FeedbackScreenProps {
|
||||
returnTo?: GlobalReturnToValue;
|
||||
}
|
||||
|
||||
export function FeedbackScreen({ returnTo }: FeedbackScreenProps) {
|
||||
const navigator = useGlobalAppNavigator();
|
||||
const navigation = resolveGlobalRouteContext(returnTo);
|
||||
const form = useFeedbackSubmission();
|
||||
|
||||
if (form.feedbackId) {
|
||||
@@ -70,11 +77,11 @@ export function FeedbackScreen() {
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
data-analytics-key="feedback.back_to_chat"
|
||||
data-analytics-key="feedback.back_to_sidebar"
|
||||
className={styles.primaryButton}
|
||||
onClick={() => navigator.replace(characterRoutes.chat)}
|
||||
onClick={() => navigator.replace(navigation.sidebarUrl)}
|
||||
>
|
||||
Back to Chat
|
||||
Back to Sidebar
|
||||
</button>
|
||||
</section>
|
||||
</main>
|
||||
@@ -95,10 +102,10 @@ export function FeedbackScreen() {
|
||||
|
||||
<header className={styles.header}>
|
||||
<BackButton
|
||||
href={characterRoutes.chat}
|
||||
href={navigation.sidebarUrl}
|
||||
variant="soft"
|
||||
ariaLabel="Back to chat"
|
||||
analyticsKey="feedback.back_to_chat"
|
||||
ariaLabel="Back to sidebar"
|
||||
analyticsKey="feedback.back_to_sidebar"
|
||||
/>
|
||||
<div className={styles.headingBlock}>
|
||||
<h1 className={styles.title}>Help us improve CozSweet</h1>
|
||||
|
||||
Reference in New Issue
Block a user