-
Notifications
You must be signed in to change notification settings - Fork 877
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
Support to upload multiple custom images for NTP background #15311
Conversation
466098b
to
91ac204
Compare
91ac204
to
a30a7b8
Compare
This PR allows users to upload multiple images for NTP background. * The maximum number of images is 24 * These images are stored in a dedicated directory. * Users can select one of these or toggle on "Random" button. * Users also can remove these images.
a30a7b8
to
cc236cf
Compare
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
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.
Mostly LGTM, few comments 😄
// remove leading slash | ||
const auto path = value.path().substr(1); | ||
DCHECK(!path.empty()) << "URL path is empty " << value; | ||
url::RawCanonOutputT<char16_t> pref_value; |
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.
Just to confirm, this pref_value
doesn't have anything to do with a value in PrefService
, right?
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.
this value should be the same with a value in PrefService, but at this point, no, Prefservice don't do anything.
// be used as webui data url. | ||
url::RawCanonOutputT<char> encoded; | ||
url::EncodeURIComponent(value_.c_str(), value_.length(), &encoded); | ||
return GURL(ntp_background_images::kCustomWallpaperURL + |
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.
So the url looks something like
chrome://custom-wallpaper/background.jpgencoded-data
?
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.
actually, it will be chrome://custom-wallpaper/my_background.jpg
when it has something like ()
then it'll be chrome://custom-wallpaper/%28%29.jpg
components/brave_new_tab_ui/components/default/settings/index.ts
Outdated
Show resolved
Hide resolved
useCustomBackgroundImage: () => void | ||
chooseNewCustomImageBackground: () => void | ||
setCustomImageBackground: (selectedBackground: string) => void | ||
removeCustomImageBackground: (background: string) => void |
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.
It's so annoying how we have to drill all our props down :/
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.
Yeah, indeed. Using API directly from where it's needed could be better but not sure. Maybe it could bring more messes?
components/brave_new_tab_ui/containers/newTab/settings/backgroundChooser.tsx
Outdated
Show resolved
Hide resolved
Nice work! One more suggestion - how about enabling multiple file select from file chooser dialog? |
Good idea! It's done. Could you take a look again? |
A Storybook has been deployed to preview UI for the latest push |
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.
++ 👍🏼 I don't have more :)
@fallaciousreasoning Could you take a look again? |
A Storybook has been deployed to preview UI for the latest push |
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.
LGTM still 😄
Thank you both! |
Resolves brave/brave-browser#25761
This PR allows users to upload multiple images for NTP background.
Demo
Screen.Recording.2022-10-02.at.12.57.05.PM.mov
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Manual - things to check