-
Notifications
You must be signed in to change notification settings - Fork 11
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
WRP-26847: Create theming "Hello" App #206
base: develop
Are you sure you want to change the base?
Conversation
sandstone/theming-app/src/components/ColorPicker/ColorPicker.js
Outdated
Show resolved
Hide resolved
sandstone/theming-app/src/components/ColorPicker/ColorPicker.js
Outdated
Show resolved
Hide resolved
sandstone/theming-app/src/components/PreviewSection/PreviewSection.module.less
Outdated
Show resolved
Hide resolved
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.
👍
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
…into feature/WRP-26847
* added jsdocs, comments and readme * change sample name in readme * fixed explanation in readme * minor fix in readme
* added ls2Request to save and load presets/colors * renamed sample folder to `pattern-ls2request-custom-colors` * fixed initial render bug to not display default colors while data is loading * deleted unnecessary `console.log` * added comments about luna service calls * fixed lint warnings
sandstone/pattern-ls2request-custom-colors/src/views/CustomizePanel/CustomizePanel.js
Outdated
Show resolved
Hide resolved
sandstone/pattern-ls2request-custom-colors/src/views/PresetPanel/PresetPanel.js
Outdated
Show resolved
Hide resolved
sandstone/pattern-ls2request-custom-colors/src/views/PresetPanel/PresetPanel.js
Outdated
Show resolved
Hide resolved
sandstone/pattern-ls2request-custom-colors/src/hooks/dynamicColor.js
Outdated
Show resolved
Hide resolved
|
||
useEffect(() => { | ||
if (isWebOSPlatform) { | ||
getSettings({ |
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 need subscribe option here? Does the current code get updated settings value during this app is active?
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 getSettings
call was added to fix a render issue. At first render, or when the app was refreshed, the default sandstone colors were applied to the app until the values from theme
key were fetched. So I used this call to conditionally render a loading spinner until the theme
key data is done fetching. I'll see if I can find another way to fix it.
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 was able to remove the subscription from here.
const [panelIndex, setPanelIndex] = useState(0); | ||
|
||
// when running on webOS system, wait for `theme` key data to be available, then render the view | ||
const isWebOSPlatform = platform.tv; |
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 is not safe to check platform.tv as there so many versions of webOS. Try-and-error style approach will be better. Or, we may be possible to check the availability via LS2Request first.
If we change like above, MainView has to render Panels when settings service is not available.
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 part is removed now
changeSettings({ | ||
category: 'customUi', | ||
settings: { | ||
theme: JSON.stringify(newContext) |
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 looks better to describe how 'newContext' looks like for app developers. (In comments or any other manner...)
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 added some explanatory comments
Our goal is to guide app developers to know below.
Code in this app has a role of recommended snippet. So, parts for guide need to be separated for readers. |
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 reviewed it assuming I was an external developer who knew nothing about the content, but it was so complicated that I didn't know where to start following the code.
I am afraid to say that the PR is quite far from my expectations :(
This is not the sample application, should be a code pattern or code snippet. I don't want to move the whole part of all features from the settings app. Let's focus on custom skin save/load via using setting service. These are some comments that I'd like to modify.
- I'd like to have key files explanation in the md.
- Remove Active dynamic color mode (keep this feature separately for the future but not in this sample)
- Remove Adjust skin automatically (keep this feature separately for the future but not in this sample)
- Remove Theme Preview from the preset and customize panel. Apply skins into only Theme Preview and overriding other area is too complicated. Let's update the Whole area.
- Add new Load theme panel separately so that the app can simply refer to the third view for those who need only load the skin.
Looks like a whole refactoring or redevelopment. If you feel uncomfortable to do this. It's totally OK to say no. Then, I will reassign it to my team.
@@ -0,0 +1,20 @@ | |||
## Custom Colors Generator |
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.
## Custom Colors Generator | |
## Custom Colors LS2Request pattern |
@@ -0,0 +1,20 @@ | |||
## Custom Colors Generator | |||
|
|||
A sample Enact application that uses dynamic color change feature to style components and create a personalized theme. |
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.
A sample Enact application that uses dynamic color change feature to style components and create a personalized theme. | |
A sample Enact application that how to customize a Sandstone color, save & load colors via webos setting service. |
|
||
#### Reset Theme | ||
|
||
The `Reset` button will revert all the changes to the active selected preset. |
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'd like to have a simple file structure and explanation of important file
skin={applySkin ? skin : 'neutral'} | ||
> | ||
<Panel> | ||
<Header className={css.panelHeader} subtitle="Choose preset theme" title="Theming App"> |
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.
Theming App -> Theme
<PresetPanel /> | ||
</Panel> | ||
<Panel> | ||
<Header className={css.panelHeader} subtitle="Customize theme" title="Theming App" /> |
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.
Theming App -> Theme
<Panel> | ||
<Header className={css.panelHeader} subtitle="Customize theme" title="Theming App" /> | ||
<CustomizePanel /> | ||
</Panel> |
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.
Add one more panel title "Theme" and subtitle "Load theme".
Theme content can be what you already made in the preview section
Enact-DCO-1.0-Signed-off-by: Alexandru Morariu [email protected]
Checklist
Issue Resolved / Feature Added
Create an app "themeing hello app" for changing color and do the documentation based on that app. See custom skin sample.
We need 2 separate panels (or view).
On the first view we should have all the presets
On the second view there will be the css variables customization.
Beside these view, there should be a live preview section, on the right side of the screen, just like in custom skin samples
Resolution
Additional Considerations
Renamed
custom-skin
sample tofeature-custom-skin-generator
after internal discussionLinks
WRP-26847
Comments