Skip to content

Commit

Permalink
Add routing for public channel pages, add layout and style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jlbyrne committed Aug 29, 2024
1 parent 92926dd commit ece9c7c
Show file tree
Hide file tree
Showing 17 changed files with 286 additions and 110 deletions.
2 changes: 2 additions & 0 deletions app/controllers/api/nextv1/public_channel_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class Api::Nextv1::PublicChannelController < Api::Nextv1::BaseController
skip_before_action :authenticate_publisher!

def show
channel = Channel.includes(:site_banner).find_by(public_identifier: params[:public_identifier])
channel_title = channel&.publication_title
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
resource :uphold_connection, except: [:new]
end

get "c/:public_identifier", to: "public_channel#show", as: :public_channel
get "public_channel/:public_identifier", to: "public_channel#show", as: :public_channel
get "/get_ratios", to: "public_channel#get_ratios"
end

Expand Down
120 changes: 120 additions & 0 deletions nextjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added nextjs/public/images/brave_logo_dark_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions nextjs/public/images/brave_logo_dark_bg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion nextjs/scripts/create-local-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ const nextAllowPageRoutes = [
'publishers/totp_registrations/new',
'publishers/u2f_registrations/new',
'publishers/home',
'publishers/contribution_page'
'publishers/contribution_page',
'c/*'
];
const routeMatch = [
nextAllowPageRoutes.map((r) => `ja/${r}`).join('|'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ export default function CryptoPaymentWidget({title, cryptoAddresses, cryptoConst
return (
<div className={`${styles['crypto-widget-wrapper']}`}>
<div className={`${styles['heading-wrapper']}`}>
<div className={`${styles['widget-subheading']}`}>
<div className='default-regular'>
{t("publicChannelPage.paymentSubHeading")}
</div>
<div className={`${styles['widget-heading']}`}>
<h3 className={`${styles['widget-heading']}`}>
{t("publicChannelPage.paymentHeading")}
</div>
</h3>
</div>
<div className={`${styles['payment-options']}`}>
<Select
Expand Down Expand Up @@ -531,13 +531,13 @@ export default function CryptoPaymentWidget({title, cryptoAddresses, cryptoConst
/>
</div>
<div className="col-span-12 md:col-span-5 text-right align-top">
<div className={`${styles['large-currency-display']}`}>
<h2 className={`${styles['large-currency-display']}`}>
{toggle === 'crypto' ? (
<span>{roundCryptoPrice()} <span className={`${styles['currency']} align-middle`}>{displayChain}</span></span>
) : (
<span>${currentAmount} <span className={`${styles['currency']} align-middle`}>USD</span></span>
)}
</div>
</h2>
<div className={`${styles['small-currency-display']}`}>
{toggle === 'fiat' ? (
<span>{roundCryptoPrice()} {displayChain}</span>
Expand Down Expand Up @@ -582,6 +582,7 @@ export default function CryptoPaymentWidget({title, cryptoAddresses, cryptoConst
isOpen={isModalOpen}
showClose={true}
onClose={() => setIsModalOpen(false)}
className={`${styles['qr-modal']}`}
>
<QRCodeModal
address={addresses[baseChain()]}
Expand All @@ -593,6 +594,7 @@ export default function CryptoPaymentWidget({title, cryptoAddresses, cryptoConst
isOpen={isTryBraveModalOpen}
showClose={true}
onClose={() => isTryBraveModalOpen(false)}
className={`${styles['try-brave-modal']}`}
>
<TryBraveModal />
</Dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function PublicChannelPage({publicIdentifier, previewMode}) {
const [url, setUrl] = useState('');

async function fetchChannelData() {
const channelData = await apiRequest(`c/${publicIdentifier}`);
const channelData = await apiRequest(`public_channel/${publicIdentifier}`);

const siteBannerData = channelData.site_banner;
setTitle(siteBannerData.title);
Expand Down Expand Up @@ -64,12 +64,12 @@ export default function PublicChannelPage({publicIdentifier, previewMode}) {
<div className={`${styles['image-container']}`}>
<div style={{ '--cover-url': `url('${coverUrl}')` }} className={`${styles['cover']}`}></div>
</div>
<div className='container'>
<div className='container mx-auto'>
<div className='grid grid-cols-1 lg:grid-cols-2'>
<div className={`${styles['description-container']} px-4`}>
<div className={`${styles['logo']}`} style={{ '--logo-url': `url('${logoUrl}')` }}></div>
<div className={`${styles['creator-title']}`}>{title} <Icon name='verification-filled-color' className='inline-block' /></div>
<div className={`${styles['creator-description']}`}>{description}</div>
<h1 className={`${styles['creator-title']}`}>{title} <Icon name='verification-filled-color' className='inline-block' /></h1>
<div className={`${styles['creator-description']} large-regular`}>{description}</div>
<div>
{Object.keys(socialLinks).map((key) => {
if (socialLinks[key].length) {
Expand Down
10 changes: 5 additions & 5 deletions nextjs/src/app/[locale]/c/[public_identifier]/QRCodeModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ export default function QRCodeModal({address, chain, displayChain}) {
return (
<div>
<div className={`${styles['qr-title']}`}>
{t('publicChannelPage.QRModalHeader')}
<h2>{t('publicChannelPage.QRModalHeader')}</h2>
{displayChain.includes('BAT') ? (
<div className={`${styles['qr-subtitle']}`}>{t('publicChannelPage.QRBatText', {chain: t(`publicChannelPage.${chain}`)})}</div>
<div className={`${styles['qr-subtitle']} default-regular`}>{t('publicChannelPage.QRBatText', {chain: t(`publicChannelPage.${chain}`)})}</div>
) : (
<div className={`${styles['qr-subtitle']}`}>{t('publicChannelPage.QRStandardText', {chain})}</div>
<div className={`${styles['qr-subtitle']} default-regular`}>{t('publicChannelPage.QRStandardText', {chain})}</div>
)}
</div>
<div id="qr-wrapper" ref={ref} className={`text-center ${styles['crypto-option']}`}></div>
<div id="qr-wrapper" ref={ref} className={`text-center ${styles['qr-box']}`}></div>
<div className={`${styles['qr-text']}`}>
<div className={`${styles['qr-text-item']}`}>
<Icon name='smartphone-laptop' className="pr-3"/>
<Icon name='smartphone-laptop' className={`${styles['qr-text-icon']} pr-3 color-interactive`} />
</div>
<div className={`${styles['qr-text-item']}`}>
{t('publicChannelPage.QRModalText')}
Expand Down
Loading

0 comments on commit ece9c7c

Please sign in to comment.