feat: Add WordPress button, settings navigation, and placeholder pages

This commit is contained in:
dwindown
2025-11-05 10:27:16 +07:00
parent 7c24602965
commit 12e982b3e5
6 changed files with 122 additions and 19 deletions

View File

@@ -187,6 +187,9 @@ function useIsDesktop(minWidth = 1024) { // lg breakpoint
} }
import SettingsIndex from '@/routes/Settings'; import SettingsIndex from '@/routes/Settings';
import SettingsGeneral from '@/routes/Settings/General';
import SettingsPayments from '@/routes/Settings/Payments';
import SettingsShipping from '@/routes/Settings/Shipping';
function SettingsRedirect() { function SettingsRedirect() {
return <SettingsIndex />; return <SettingsIndex />;
@@ -279,13 +282,22 @@ function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen:
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<div className="text-sm opacity-70 hidden sm:block">{window.WNW_API?.isDev ? 'Dev Server' : 'Production'}</div> <div className="text-sm opacity-70 hidden sm:block">{window.WNW_API?.isDev ? 'Dev Server' : 'Production'}</div>
{isStandalone && ( {isStandalone && (
<button <>
onClick={handleLogout} <a
className="inline-flex items-center gap-2 border rounded-md px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground" href={window.WNW_CONFIG?.wpAdminUrl || '/wp-admin'}
title="Logout" className="inline-flex items-center gap-2 border rounded-md px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground"
> title="Go to WordPress Admin"
<span>{__('Logout')}</span> >
</button> <span>{__('WordPress')}</span>
</a>
<button
onClick={handleLogout}
className="inline-flex items-center gap-2 border rounded-md px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground"
title="Logout"
>
<span>{__('Logout')}</span>
</button>
</>
)} )}
{showToggle && ( {showToggle && (
<button <button
@@ -346,8 +358,15 @@ function AppRoutes() {
{/* Customers */} {/* Customers */}
<Route path="/customers" element={<CustomersIndex />} /> <Route path="/customers" element={<CustomersIndex />} />
{/* Settings (SPA placeholder) */} {/* Settings */}
<Route path="/settings/*" element={<SettingsRedirect />} /> <Route path="/settings" element={<SettingsIndex />} />
<Route path="/settings/general" element={<SettingsGeneral />} />
<Route path="/settings/payments" element={<SettingsPayments />} />
<Route path="/settings/shipping" element={<SettingsShipping />} />
<Route path="/settings/products" element={<SettingsIndex />} />
<Route path="/settings/tax" element={<SettingsIndex />} />
<Route path="/settings/accounts" element={<SettingsIndex />} />
<Route path="/settings/emails" element={<SettingsIndex />} />
{/* Dynamic Addon Routes */} {/* Dynamic Addon Routes */}
{addonRoutes.map((route: any) => ( {addonRoutes.map((route: any) => (

View File

@@ -103,15 +103,21 @@ function getStaticFallbackTree(): MainNode[] {
path: '/settings', path: '/settings',
icon: 'settings', icon: 'settings',
children: [ children: [
{ label: 'General', mode: 'bridge', href: `${admin}?page=wc-settings&tab=general` }, // WooNooW Settings
{ label: 'Products', mode: 'bridge', href: `${admin}?page=wc-settings&tab=products` }, { label: 'WooNooW', mode: 'spa', path: '/settings' },
{ label: 'Tax', mode: 'bridge', href: `${admin}?page=wc-settings&tab=tax` },
{ label: 'Shipping', mode: 'bridge', href: `${admin}?page=wc-settings&tab=shipping` }, // WooCommerce Settings (Most Used First)
{ label: 'Payments', mode: 'bridge', href: `${admin}?page=wc-settings&tab=checkout` }, { label: 'General', mode: 'spa', path: '/settings/general' },
{ label: 'Accounts & Privacy', mode: 'bridge', href: `${admin}?page=wc-settings&tab=account` }, { label: 'Payments', mode: 'spa', path: '/settings/payments' },
{ label: 'Emails', mode: 'bridge', href: `${admin}?page=wc-settings&tab=email` }, { label: 'Shipping', mode: 'spa', path: '/settings/shipping' },
{ label: 'Integration', mode: 'bridge', href: `${admin}?page=wc-settings&tab=integration` }, { label: 'Products', mode: 'spa', path: '/settings/products' },
{ label: 'Tax', mode: 'spa', path: '/settings/tax' },
{ label: 'Accounts & Privacy', mode: 'spa', path: '/settings/accounts' },
{ label: 'Emails', mode: 'spa', path: '/settings/emails' },
// Less Common (Bridge to WP Admin for now)
{ label: 'Advanced', mode: 'bridge', href: `${admin}?page=wc-settings&tab=advanced` }, { label: 'Advanced', mode: 'bridge', href: `${admin}?page=wc-settings&tab=advanced` },
{ label: 'Integration', mode: 'bridge', href: `${admin}?page=wc-settings&tab=integration` },
{ label: 'Status', mode: 'bridge', href: `${admin}?page=wc-status` }, { label: 'Status', mode: 'bridge', href: `${admin}?page=wc-status` },
{ label: 'Extensions', mode: 'bridge', href: `${admin}?page=wc-addons` }, { label: 'Extensions', mode: 'bridge', href: `${admin}?page=wc-addons` },
], ],

View File

@@ -0,0 +1,19 @@
import React from 'react';
import { __ } from '@/lib/i18n';
export default function SettingsGeneral() {
return (
<div>
<h1 className="text-2xl font-semibold mb-6">{__('General Settings')}</h1>
<p className="text-muted-foreground mb-4">
{__('Configure general store settings including store address, currency, and more.')}
</p>
<div className="bg-muted/50 border rounded-lg p-6">
<p className="text-sm text-muted-foreground">
{__('Settings interface coming soon. This will replicate WooCommerce general settings.')}
</p>
</div>
</div>
);
}

View File

@@ -0,0 +1,19 @@
import React from 'react';
import { __ } from '@/lib/i18n';
export default function SettingsPayments() {
return (
<div>
<h1 className="text-2xl font-semibold mb-6">{__('Payment Settings')}</h1>
<p className="text-muted-foreground mb-4">
{__('Configure payment gateways and options.')}
</p>
<div className="bg-muted/50 border rounded-lg p-6">
<p className="text-sm text-muted-foreground">
{__('Payment settings interface coming soon. This will include payment gateway configuration.')}
</p>
</div>
</div>
);
}

View File

@@ -0,0 +1,19 @@
import React from 'react';
import { __ } from '@/lib/i18n';
export default function SettingsShipping() {
return (
<div>
<h1 className="text-2xl font-semibold mb-6">{__('Shipping Settings')}</h1>
<p className="text-muted-foreground mb-4">
{__('Configure shipping zones, methods, and rates.')}
</p>
<div className="bg-muted/50 border rounded-lg p-6">
<p className="text-sm text-muted-foreground">
{__('Shipping settings interface coming soon. This will include zones, methods, and rates configuration.')}
</p>
</div>
</div>
);
}

View File

@@ -4,8 +4,29 @@ import { __ } from '@/lib/i18n';
export default function SettingsIndex() { export default function SettingsIndex() {
return ( return (
<div> <div>
<h1 className="text-xl font-semibold mb-3">{__('Settings')}</h1> <h1 className="text-2xl font-semibold mb-6">{__('WooNooW Settings')}</h1>
<p className="opacity-70">{__('Coming soon — SPA settings.')}</p> <p className="text-muted-foreground mb-6">
{__('Configure WooNooW plugin settings and preferences.')}
</p>
<div className="space-y-6">
<div className="bg-card border rounded-lg p-6">
<h2 className="text-lg font-semibold mb-3">{__('Plugin Configuration')}</h2>
<p className="text-sm text-muted-foreground mb-4">
{__('Settings interface coming soon.')}
</p>
</div>
<div className="bg-card border rounded-lg p-6">
<h2 className="text-lg font-semibold mb-3">{__('Quick Links')}</h2>
<div className="space-y-2">
<p className="text-sm">
<span className="font-medium">{__('WooCommerce Settings:')}</span>{' '}
{__('Use the navigation menu to access General, Payments, Shipping, and other WooCommerce settings.')}
</p>
</div>
</div>
</div>
</div> </div>
); );
} }