Skip to content

Commit

Permalink
🐛 fix(api): Server and order
Browse files Browse the repository at this point in the history
  • Loading branch information
web-ppanel committed Nov 26, 2024
1 parent 229d36b commit 255bd82
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand Down
4 changes: 2 additions & 2 deletions apps/admin/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ NEXT_PUBLIC_SITE_URL=https://admin.ppanel.dev
NEXT_PUBLIC_API_URL=https://api.ppanel.dev

# Default Login User
NEXT_PUBLIC_DEFAULT_USER_EMAIL=support@ppanel.dev
NEXT_PUBLIC_DEFAULT_USER_PASSWORD=[email protected]
NEXT_PUBLIC_DEFAULT_USER_EMAIL=admin@ppanel.dev
NEXT_PUBLIC_DEFAULT_USER_PASSWORD=admin-password

# Please put in the .env file, otherwise the i18n command will not work
# OpenAI API key and proxy URL required for i18n command (optional)
Expand Down
8 changes: 7 additions & 1 deletion apps/admin/app/(auth)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export default function Page() {
<div className='flex lg:w-1/2 lg:flex-auto'>
<div className='flex w-full flex-col items-center justify-center px-5 py-4 md:px-14 lg:py-14'>
<Link className='mb-0 flex flex-col items-center lg:mb-12' href='/'>
<Image src={site.site_logo || '/favicon.svg'} height={48} width={48} alt='logo' />
<Image
src={site.site_logo || '/favicon.svg'}
height={48}
width={48}
alt='logo'
unoptimized
/>
<span className='text-2xl font-semibold'>{site.site_name}</span>
</Link>
<LoginIcon className='mx-auto hidden w-[275px] md:w-1/2 lg:block xl:w-[500px]' />
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/app/dashboard/server/node-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const shadowsocksSchema = z.object({
const vmessSchema = z.object({
host: z.string(),
port: z.number(),
enable_tls: z.boolean().nullable(),
enable_tls: z.boolean().nullish(),
tls_config: z.any().nullable(),
network: z.string(),
transport: z.any().nullable(),
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/app/dashboard/subscribe/subscribe-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ export default function SubscribeForm<T extends Record<string, any>>({
<FormControl>
<JSONEditor
title={t('form.description')}
value={field.value}
value={field.value && JSON.parse(field.value)}
onChange={(value) => {
form.setValue(field.name, value);
form.setValue(field.name, JSON.stringify(value));
}}
placeholder={{
description: 'description',
Expand Down
1 change: 1 addition & 0 deletions apps/admin/components/sidebar-left.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export function SidebarLeft({ ...props }: React.ComponentProps<typeof Sidebar>)
width={48}
height={48}
className='size-full'
unoptimized
/>
</div>
<div className='grid flex-1 text-left text-sm leading-tight'>
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/openapi2ts.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const config = [
{
requestLibPath: "import request from '@/utils/request';",
schemaPath: 'https://swagger.ppanel.dev/common.json',
schemaPath: 'https://docs.ppanel.dev/swagger/common.json',
serversPath: './services',
projectName: 'common',
},
{
requestLibPath: "import request from '@/utils/request';",
schemaPath: 'https://swagger.ppanel.dev/admin.json',
schemaPath: 'https://docs.ppanel.dev/swagger/admin.json',
serversPath: './services',
projectName: 'admin',
},
Expand Down
14 changes: 9 additions & 5 deletions apps/admin/services/admin/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ declare namespace API {
type CreateOrderRequest = {
user_id: number;
type: number;
quantity?: number;
price: number;
amount: number;
fee_amount: number;
discount?: number;
coupon?: string;
reduction?: number;
coupon_discount?: number;
fee_amount: number;
method?: string;
trade_no?: string;
status?: number;
Expand Down Expand Up @@ -529,12 +531,14 @@ declare namespace API {
user_id: number;
order_no: string;
type: number;
quantity: number;
price: number;
amount: number;
fee_amount: number;
discount: number;
coupon: string;
reduction: number;
coupon_discount: number;
method: string;
fee_amount: number;
trade_no: string;
status: number;
subscribe_id: number;
Expand Down Expand Up @@ -661,7 +665,7 @@ declare namespace API {
transport: Record<string, any>;
enable_relay: boolean;
relay_host: string;
relay_rort: number;
relay_port: number;
};

type UpdateAnnouncementEnableRequest = {
Expand Down
4 changes: 2 additions & 2 deletions apps/user/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ NEXT_PUBLIC_FACEBOOK_LINK=https://github.com/perfect-panel/ppanel-user-web
NEXT_PUBLIC_GITHUB_LINK=https://github.com/perfect-panel/ppanel-user-web

# Default Login User
NEXT_PUBLIC_DEFAULT_USER_EMAIL=support@ppanel.dev
NEXT_PUBLIC_DEFAULT_USER_PASSWORD=[email protected]
NEXT_PUBLIC_DEFAULT_USER_EMAIL=admin@ppanel.dev
NEXT_PUBLIC_DEFAULT_USER_PASSWORD=admin-password

# Please put in the .env file, otherwise the i18n command will not work
# OpenAI API key and proxy URL required for i18n command (optional)
Expand Down
2 changes: 1 addition & 1 deletion apps/user/app/(main)/(user)/payment/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export default function Page() {
<SubscribeBilling
order={{
...data,
coupon: data?.reduction,
coupon_discount: data?.coupon_discount,
quantity: data?.quantity,
unit_price: data?.subscribe?.unit_price,
type: data?.type,
Expand Down
8 changes: 4 additions & 4 deletions apps/user/app/(main)/(user)/subscribe/billing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface SubscribeBillingProps {
subscribe_id?: number;
quantity?: number;
price?: number;
reduction?: number;
coupon?: number;
discount?: number;
coupon_discount?: number;
fee_amount?: number;
amount?: number;
unit_price?: number;
Expand Down Expand Up @@ -42,13 +42,13 @@ export function SubscribeBilling({ order }: SubscribeBillingProps) {
<li>
<span className='text-muted-foreground'>{t('productDiscount')}</span>
<span>
<Display type='currency' value={order?.reduction} />
<Display type='currency' value={order?.discount} />
</span>
</li>
<li>
<span className='text-muted-foreground'>{t('couponDiscount')}</span>
<span>
<Display type='currency' value={order?.coupon} />
<Display type='currency' value={order?.coupon_discount} />
</span>
</li>
<li>
Expand Down
2 changes: 1 addition & 1 deletion apps/user/app/(main)/(user)/subscribe/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function Page() {
return (
<>
<Tabs value={group} onValueChange={setGroup} className='space-y-4'>
{groups?.length && (
{groups && groups.length > 0 && (
<>
<h1 className='text-muted-foreground w-full'>{t('category')}</h1>
<TabsList>
Expand Down
2 changes: 1 addition & 1 deletion apps/user/app/auth/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Page() {
<div className='flex bg-cover bg-center lg:w-1/2 lg:flex-auto'>
<div className='lg:py-15 md:px-15 flex w-full flex-col items-center justify-center px-5 py-7'>
<Link className='mb-0 flex flex-col items-center lg:mb-12' href='/'>
<Image src={site.site_logo} height={48} width={48} alt='logo' />
<Image src={site.site_logo} height={48} width={48} alt='logo' unoptimized />
<span className='text-2xl font-semibold'>{site.site_name}</span>
</Link>
<LoginIcon className='mx-auto hidden w-[275px] md:w-1/2 lg:block xl:w-[500px]' />
Expand Down
4 changes: 3 additions & 1 deletion apps/user/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export default function Header() {
const { site } = common;
const Logo = (
<Link href='/' className='flex items-center gap-2 text-lg font-bold'>
{site.site_logo && <Image src={site.site_logo} width={48} height={48} alt='logo' />}
{site.site_logo && (
<Image src={site.site_logo} width={48} height={48} alt='logo' unoptimized />
)}
<span>{site.site_name}</span>
</Link>
);
Expand Down
4 changes: 2 additions & 2 deletions apps/user/openapi2ts.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
const config = [
{
requestLibPath: "import request from '@/utils/request';",
schemaPath: 'https://swagger.ppanel.dev/common.json',
schemaPath: 'https://docs.ppanel.dev/swagger/common.json',
serversPath: './services',
projectName: 'common',
},
{
requestLibPath: "import request from '@/utils/request';",
schemaPath: 'https://swagger.ppanel.dev/user.json',
schemaPath: 'https://docs.ppanel.dev/swagger/user.json',
serversPath: './services',
projectName: 'user',
},
Expand Down
16 changes: 9 additions & 7 deletions apps/user/services/user/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,18 @@ declare namespace API {
id: number;
orderNo: string;
type: number;
subscribe_id: number;
subscribe: SubscribeInfo;
quantity: number;
price: number;
amount: number;
fee_amount: number;
discount: number;
coupon: string;
reduction: number;
trade_no: string;
coupon_discount: number;
method: string;
fee_amount: number;
trade_no: string;
status: number;
subscribe_id: number;
subscribe: SubscribeInfo;
created_at: number;
};

Expand All @@ -122,9 +123,10 @@ declare namespace API {
type PreOrderResponse = {
price: number;
amount: number;
discount: number;
coupon: string;
coupon_discount: number;
fee_amount: number;
coupon: number;
reduction: number;
};

type PreRenewalOrderResponse = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export function Combobox<T, M extends boolean = false>({
<Command>
<CommandInput placeholder='Search...' className='h-9' />
<CommandEmpty>
<BoxIcon />
<BoxIcon className='inline-block text-slate-500' />
</CommandEmpty>
<CommandGroup>
<CommandList>
Expand Down

0 comments on commit 255bd82

Please sign in to comment.