Add PLA Translucent colors and restrict finish options by filament type
- Added Light Jade (#A4D6AD) and Cherry Pink (#E9B6CC) PLA Translucent colors - Implement dynamic finish options based on selected filament type - ABS now only shows GF and Bez Finisha options - Each filament type has appropriate finish options - Auto-reset finish when changing type if incompatible
This commit is contained in:
@@ -51,6 +51,19 @@ interface FilamentWithId extends Filament {
|
||||
boja_hex?: string;
|
||||
}
|
||||
|
||||
// Finish options by filament type
|
||||
const FINISH_OPTIONS_BY_TYPE: Record<string, string[]> = {
|
||||
'ABS': ['GF', 'Bez Finisha'],
|
||||
'PLA': ['85A', '90A', '95A HF', 'Aero', 'Basic', 'Basic Gradient', 'CF', 'FR', 'Galaxy', 'GF', 'Glow', 'HF', 'Marble', 'Matte', 'Metal', 'Silk Multi-Color', 'Silk+', 'Sparkle', 'Translucent', 'Wood'],
|
||||
'TPU': ['85A', '90A', '95A HF'],
|
||||
'PETG': ['Basic', 'CF', 'FR', 'HF', 'Translucent'],
|
||||
'PC': ['CF', 'Bez Finisha'],
|
||||
'ASA': ['Bez Finisha'],
|
||||
'PA': ['CF', 'GF', 'Bez Finisha'],
|
||||
'PVA': ['Bez Finisha'],
|
||||
'HIPS': ['Bez Finisha']
|
||||
};
|
||||
|
||||
export default function AdminDashboard() {
|
||||
const router = useRouter();
|
||||
const [filaments, setFilaments] = useState<FilamentWithId[]>([]);
|
||||
@@ -705,6 +718,15 @@ function FilamentForm({
|
||||
...formData,
|
||||
[name]: numValue
|
||||
});
|
||||
} else if (name === 'tip') {
|
||||
// If changing filament type, reset finish if it's not compatible
|
||||
const newTypeFinishes = FINISH_OPTIONS_BY_TYPE[value] || [];
|
||||
const resetFinish = !newTypeFinishes.includes(formData.finish);
|
||||
setFormData({
|
||||
...formData,
|
||||
[name]: value,
|
||||
...(resetFinish ? { finish: '' } : {})
|
||||
});
|
||||
} else if (name === 'boja') {
|
||||
// If changing to a refill-only color, reset spulna to 0
|
||||
const refillOnly = isRefillOnly(value, formData.finish);
|
||||
@@ -814,26 +836,9 @@ function FilamentForm({
|
||||
className="custom-select w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">Izaberi finish</option>
|
||||
<option value="85A">85A</option>
|
||||
<option value="90A">90A</option>
|
||||
<option value="95A HF">95A HF</option>
|
||||
<option value="Aero">Aero</option>
|
||||
<option value="Basic">Basic</option>
|
||||
<option value="Basic Gradient">Basic Gradient</option>
|
||||
<option value="CF">CF</option>
|
||||
<option value="FR">FR</option>
|
||||
<option value="Galaxy">Galaxy</option>
|
||||
<option value="GF">GF</option>
|
||||
<option value="Glow">Glow</option>
|
||||
<option value="HF">HF</option>
|
||||
<option value="Marble">Marble</option>
|
||||
<option value="Matte">Matte</option>
|
||||
<option value="Metal">Metal</option>
|
||||
<option value="Silk Multi-Color">Silk Multi-Color</option>
|
||||
<option value="Silk+">Silk+</option>
|
||||
<option value="Sparkle">Sparkle</option>
|
||||
<option value="Translucent">Translucent</option>
|
||||
<option value="Wood">Wood</option>
|
||||
{(FINISH_OPTIONS_BY_TYPE[formData.tip] || []).map(finish => (
|
||||
<option key={finish} value={finish}>{finish}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user