Compare commits
No commits in common. "main" and "fix/issue-2-exclude-admins-from-customers" have entirely different histories.
main
...
fix/issue-
50
src/App.tsx
50
src/App.tsx
|
|
@ -105,8 +105,6 @@ export default function App() {
|
||||||
const [editModuleName, setEditModuleName] = useState<string>('');
|
const [editModuleName, setEditModuleName] = useState<string>('');
|
||||||
const [editModuleDesc, setEditModuleDesc] = useState<string>('');
|
const [editModuleDesc, setEditModuleDesc] = useState<string>('');
|
||||||
const [editModuleCategory, setEditModuleCategory] = useState<string>('point');
|
const [editModuleCategory, setEditModuleCategory] = useState<string>('point');
|
||||||
const [editModuleIcon, setEditModuleIcon] = useState<string>('folder-outline');
|
|
||||||
const [editModuleColor, setEditModuleColor] = useState<string>('#4F46E5');
|
|
||||||
const [editModuleSaving, setEditModuleSaving] = useState<boolean>(false);
|
const [editModuleSaving, setEditModuleSaving] = useState<boolean>(false);
|
||||||
|
|
||||||
// Plans State
|
// Plans State
|
||||||
|
|
@ -122,7 +120,6 @@ export default function App() {
|
||||||
const [editPlanBadge, setEditPlanBadge] = useState<string>('');
|
const [editPlanBadge, setEditPlanBadge] = useState<string>('');
|
||||||
const [editPlanHeading, setEditPlanHeading] = useState<string>('');
|
const [editPlanHeading, setEditPlanHeading] = useState<string>('');
|
||||||
const [editPlanSubtitle, setEditPlanSubtitle] = useState<string>('');
|
const [editPlanSubtitle, setEditPlanSubtitle] = useState<string>('');
|
||||||
const [editPlanModuleIds, setEditPlanModuleIds] = useState<string[]>([]);
|
|
||||||
const [editPriceSaving, setEditPriceSaving] = useState<boolean>(false);
|
const [editPriceSaving, setEditPriceSaving] = useState<boolean>(false);
|
||||||
|
|
||||||
// Create Custom Plan State
|
// Create Custom Plan State
|
||||||
|
|
@ -548,8 +545,6 @@ export default function App() {
|
||||||
setEditModuleName(mod.name || '');
|
setEditModuleName(mod.name || '');
|
||||||
setEditModuleDesc(mod.description || '');
|
setEditModuleDesc(mod.description || '');
|
||||||
setEditModuleCategory(normalizeCategory(mod.category));
|
setEditModuleCategory(normalizeCategory(mod.category));
|
||||||
setEditModuleIcon(mod.icon || 'folder-outline');
|
|
||||||
setEditModuleColor(mod.color || '#4F46E5');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSaveModuleDetails = async (e: React.FormEvent) => {
|
const handleSaveModuleDetails = async (e: React.FormEvent) => {
|
||||||
|
|
@ -557,8 +552,6 @@ export default function App() {
|
||||||
if (!selectedEditModule || !userToken) return;
|
if (!selectedEditModule || !userToken) return;
|
||||||
setEditModuleSaving(true);
|
setEditModuleSaving(true);
|
||||||
const normalizedCat = normalizeCategory(editModuleCategory);
|
const normalizedCat = normalizeCategory(editModuleCategory);
|
||||||
const nextIcon = editModuleIcon.trim() || 'folder-outline';
|
|
||||||
const nextColor = editModuleColor.trim() || '#4F46E5';
|
|
||||||
try {
|
try {
|
||||||
await axios.put(
|
await axios.put(
|
||||||
`${API_BASE}/api/admin/modules/${selectedEditModule.id}`,
|
`${API_BASE}/api/admin/modules/${selectedEditModule.id}`,
|
||||||
|
|
@ -566,22 +559,13 @@ export default function App() {
|
||||||
name: editModuleName,
|
name: editModuleName,
|
||||||
description: editModuleDesc,
|
description: editModuleDesc,
|
||||||
category: normalizedCat,
|
category: normalizedCat,
|
||||||
icon: nextIcon,
|
|
||||||
color: nextColor,
|
|
||||||
},
|
},
|
||||||
{ headers: { Authorization: `Bearer ${userToken}` } }
|
{ headers: { Authorization: `Bearer ${userToken}` } }
|
||||||
);
|
);
|
||||||
setAdminModulesList((prev) =>
|
setAdminModulesList((prev) =>
|
||||||
prev.map((m) =>
|
prev.map((m) =>
|
||||||
m.id === selectedEditModule.id
|
m.id === selectedEditModule.id
|
||||||
? {
|
? { ...m, name: editModuleName, description: editModuleDesc, category: normalizedCat }
|
||||||
...m,
|
|
||||||
name: editModuleName,
|
|
||||||
description: editModuleDesc,
|
|
||||||
category: normalizedCat,
|
|
||||||
icon: nextIcon,
|
|
||||||
color: nextColor,
|
|
||||||
}
|
|
||||||
: m
|
: m
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
@ -629,11 +613,6 @@ export default function App() {
|
||||||
setEditPlanBadge(plan.badge_text || '');
|
setEditPlanBadge(plan.badge_text || '');
|
||||||
setEditPlanHeading(plan.heading || '');
|
setEditPlanHeading(plan.heading || '');
|
||||||
setEditPlanSubtitle(plan.subtitle || '');
|
setEditPlanSubtitle(plan.subtitle || '');
|
||||||
setEditPlanModuleIds(
|
|
||||||
Array.isArray(plan.module_ids) && plan.module_ids.length > 0
|
|
||||||
? plan.module_ids
|
|
||||||
: (plan.modules || []).map((m: any) => m.id).filter(Boolean)
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSavePlanPrice = async (e: React.FormEvent) => {
|
const handleSavePlanPrice = async (e: React.FormEvent) => {
|
||||||
|
|
@ -648,10 +627,6 @@ export default function App() {
|
||||||
}
|
}
|
||||||
setEditPriceSaving(true);
|
setEditPriceSaving(true);
|
||||||
try {
|
try {
|
||||||
const isEditableBundle =
|
|
||||||
selectedEditPricePlan.plan_type === 'bundle' ||
|
|
||||||
selectedEditPricePlan.base_code === 'PATTERN_CORE' ||
|
|
||||||
selectedEditPricePlan.base_code === 'NUTRITION_CORE';
|
|
||||||
await axios.put(
|
await axios.put(
|
||||||
`${API_BASE}/api/admin/plans/${selectedEditPricePlan.base_code}/pricing`,
|
`${API_BASE}/api/admin/plans/${selectedEditPricePlan.base_code}/pricing`,
|
||||||
{
|
{
|
||||||
|
|
@ -663,14 +638,9 @@ export default function App() {
|
||||||
badge_text: editPlanBadge.trim() || undefined,
|
badge_text: editPlanBadge.trim() || undefined,
|
||||||
heading: editPlanHeading.trim() || undefined,
|
heading: editPlanHeading.trim() || undefined,
|
||||||
subtitle: editPlanSubtitle.trim() || undefined,
|
subtitle: editPlanSubtitle.trim() || undefined,
|
||||||
module_ids: isEditableBundle ? editPlanModuleIds : undefined,
|
|
||||||
},
|
},
|
||||||
{ headers: { Authorization: `Bearer ${userToken}` } }
|
{ headers: { Authorization: `Bearer ${userToken}` } }
|
||||||
);
|
);
|
||||||
const updatedBundleModules =
|
|
||||||
isEditableBundle
|
|
||||||
? adminModulesList.filter((m) => editPlanModuleIds.includes(m.id))
|
|
||||||
: undefined;
|
|
||||||
setAdminPlansList((prev) =>
|
setAdminPlansList((prev) =>
|
||||||
prev.map((p) =>
|
prev.map((p) =>
|
||||||
p.base_code === selectedEditPricePlan.base_code
|
p.base_code === selectedEditPricePlan.base_code
|
||||||
|
|
@ -684,11 +654,6 @@ export default function App() {
|
||||||
price_inr: inrVal,
|
price_inr: inrVal,
|
||||||
price_usd: usdVal,
|
price_usd: usdVal,
|
||||||
price_eur: eurVal,
|
price_eur: eurVal,
|
||||||
pricing_status:
|
|
||||||
inrVal > 0 || usdVal > 0 || eurVal > 0 ? 'configured' : p.pricing_status,
|
|
||||||
...(isEditableBundle
|
|
||||||
? { module_ids: editPlanModuleIds, modules: updatedBundleModules }
|
|
||||||
: {}),
|
|
||||||
}
|
}
|
||||||
: p
|
: p
|
||||||
)
|
)
|
||||||
|
|
@ -1340,13 +1305,9 @@ export default function App() {
|
||||||
name={editModuleName}
|
name={editModuleName}
|
||||||
description={editModuleDesc}
|
description={editModuleDesc}
|
||||||
category={editModuleCategory}
|
category={editModuleCategory}
|
||||||
icon={editModuleIcon}
|
|
||||||
color={editModuleColor}
|
|
||||||
saving={editModuleSaving}
|
saving={editModuleSaving}
|
||||||
onNameChange={setEditModuleName}
|
onNameChange={setEditModuleName}
|
||||||
onDescriptionChange={setEditModuleDesc}
|
onDescriptionChange={setEditModuleDesc}
|
||||||
onIconChange={setEditModuleIcon}
|
|
||||||
onColorChange={setEditModuleColor}
|
|
||||||
onSave={handleSaveModuleDetails}
|
onSave={handleSaveModuleDetails}
|
||||||
onClose={() => setSelectedEditModule(null)}
|
onClose={() => setSelectedEditModule(null)}
|
||||||
/>
|
/>
|
||||||
|
|
@ -1405,8 +1366,6 @@ export default function App() {
|
||||||
priceInr={editPriceInr}
|
priceInr={editPriceInr}
|
||||||
priceUsd={editPriceUsd}
|
priceUsd={editPriceUsd}
|
||||||
priceEur={editPriceEur}
|
priceEur={editPriceEur}
|
||||||
allModules={adminModulesList}
|
|
||||||
moduleIds={editPlanModuleIds}
|
|
||||||
saving={editPriceSaving}
|
saving={editPriceSaving}
|
||||||
onNameChange={setEditPlanName}
|
onNameChange={setEditPlanName}
|
||||||
onDescChange={setEditPlanDesc}
|
onDescChange={setEditPlanDesc}
|
||||||
|
|
@ -1416,13 +1375,6 @@ export default function App() {
|
||||||
onPriceInrChange={setEditPriceInr}
|
onPriceInrChange={setEditPriceInr}
|
||||||
onPriceUsdChange={setEditPriceUsd}
|
onPriceUsdChange={setEditPriceUsd}
|
||||||
onPriceEurChange={setEditPriceEur}
|
onPriceEurChange={setEditPriceEur}
|
||||||
onToggleModule={(id: string) =>
|
|
||||||
setEditPlanModuleIds((prev) =>
|
|
||||||
prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]
|
|
||||||
)
|
|
||||||
}
|
|
||||||
onSelectAllModules={() => setEditPlanModuleIds(adminModulesList.map((m) => m.id))}
|
|
||||||
onClearAllModules={() => setEditPlanModuleIds([])}
|
|
||||||
onSave={handleSavePlanPrice}
|
onSave={handleSavePlanPrice}
|
||||||
onClose={() => setSelectedEditPricePlan(null)}
|
onClose={() => setSelectedEditPricePlan(null)}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -3,29 +3,14 @@ import { XCircle, RefreshCw } from 'lucide-react';
|
||||||
import type { ModuleItem } from '../../types';
|
import type { ModuleItem } from '../../types';
|
||||||
import { normalizeCategory } from '../../utils/category';
|
import { normalizeCategory } from '../../utils/category';
|
||||||
|
|
||||||
const ICON_PRESETS = [
|
|
||||||
'medkit-outline',
|
|
||||||
'heart-outline',
|
|
||||||
'woman-outline',
|
|
||||||
'ear-outline',
|
|
||||||
'body-outline',
|
|
||||||
'leaf-outline',
|
|
||||||
'pulse-outline',
|
|
||||||
'folder-outline',
|
|
||||||
];
|
|
||||||
|
|
||||||
interface EditModuleModalProps {
|
interface EditModuleModalProps {
|
||||||
module: ModuleItem | null;
|
module: ModuleItem | null;
|
||||||
name: string;
|
name: string;
|
||||||
description: string;
|
description: string;
|
||||||
category: string;
|
category: string;
|
||||||
icon: string;
|
|
||||||
color: string;
|
|
||||||
saving: boolean;
|
saving: boolean;
|
||||||
onNameChange: (val: string) => void;
|
onNameChange: (val: string) => void;
|
||||||
onDescriptionChange: (val: string) => void;
|
onDescriptionChange: (val: string) => void;
|
||||||
onIconChange: (val: string) => void;
|
|
||||||
onColorChange: (val: string) => void;
|
|
||||||
onSave: (e: React.FormEvent) => void;
|
onSave: (e: React.FormEvent) => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
@ -35,13 +20,9 @@ export const EditModuleModal: React.FC<EditModuleModalProps> = ({
|
||||||
name,
|
name,
|
||||||
description,
|
description,
|
||||||
category,
|
category,
|
||||||
icon,
|
|
||||||
color,
|
|
||||||
saving,
|
saving,
|
||||||
onNameChange,
|
onNameChange,
|
||||||
onDescriptionChange,
|
onDescriptionChange,
|
||||||
onIconChange,
|
|
||||||
onColorChange,
|
|
||||||
onSave,
|
onSave,
|
||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
@ -54,7 +35,7 @@ export const EditModuleModal: React.FC<EditModuleModalProps> = ({
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div
|
<div
|
||||||
className="h-8 w-8 rounded-lg flex items-center justify-center font-bold text-white text-xs"
|
className="h-8 w-8 rounded-lg flex items-center justify-center font-bold text-white text-xs"
|
||||||
style={{ backgroundColor: color || (module as any).color || '#4F46E5' }}
|
style={{ backgroundColor: (module as any).color || '#6366F1' }}
|
||||||
>
|
>
|
||||||
{(module.name || 'M')[0].toUpperCase()}
|
{(module.name || 'M')[0].toUpperCase()}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -108,55 +89,6 @@ export const EditModuleModal: React.FC<EditModuleModalProps> = ({
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
|
||||||
<div>
|
|
||||||
<label className="block text-[10px] uppercase font-bold text-slate-500 mb-1">Mobile Icon (Ionicons)</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={icon}
|
|
||||||
onChange={(e) => onIconChange(e.target.value)}
|
|
||||||
placeholder="e.g. medkit-outline"
|
|
||||||
className="w-full bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-mono text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<label className="block text-[10px] uppercase font-bold text-slate-500 mb-1">Mobile Accent Color</label>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<input
|
|
||||||
type="color"
|
|
||||||
value={/^#[0-9A-Fa-f]{6}$/.test(color) ? color : '#4F46E5'}
|
|
||||||
onChange={(e) => onColorChange(e.target.value)}
|
|
||||||
className="h-9 w-10 rounded-lg border border-slate-200 cursor-pointer p-0.5 bg-white"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={color}
|
|
||||||
onChange={(e) => onColorChange(e.target.value)}
|
|
||||||
placeholder="#4F46E5"
|
|
||||||
className="flex-1 bg-white border border-slate-200 rounded-xl px-3 py-2 text-xs font-mono text-slate-800 focus:outline-none focus:border-indigo-500"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-wrap gap-1.5">
|
|
||||||
{ICON_PRESETS.map((preset) => (
|
|
||||||
<button
|
|
||||||
key={preset}
|
|
||||||
type="button"
|
|
||||||
onClick={() => onIconChange(preset)}
|
|
||||||
className={`px-2 py-1 rounded-lg text-[10px] font-mono border transition-colors cursor-pointer ${
|
|
||||||
icon === preset
|
|
||||||
? 'bg-indigo-50 text-indigo-700 border-indigo-300 font-bold'
|
|
||||||
: 'bg-slate-50 text-slate-600 border-slate-200 hover:bg-slate-100'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{preset}
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex gap-2 pt-2">
|
<div className="flex gap-2 pt-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ interface EditPriceModalProps {
|
||||||
priceInr: string;
|
priceInr: string;
|
||||||
priceUsd: string;
|
priceUsd: string;
|
||||||
priceEur: string;
|
priceEur: string;
|
||||||
allModules?: any[];
|
|
||||||
moduleIds?: string[];
|
|
||||||
saving: boolean;
|
saving: boolean;
|
||||||
onNameChange: (v: string) => void;
|
onNameChange: (v: string) => void;
|
||||||
onDescChange: (v: string) => void;
|
onDescChange: (v: string) => void;
|
||||||
|
|
@ -22,9 +20,6 @@ interface EditPriceModalProps {
|
||||||
onPriceInrChange: (v: string) => void;
|
onPriceInrChange: (v: string) => void;
|
||||||
onPriceUsdChange: (v: string) => void;
|
onPriceUsdChange: (v: string) => void;
|
||||||
onPriceEurChange: (v: string) => void;
|
onPriceEurChange: (v: string) => void;
|
||||||
onToggleModule?: (id: string) => void;
|
|
||||||
onSelectAllModules?: () => void;
|
|
||||||
onClearAllModules?: () => void;
|
|
||||||
onSave: (e: React.FormEvent) => void;
|
onSave: (e: React.FormEvent) => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
@ -39,8 +34,6 @@ export const EditPriceModal: React.FC<EditPriceModalProps> = ({
|
||||||
priceInr,
|
priceInr,
|
||||||
priceUsd,
|
priceUsd,
|
||||||
priceEur,
|
priceEur,
|
||||||
allModules = [],
|
|
||||||
moduleIds = [],
|
|
||||||
saving,
|
saving,
|
||||||
onNameChange,
|
onNameChange,
|
||||||
onDescChange,
|
onDescChange,
|
||||||
|
|
@ -50,9 +43,6 @@ export const EditPriceModal: React.FC<EditPriceModalProps> = ({
|
||||||
onPriceInrChange,
|
onPriceInrChange,
|
||||||
onPriceUsdChange,
|
onPriceUsdChange,
|
||||||
onPriceEurChange,
|
onPriceEurChange,
|
||||||
onToggleModule,
|
|
||||||
onSelectAllModules,
|
|
||||||
onClearAllModules,
|
|
||||||
onSave,
|
onSave,
|
||||||
onClose,
|
onClose,
|
||||||
}) => {
|
}) => {
|
||||||
|
|
@ -178,59 +168,6 @@ export const EditPriceModal: React.FC<EditPriceModalProps> = ({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{(plan.plan_type === 'bundle' || plan.base_code === 'PATTERN_CORE' || plan.base_code === 'NUTRITION_CORE') && allModules.length > 0 && onToggleModule && (
|
|
||||||
<div className="space-y-2 border-t border-slate-100 pt-3">
|
|
||||||
<div className="flex items-center justify-between">
|
|
||||||
<label className="text-xs font-bold text-slate-600">
|
|
||||||
Included Modules ({moduleIds.length} / {allModules.length})
|
|
||||||
</label>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
{onSelectAllModules && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={onSelectAllModules}
|
|
||||||
className="text-[11px] font-bold text-indigo-600 hover:text-indigo-800 cursor-pointer"
|
|
||||||
>
|
|
||||||
Select All
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
{onClearAllModules && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onClick={onClearAllModules}
|
|
||||||
className="text-[11px] font-bold text-slate-400 hover:text-slate-600 cursor-pointer"
|
|
||||||
>
|
|
||||||
Clear
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="max-h-40 overflow-y-auto rounded-xl border border-slate-200 bg-slate-50 p-2 grid grid-cols-1 sm:grid-cols-2 gap-1.5">
|
|
||||||
{allModules.map((mod) => {
|
|
||||||
const checked = moduleIds.includes(mod.id);
|
|
||||||
return (
|
|
||||||
<label
|
|
||||||
key={mod.id}
|
|
||||||
className={`flex items-center gap-2 px-2.5 py-1.5 rounded-lg text-xs cursor-pointer transition-colors ${
|
|
||||||
checked
|
|
||||||
? 'bg-indigo-50 text-indigo-800 border border-indigo-200 font-semibold'
|
|
||||||
: 'bg-white text-slate-600 border border-slate-200 hover:bg-slate-100'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={checked}
|
|
||||||
onChange={() => onToggleModule(mod.id)}
|
|
||||||
className="rounded border-slate-300 text-indigo-600 focus:ring-indigo-500"
|
|
||||||
/>
|
|
||||||
<span className="truncate">{mod.name}</span>
|
|
||||||
</label>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="flex gap-2 pt-2">
|
<div className="flex gap-2 pt-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
|
||||||
|
|
@ -158,11 +158,6 @@ export const PlansTab: React.FC<PlansTabProps> = ({
|
||||||
<div className="space-y-0.5 max-w-xs">
|
<div className="space-y-0.5 max-w-xs">
|
||||||
<div className="flex items-center gap-1.5">
|
<div className="flex items-center gap-1.5">
|
||||||
<span className="font-bold text-slate-800">{plan.name}</span>
|
<span className="font-bold text-slate-800">{plan.name}</span>
|
||||||
{plan.pricing_status === 'pending_pricing' && (
|
|
||||||
<span className="inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-bold bg-amber-100 text-amber-800 border border-amber-300">
|
|
||||||
Needs Pricing
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<code className="text-[10px] font-mono text-indigo-600 bg-indigo-50 px-1.5 py-0.5 rounded border border-indigo-100 font-bold">
|
<code className="text-[10px] font-mono text-indigo-600 bg-indigo-50 px-1.5 py-0.5 rounded border border-indigo-100 font-bold">
|
||||||
|
|
@ -291,22 +286,11 @@ export const PlansTab: React.FC<PlansTabProps> = ({
|
||||||
<td className="py-3.5 px-3 text-center whitespace-nowrap">
|
<td className="py-3.5 px-3 text-center whitespace-nowrap">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={plan.pricing_status === 'pending_pricing'}
|
|
||||||
onClick={() => onTogglePlanStatus(plan)}
|
onClick={() => onTogglePlanStatus(plan)}
|
||||||
className={`relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${
|
className={`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none ${
|
||||||
plan.pricing_status === 'pending_pricing'
|
plan.is_active ? 'bg-indigo-600' : 'bg-slate-300'
|
||||||
? 'bg-slate-200 cursor-not-allowed opacity-60'
|
|
||||||
: plan.is_active
|
|
||||||
? 'bg-indigo-600 cursor-pointer'
|
|
||||||
: 'bg-slate-300 cursor-pointer'
|
|
||||||
}`}
|
}`}
|
||||||
title={
|
title={plan.is_active ? 'Click to deactivate' : 'Click to activate'}
|
||||||
plan.pricing_status === 'pending_pricing'
|
|
||||||
? 'Set prices via Edit Info & Price before activating'
|
|
||||||
: plan.is_active
|
|
||||||
? 'Click to deactivate'
|
|
||||||
: 'Click to activate'
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${
|
className={`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out ${
|
||||||
|
|
@ -315,11 +299,7 @@ export const PlansTab: React.FC<PlansTabProps> = ({
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
<span className="block text-[9px] font-bold text-slate-400 mt-0.5">
|
<span className="block text-[9px] font-bold text-slate-400 mt-0.5">
|
||||||
{plan.pricing_status === 'pending_pricing'
|
{plan.is_active ? 'Active' : 'Inactive'}
|
||||||
? 'Needs Pricing'
|
|
||||||
: plan.is_active
|
|
||||||
? 'Active'
|
|
||||||
: 'Inactive'}
|
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue