From a89a014729c2995f6895cf5d7c68db055b9e93a0 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Sun, 12 Jan 2025 07:14:20 +1030 Subject: [PATCH] style: condition tab improvements - add button used instead of generic button - added move up / down functionality - streamlined delte button - improved basic styling --- .../components/format/FormatConditionsTab.jsx | 53 ++++++----- .../format/conditions/ConditionCard.jsx | 87 ++++++++++--------- 2 files changed, 77 insertions(+), 63 deletions(-) diff --git a/frontend/src/components/format/FormatConditionsTab.jsx b/frontend/src/components/format/FormatConditionsTab.jsx index 1b8e147..feec468 100644 --- a/frontend/src/components/format/FormatConditionsTab.jsx +++ b/frontend/src/components/format/FormatConditionsTab.jsx @@ -1,9 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Plus, InfoIcon} from 'lucide-react'; +import {InfoIcon} from 'lucide-react'; import {usePatterns} from '@hooks/usePatterns'; import {createCondition} from './conditions/conditionTypes'; import ConditionCard from './conditions/ConditionCard'; +import AddButton from '@ui/DataBar/AddButton'; const FormatConditionsTab = ({conditions, onConditionsChange}) => { const {patterns, isLoading, error} = usePatterns(); @@ -45,38 +46,50 @@ const FormatConditionsTab = ({conditions, onConditionsChange}) => { }; if (isLoading) { - return
Loading patterns...
; + return ( +
+
+ Loading patterns... +
+
+ ); } if (error) { - return
Error loading patterns: {error}
; + return ( +
+
+ Error loading patterns: {error} +
+
+ ); } return (
- {/* Header with Info and Add Button */} -
-
+ {/* Header Section */} +
+ {/* Info Alert */} +
-

- Conditions define how this format matches media - releases. Each condition can be marked as required or - negated. Required conditions must match for the format - to apply, while negated conditions must not match. Use - patterns to match against release titles and groups. +

+ Define matching rules using required and negated + conditions to control how formats are applied to media + releases.

- + + {/* Add Button */} +
{/* Scrollable Conditions List */} -
-
+
+
{conditions.map((condition, index) => ( ({ value: type.id, label: type.name })); - // When type changes, create a fresh condition of the new type const handleTypeChange = e => { const newType = e.target.value; const newCondition = createCondition(newType); - // Preserve the name if it exists if (condition.name) { newCondition.name = condition.name; } @@ -35,10 +32,9 @@ const ConditionCard = ({ }; return ( -
- {/* Main content with more right padding */} -
- {/* Content remains the same */} +
+ {/* Main content */} +
{/* Custom Name Input */}
-
+
{/* Type Selection */} {/* Render the specific condition component */} @@ -76,9 +74,9 @@ const ConditionCard = ({ )} {/* Universal Controls */} -
+
{/* Required Checkbox */} -
- {/* Move Up/Down Buttons - Now positioned further right */} -
+ {/* Control Buttons */} +
+
);