diff --git a/app/soapbox/features/configuration/components/branding_preview.js b/app/soapbox/features/configuration/components/branding_preview.js new file mode 100644 index 000000000..86c240538 --- /dev/null +++ b/app/soapbox/features/configuration/components/branding_preview.js @@ -0,0 +1,32 @@ +import React from 'react'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { acctFull } from 'soapbox/utils/accounts'; +import StillImage from 'soapbox/components/still_image'; + +const BrandingPreview = ({ account }) => ( +
+); + +BrandingPreview.propTypes = { + account: ImmutablePropTypes.map, +}; + +export default BrandingPreview; diff --git a/app/soapbox/features/configuration/index.js b/app/soapbox/features/configuration/index.js index c574830f5..cd33df659 100644 --- a/app/soapbox/features/configuration/index.js +++ b/app/soapbox/features/configuration/index.js @@ -12,6 +12,7 @@ import { Checkbox, FileChooser, } from 'soapbox/features/forms'; +import BrandingPreview from './components/branding_preview'; import { Map as ImmutableMap, List as ImmutableList, @@ -19,82 +20,37 @@ import { import { patchMe } from 'soapbox/actions/me'; import { unescape } from 'lodash'; +const MAX_FIELDS = 6; // Max promoPanel fields + const messages = defineMessages({ - heading: { id: 'column.edit_profile', defaultMessage: 'Edit profile' }, - metaFieldLabel: { id: 'edit_profile.fields.meta_fields.label_placeholder', defaultMessage: 'Label' }, - metaFieldContent: { id: 'edit_profile.fields.meta_fields.content_placeholder', defaultMessage: 'Content' }, + heading: { id: 'column.soapbox_settings', defaultMessage: 'Soapbox settings' }, + promoPanelIcon: { id: 'soapbox_settings.promo_panel.meta_fields.icon_placeholder', defaultMessage: 'Icon' }, + promoPanelLabel: { id: 'soapbox_settings.promo_panel.meta_fields.label_placeholder', defaultMessage: 'Label' }, + promoPanelURL: { id: 'soapbox_settings.promo_panel.meta_fields.url_placeholder', defaultMessage: 'URL' }, + homeFooterLabel: { id: 'soapbox_settings.home_footer.meta_fields.label_placeholder', defaultMessage: 'Label' }, + homeFooterURL: { id: 'soapbox_settings.home_footer.meta_fields.url_placeholder', defaultMessage: 'URL' }, }); const mapStateToProps = state => { const soapbox = state.get('soapbox'); return { themeCss: generateThemeCss(state.getIn(['soapbox', 'brandColor'])), - customCss: state.getIn(['soapbox', 'customCss']), - logo: state.getIn(['soapbox', 'logo']), logo: state.getIn(['soapbox', 'logo']), promoPanel: state.getIn(['soapbox', 'promoPanel', 'items']), patronEnabled: state.getIn(['soapbox', 'extensions', 'patron', 'enabled']), - displayMode: state.getIn(['soapbox', 'defaultSettings', 'mode']), + autoPlayGif: state.getIn(['soapbox', 'defaultSettings', 'autoPlayGif']), copyright: state.getIn(['soapbox', 'copyright']), homeFooter: state.getIn(['soapbox', 'navLinks', 'homeFooter']), - - // { - // soapbox: { - // brandColor: '#1ca82b', - // logo: '/favicon.png', - // promoPanel: { - // items: [ - // { - // icon: 'area-chart', - // text: 'Gleasonator stats', - // url: 'https://fediverse.network/gleasonator.com' - // }, - // { - // icon: 'comment-o', - // text: 'Gleasonator theme song', - // url: 'https://media.gleasonator.com/custom/261905_gleasonator_song.mp3' - // } - // ] - // }, - // extensions: { - // patron: { - // enabled: true - // } - // }, - // defaultSettings: { - // mode: 'light' - // }, - // copyright: '♡2020. Copying is an act of love. Please copy and share.', - // navlinks: { - // homeFooter: [ - // { - // title: 'About', - // url: '/about' - // }, - // { - // title: 'Terms of Service', - // url: '/about/tos' - // }, - // { - // title: 'Privacy Policy', - // url: '/about/privacy' - // }, - // { - // title: 'DMCA', - // url: '/about/dmca' - // }, - // { - // title: 'Source Code', - // url: '/about#opensource' - // } - // ] - // } - // } - // } - }; }; +// Forces fields to be MAX_SIZE, filling empty values +const normalizeFields = fields => ( + ImmutableList(fields).setSize(MAX_FIELDS).map(field => + field ? field : ImmutableMap({ name: '', value: '' }) + ) +); + // HTML unescape for special chars, eg