-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/brave rewards ui rebase2 #1162
Changes from 9 commits
04ba6a6
4dfadcc
6b20c03
59e7d13
0f69b44
5316d07
ed1c97a
6979ddb
9dc5778
367975a
160467f
2a503f5
8cdc4f6
6439374
f583149
ca34e5c
a91ea90
d199dc3
556b0e7
f8dc6b9
203b088
56e5910
db7c46e
6f668e1
1a576f5
43c9811
00ba18c
799bd93
66c4706
26e4a12
68d8fb0
b44b4bd
c6047b5
fa51e61
a135e81
a91d37e
3573733
a346724
1a01c39
cf30298
4509679
410ff60
8561b00
841b573
1cf4841
6d32826
326f9eb
6692337
e82e3dc
419028e
ed19b8a
07d7abf
de107af
bef7467
1e20f8f
2ca0dc6
821b892
2ad4fb4
a1c0a28
c52a014
59c9344
fc4ae8d
6cdd5c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
{ | ||
"presets": [ | ||
["env", { | ||
"modules": false, | ||
"targets": { | ||
"browsers": "> 1%", | ||
"uglify": true | ||
}, | ||
"useBuiltIns": true | ||
}] | ||
[ | ||
"env", | ||
{ | ||
"modules": false, | ||
"targets": { | ||
"browsers": "> 1%", | ||
"uglify": true | ||
}, | ||
"useBuiltIns": true | ||
} | ||
], | ||
"react" | ||
], | ||
|
||
"plugins": [ | ||
"syntax-dynamic-import", | ||
"transform-object-rest-spread", | ||
["transform-class-properties", { "spec": true }] | ||
[ | ||
"transform-class-properties", | ||
{ | ||
"spec": true | ||
} | ||
] | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class BannersController < ApplicationController | ||
def new | ||
@publisher_id = current_publisher.id | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
class Publishers::SiteBannersController < ApplicationController | ||
def new | ||
@site_banner = current_publisher.site_banner || SiteBanner.new | ||
end | ||
|
||
def create | ||
site_banner = current_publisher.site_banner || SiteBanner.new | ||
donation_amounts = JSON.parse(params[:donation_amounts]) | ||
site_banner.update( | ||
publisher_id: current_publisher.id, | ||
title: params[:title], | ||
donation_amounts: donation_amounts, | ||
default_donation: donation_amounts[1], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use some syntactic sugar and say something like |
||
social_links: params[:social_links], | ||
description: params[:description] | ||
) | ||
head :ok | ||
end | ||
|
||
def update_logo | ||
site_banner = current_publisher.site_banner | ||
update_image(site_banner.logo) | ||
head :ok | ||
end | ||
|
||
def update_background_image | ||
site_banner = current_publisher.site_banner | ||
update_image(site_banner.background_image) | ||
head :ok | ||
end | ||
|
||
private | ||
|
||
def update_image(attachment) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there an attachment size limit anywhere? otherwise someone can try to take up all our s3 space There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in |
||
data_url = params[:image].split(',')[0] | ||
if data_url.starts_with?("data:image/jpeg") | ||
content_type = "image/jpeg" | ||
extension = ".jpg" | ||
elsif data_url.starts_with?("data:image/png") | ||
content_type = "image/png" | ||
extension = ".png" | ||
else | ||
# TODO: Throw an exception here | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we resolve this TODO? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Going to track in https://github.com/brave-intl/publishers/issues/1179 |
||
end | ||
filename = Time.now.to_s.gsub!(" ", "_").gsub!(":", "_") + current_publisher.id + "_logo" | ||
|
||
file = Tempfile.new([filename, extension]) | ||
File.open(file.path, 'wb') do |f| | ||
f.write(Base64.decode64(params[:image].split(',')[1])) | ||
end | ||
attachment.attach(io: open(file.path), | ||
filename: filename, | ||
content_type: content_type | ||
) | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
const locale = { | ||
about: 'about', | ||
addFunds: 'add funds', | ||
allowTip: 'Allow tips on', | ||
braveRewards: 'Brave Rewards', | ||
cancel: 'Cancel', | ||
claim: 'Claim', | ||
copy: 'Copy', | ||
currentDonation: 'You’re currently donating {{currentDonation}} BAT to this site every month.', | ||
detail: 'Detail', | ||
donationAmount: 'Donation amount', | ||
done: 'Done', | ||
earningsAds: 'Earnings from Brave Ads', | ||
expiresOn: 'expires on', | ||
import: 'import', | ||
makeMonthly: 'Make this monthly', | ||
monthApr: 'Apr', | ||
monthAug: 'August', | ||
monthDec: 'December', | ||
monthFeb: 'February', | ||
monthJan: 'January', | ||
monthJul: 'July', | ||
monthJun: 'June', | ||
monthMar: 'March', | ||
monthMay: 'May', | ||
monthNov: 'November', | ||
monthOct: 'October', | ||
monthSep: 'September', | ||
noGrants: 'Currently no token grant is available.', | ||
notEnoughTokens: 'Not enough tokens. Please', | ||
on: 'on', | ||
oneTime: 'One time', | ||
oneTimeDonation: 'One-time Donations/Tips', | ||
print: 'Print', | ||
recoveryKeys: 'Recovery Key', | ||
recurring: 'Recurring', | ||
recurringDonations: 'Recurring Donations', | ||
remove: 'remove', | ||
restore: 'Restore', | ||
rewardsBackupText1: 'Backup your Wallet', | ||
rewardsBackupText2: 'Keep this anonymized recovery key for your Brave wallet in the safe place in case you lose access to this browser. Your funds are safe as long as you keep this recovery key either on a paper or in a device with preferably no internet connection.', | ||
rewardsBannerText1: 'Thanks for stopping by. We joined Brave’s vision of protecting your privacy because we believe that fans like you would support us in our effort to keep the web a clean and safe place to be.', | ||
rewardsBannerText2: 'Your donation is much appreciated and it encourages us to continue to improve our content.', | ||
rewardsContribute: 'Brave Contribute', | ||
rewardsContributeAttention: 'Your attention metric', | ||
rewardsContributeText1: 'You’re currently supporting', | ||
rewardsContributeVisited: 'Site visited', | ||
rewardsOffText1: 'Do you know that you’ve been paying for the web content with your data for the digital ads? You didn’t have a voice in it and worse, you’re exposed to privacy and security risks.', | ||
rewardsOffText2: 'Brave Rewards allows you to take control back.', | ||
rewardsOffText3: 'How does it work?', | ||
rewardsOffText4: 'Your attention is valuable. Get paid for the ads. And pay directly the favorite content creators at your will. That way, they can grow and continue delivering the content that delights you.', | ||
rewardsPanelEmptyText1: 'Sadly, no tokens yet.', | ||
rewardsPanelEmptyText2: '3 ways to fill your wallet:', | ||
rewardsPanelEmptyText3: 'You can add funds.', | ||
rewardsPanelEmptyText4: 'You can earn tokens from Brave Ads.', | ||
rewardsPanelEmptyText5: 'Occasionally, you will also received token grants from Brave. So keep an eye out for the alert!', | ||
rewardsPanelOffText1: 'Get Rewarded for Browsing!', | ||
rewardsPanelOffText2: 'Earn tokens for your attention to ads and pay it forward to support content creators you value!', | ||
rewardsPanelText1: 'Add, withdraw and manage funds at', | ||
rewardsPanelText2: 'Brave wallet is managed by', | ||
rewardsRestoreText1: 'Restore your Wallet', | ||
rewardsRestoreText2: 'Enter the recovery key to restore your Brave wallet. Make sure that the current wallet doesn’t have any balance or is backed up safely. Restoring a wallet replaces the current wallet and you will loose any balance if you don’t back up its recovery key.', | ||
rewardsRestoreText3: 'Enter your recovery key or', | ||
rewardsSummary: 'Rewards Summary', | ||
rewardsWhy: 'Why Brave Rewards…', | ||
saveAsFile: 'Save as File', | ||
seeAllItems: 'See all {{numItems}} items', | ||
seeAllSites: 'See all {{numSites}} sites', | ||
sendDonation: 'Send my donation', | ||
sendTip: 'Send my Tip', | ||
settings: 'Settings', | ||
siteVisited: 'Site visited', | ||
sites: 'sites', | ||
tipOnLike: 'Tip on like', | ||
tokenBalance: 'Token balance', | ||
tokenGrant: 'Token Grant', | ||
tokens: 'tokens', | ||
type: 'Type', | ||
verifiedPublisher: 'Brave Verified Publisher', | ||
walletActivity: 'Wallet Activity/ Monthly Statement', | ||
walletBalance: 'wallet balance', | ||
welcome: 'Welcome!', | ||
yourWallet: 'Your wallet' | ||
}; | ||
|
||
export default locale; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we verify these params anywhere?