| @@ -20,8 +20,12 @@ | ||
| 20 | 20 | show_pagination: boolean; |
| 21 | 21 | activityIds: number[]; |
| 22 | 22 | activity_ids?: string; |
| 23 | 23 | activity?: string; |
| 24 | + show_trip_count: boolean; | |
| 25 | + show_description: boolean; | |
| 26 | + show_image: boolean; | |
| 27 | + hide_empty: boolean; | |
| 24 | 28 | } |
| 25 | 29 | |
| 26 | 30 | interface EditProps { |
| 27 | 31 | attributes: ActivityBlockAttributes; |
| @@ -44,9 +48,12 @@ | ||
| 44 | 48 | migratedOnce.current = true; |
| 45 | 49 | |
| 46 | 50 | let ids = normalizeIds(attributes.activityIds); |
| 47 | 51 | if (ids.length === 0) { |
| 48 | - ids = migrateNumericCsvPairToIds(attributes.activity_ids, attributes.activity); | |
| 52 | + ids = migrateNumericCsvPairToIds( | |
| 53 | + attributes.activity_ids, | |
| 54 | + attributes.activity, | |
| 55 | + ); | |
| 49 | 56 | } |
| 50 | 57 | if (ids.length === 0) { |
| 51 | 58 | return; |
| 52 | 59 | } |
| @@ -112,13 +119,44 @@ | ||
| 112 | 119 | <ClassificationMultiSelect |
| 113 | 120 | taxonomy="activity" |
| 114 | 121 | label={__("Activities to show", "yatra")} |
| 115 | 122 | help={__( |
| 116 | - "Use \"All published\" or narrow with search and checkboxes.", | |
| 123 | + 'Use "All published" or narrow with search and checkboxes.', | |
| 117 | 124 | "yatra", |
| 118 | 125 | )} |
| 119 | 126 | value={activityIds} |
| 120 | 127 | onChange={(ids) => setAttributes({ activityIds: ids })} |
| 128 | + /> | |
| 129 | + </PanelBody> | |
| 130 | + | |
| 131 | + <PanelBody title={__("Display options", "yatra")} initialOpen={false}> | |
| 132 | + <ToggleControl | |
| 133 | + label={__("Show trip count", "yatra")} | |
| 134 | + checked={attributes.show_trip_count} | |
| 135 | + onChange={(value: boolean) => | |
| 136 | + setAttributes({ show_trip_count: value }) | |
| 137 | + } | |
| 138 | + /> | |
| 139 | + <ToggleControl | |
| 140 | + label={__("Show description", "yatra")} | |
| 141 | + checked={attributes.show_description} | |
| 142 | + onChange={(value: boolean) => | |
| 143 | + setAttributes({ show_description: value }) | |
| 144 | + } | |
| 145 | + /> | |
| 146 | + <ToggleControl | |
| 147 | + label={__("Show image", "yatra")} | |
| 148 | + checked={attributes.show_image} | |
| 149 | + onChange={(value: boolean) => setAttributes({ show_image: value })} | |
| 150 | + /> | |
| 151 | + <ToggleControl | |
| 152 | + label={__("Hide empty activities", "yatra")} | |
| 153 | + help={__( | |
| 154 | + "Skip activities that have no published trips assigned. Off by default — turn on for a tighter live catalog, leave off for editorial / onboarding views.", | |
| 155 | + "yatra", | |
| 156 | + )} | |
| 157 | + checked={attributes.hide_empty} | |
| 158 | + onChange={(value: boolean) => setAttributes({ hide_empty: value })} | |
| 121 | 159 | /> |
| 122 | 160 | </PanelBody> |
| 123 | 161 | </InspectorControls> |
| 124 | 162 | |