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
31 changes: 16 additions & 15 deletions apps/portal-dashboard/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
import { useMemo } from "react";
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
} from "@remix-run/react";
import { useMemo } from "react";

import stylesheet from "portal-shared/tailwind.css?url";
import type { LinksFunction } from "@remix-run/node";
import stylesheet from "portal-shared/tailwind.css?url";

// Supports weights 200-800
import "@fontsource-variable/manrope";
import { createServiceProvider } from "@/dataProviders/serviceProvider";
import useUploader from "@/features/uploadManager/hooks/useUploader";
import { useAppInitialization } from "@/hooks/useAppInitialization";
import { SERVICE_ROUTE } from "@/routeConfig";
import { getResetServices } from "@/services/index";
import {
AuthProvider,
NotificationProvider,
type AuthProvider,
type NotificationProvider,
Refine,
ResourceProps,
type ResourceProps,
} from "@refinedev/core";
import { Toaster } from "portal-shared/components/ui/toaster";
import useSdk from "portal-shared/hooks/useSdk";
import routerProvider from "@refinedev/remix-router";
import { notificationProvider } from "portal-shared/dataProviders/notificationProvider";
import { getResetServices } from "@/services/index";
import useUploader from "@/features/uploadManager/hooks/useUploader";
import restDataProvider from "@refinedev/simple-rest";
import { Skeleton } from "portal-shared/components/ui/skeleton";
import { Toaster } from "portal-shared/components/ui/toaster";
import { createAccountProvider } from "portal-shared/dataProviders/accountProvider";
import { notificationProvider } from "portal-shared/dataProviders/notificationProvider";
import { useAuthProvider } from "portal-shared/hooks/useAuthProvider";
import { useAppInitialization } from "@/hooks/useAppInitialization";
import useSdk from "portal-shared/hooks/useSdk";
import { withTheme } from "portal-shared/hooks/useTheme";
import { Skeleton } from "portal-shared/components/ui/skeleton";
import restDataProvider from "@refinedev/simple-rest";
import { createServiceProvider } from "@/dataProviders/serviceProvider";
import { SERVICE_ROUTE } from "@/routeConfig";

export const links: LinksFunction = () => [
{ rel: "stylesheet", href: stylesheet },
{ rel: "icon", href: "/favicon.svg" },
];

export function Layout({ children }: { children: React.ReactNode }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import React, { useState, useEffect } from "react";
import {
useController,
Control,
FieldPath,
FieldValues,
} from "react-hook-form";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "portal-shared/components/ui/popover";
import type { GetListResponse } from "@refinedev/core";
import type { QueryObserverResult } from "@tanstack/react-query";
import { Check, ChevronsUpDown } from "lucide-react";
import { Button } from "portal-shared/components/ui/button";
import {
Command,
Expand All @@ -27,11 +18,20 @@ import {
FormMessage,
} from "portal-shared/components/ui/form";
import { Input } from "portal-shared/components/ui/input";
import { cn } from "portal-shared/lib/utils";
import { Check, ChevronsUpDown } from "lucide-react";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "portal-shared/components/ui/popover";
import { Skeleton } from "portal-shared/components/ui/skeleton";
import { GetListResponse } from "@refinedev/core";
import type { QueryObserverResult } from "@tanstack/react-query";
import { cn } from "portal-shared/lib/utils";
import React, { useState, useEffect } from "react";
import {
type Control,
type FieldPath,
type FieldValues,
useController,
} from "react-hook-form";

interface ComboBoxProps<TFieldValues extends FieldValues> {
name: FieldPath<TFieldValues>;
Expand Down Expand Up @@ -92,7 +92,7 @@ export function BillingAddressComboBox<TFieldValues extends FieldValues>({
role="combobox"
disabled={disabled || isLoading}
className={cn(
"w-full justify-between",
"w-full justify-between bg-secondary border border-input h-14",
!field.value && "text-muted-foreground",
)}>
{isLoading ? (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import useBillingInfo from "@/routes/account/hooks/useBillingInfo";
import useSubmitBillingInfo from "@/routes/account/hooks/useSubmitBillingInfo";
import { zodResolver } from "@hookform/resolvers/zod";
import { useList } from "@refinedev/core";
import { Button } from "portal-shared/components/ui/button";
import {
Card,
CardContent,
Expand All @@ -17,20 +19,19 @@ import {
FormMessage,
} from "portal-shared/components/ui/form";
import { Input } from "portal-shared/components/ui/input";
import { Textarea } from "portal-shared/components/ui/textarea";
import { Button } from "portal-shared/components/ui/button";
import { Skeleton } from "portal-shared/components/ui/skeleton";
import useBillingInfo from "@/routes/account/hooks/useBillingInfo";
import useSubmitBillingInfo from "@/routes/account/hooks/useSubmitBillingInfo";
import { Textarea } from "portal-shared/components/ui/textarea";
import React, { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { isValid } from "zod";
import { BillingAddressComboBox, type Entry } from "./BillingAddressComboBox";
import {
type BillingInfoFields,
type EntityCode,
type FieldName,
createBillingInfoSchema,
EntityCode,
FieldName,
fieldMapping,
BillingInfoFields,
} from "./BillingInformation.schema";
import { useList } from "@refinedev/core";
import { BillingAddressComboBox, Entry } from "./BillingAddressComboBox";

type FormFields = {
[K in keyof BillingInfoFields]: string;
Expand All @@ -47,7 +48,7 @@ export default function BillingInformation() {
const { data: countryData } = useCountryList();

const form = useForm<FormFields>({
resolver: zodResolver(createBillingInfoSchema(supportedEntities)),
resolver: zodResolver(createBillingInfoSchema([])),
defaultValues: {
name: "",
country: "",
Expand All @@ -71,6 +72,9 @@ export default function BillingInformation() {
],
});


console.log({ formState: form.formState, errors: form.formState.errors });

useEffect(() => {
if (billingInfo && !isInitialized) {
console.log("Billing info loaded:", billingInfo);
Expand All @@ -87,7 +91,7 @@ export default function BillingInformation() {
const entities = (selectedCountryData?.supported_entities ||
[]) as EntityCode[];
setSupportedEntities(entities);
form.reset(form.getValues(), { keepValues: true });
// form.reset(form.getValues(), { keepValues: true });
}, [form.watch("country"), countryData]);

const onSubmit = async (data: FormFields) => {
Expand Down Expand Up @@ -203,7 +207,7 @@ export default function BillingInformation() {
};

return (
<Card>
<Card className="bg-secondary/20">
<CardHeader>
<CardTitle>Billing Information</CardTitle>
</CardHeader>
Expand Down
Loading