feat: Add WordPress button, settings navigation, and placeholder pages
This commit is contained in:
@@ -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,6 +282,14 @@ 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 && (
|
||||||
|
<>
|
||||||
|
<a
|
||||||
|
href={window.WNW_CONFIG?.wpAdminUrl || '/wp-admin'}
|
||||||
|
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>{__('WordPress')}</span>
|
||||||
|
</a>
|
||||||
<button
|
<button
|
||||||
onClick={handleLogout}
|
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"
|
className="inline-flex items-center gap-2 border rounded-md px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground"
|
||||||
@@ -286,6 +297,7 @@ function Header({ onFullscreen, fullscreen, showToggle = true }: { onFullscreen:
|
|||||||
>
|
>
|
||||||
<span>{__('Logout')}</span>
|
<span>{__('Logout')}</span>
|
||||||
</button>
|
</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) => (
|
||||||
|
|||||||
@@ -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` },
|
||||||
],
|
],
|
||||||
|
|||||||
19
admin-spa/src/routes/Settings/General.tsx
Normal file
19
admin-spa/src/routes/Settings/General.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
19
admin-spa/src/routes/Settings/Payments.tsx
Normal file
19
admin-spa/src/routes/Settings/Payments.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
19
admin-spa/src/routes/Settings/Shipping.tsx
Normal file
19
admin-spa/src/routes/Settings/Shipping.tsx
Normal 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>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user