| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import { getGlobalCurrencySymbol } from '../utils/currency'; |
| 3 |
|
| 4 |
/** |
| 5 |
* Settings tab — full-width campaign settings view. |
| 6 |
* |
| 7 |
* Two collapsible sections matching the PRD: |
| 8 |
* 7.1 General Settings |
| 9 |
* 7.2 Donation Options |
| 10 |
*/ |
| 11 |
export default function SettingsTab( { meta, dispatch } ) { |
| 12 |
const update = ( patch ) => dispatch( { type: 'UPDATE_META', payload: patch } ); |
| 13 |
const currencySymbol = getGlobalCurrencySymbol(); |
| 14 |
|
| 15 |
return ( |
| 16 |
<div className="bp-settings-tab"> |
| 17 |
|
| 18 |
{/* 7.1 General Settings */} |
| 19 |
<div className="bp-settings-section"> |
| 20 |
<div className="bp-settings-section__header"> |
| 21 |
<h3>{ __( 'General Settings', 'better-payment' ) }</h3> |
| 22 |
</div> |
| 23 |
<div className="bp-settings-section__body"> |
| 24 |
|
| 25 |
<div className="bp-settings-row"> |
| 26 |
<div className="bp-settings-col bp-settings-col--full"> |
| 27 |
<label>{ __( 'Campaign Goal Amount', 'better-payment' ) }</label> |
| 28 |
<div className="bp-settings-prefix-input"> |
| 29 |
<span className="bp-settings-prefix">{ currencySymbol }</span> |
| 30 |
<input |
| 31 |
type="number" min="0" step="1" |
| 32 |
value={ meta.bpc_goal_amount } |
| 33 |
onChange={ ( e ) => update( { bpc_goal_amount: e.target.value } ) } |
| 34 |
placeholder="0" |
| 35 |
/> |
| 36 |
</div> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
|
| 40 |
<div className="bp-settings-row"> |
| 41 |
<div className="bp-settings-col bp-settings-col--full"> |
| 42 |
<label>{ __( 'Ending Date', 'better-payment' ) }</label> |
| 43 |
<input |
| 44 |
type="date" |
| 45 |
value={ meta.bpc_end_date } |
| 46 |
onChange={ ( e ) => update( { bpc_end_date: e.target.value } ) } |
| 47 |
onClick={ ( e ) => e.target.showPicker?.() } |
| 48 |
/> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
|
| 52 |
<div className="bp-settings-row"> |
| 53 |
<div className="bp-settings-col bp-settings-col--full"> |
| 54 |
<label>{ __( 'Custom CSS Class', 'better-payment' ) }</label> |
| 55 |
<input |
| 56 |
type="text" |
| 57 |
value={ meta.bpc_css_class || '' } |
| 58 |
onChange={ ( e ) => update( { bpc_css_class: e.target.value } ) } |
| 59 |
placeholder="my-campaign-class" |
| 60 |
/> |
| 61 |
</div> |
| 62 |
</div> |
| 63 |
|
| 64 |
</div> |
| 65 |
</div> |
| 66 |
|
| 67 |
</div> |
| 68 |
); |
| 69 |
} |
| 70 |
|