This repository was archived by the owner on Mar 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
feat: display course topics status #1595
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ced6c85
feat: display course topics status
gabriele-ct 9dbea5f
feat: initial design icon implementation
gabriele-ct cefb159
chore: refined UI
gabriele-ct b684813
chore: don't display any icon if the user is not logged in
gabriele-ct 8bf750b
chore: refactor feature flags
gabriele-ct c816d9b
chore: refactor feature flags
gabriele-ct 76de1cb
chore: changest
gabriele-ct b0a2866
chore: style checker
gabriele-ct 2d8a5a0
chore: un-necessary string quotes
gabriele-ct 979b47f
Merge branch 'main' into ga-topic-status
gabriele-ct 32003f7
chore: add build time sanity check for self-learning contents
gabriele-ct 4fd57b8
Merge branch 'main' into ga-topic-status
gabriele-ct c46458a
chore: added unknown empty state spacer to avoid layout shifts during…
gabriele-ct 9546a0b
chore: fix layout shift
gabriele-ct 33964e7
chore: fix layout shift
gabriele-ct File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@commercetools-docs/gatsby-theme-learning': minor | ||
| '@commercetools-docs/gatsby-theme-docs': minor | ||
| '@commercetools-website/docs-smoke-test': minor | ||
| '@commercetools-website/documentation': minor | ||
| --- | ||
|
|
||
| Added status indicator for course and course topics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import ConfigContext from './src/components/config-context'; | ||
|
|
||
| export const wrapRootElement = ({ element }, pluginOptions) => { | ||
| return ( | ||
| <ConfigContext.Provider | ||
| value={{ | ||
| learnApiBaseUrl: pluginOptions.learnApiBaseUrl, | ||
| auth0Domain: pluginOptions.auth0Domain, | ||
| features: pluginOptions?.features || [], | ||
| }} | ||
| > | ||
| {element} | ||
| </ConfigContext.Provider> | ||
| ); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 11 additions & 6 deletions
17
packages/gatsby-theme-learning/src/components/config-context.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,24 @@ | ||
| import { createContext } from 'react'; | ||
|
|
||
| export enum EFeatureFlag { | ||
| CourseStatus = 'status-indicator', | ||
| } | ||
|
|
||
| export type Config = { | ||
| learnApiBaseUrl: string; | ||
| auth0Domain: string; | ||
| features: { | ||
| courseStatusIndicator: boolean; | ||
| }; | ||
| features: Array<EFeatureFlag>; | ||
| }; | ||
|
|
||
| const ConfigContext = createContext<Config>({ | ||
| learnApiBaseUrl: '', | ||
| auth0Domain: '', | ||
| features: { | ||
| courseStatusIndicator: false, | ||
| }, | ||
| features: [], | ||
| }); | ||
|
|
||
| export const isFeatureEnabled = ( | ||
| feature: EFeatureFlag, | ||
| features: EFeatureFlag[] | ||
| ) => features.includes(feature); | ||
|
|
||
| export default ConfigContext; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 wonder if a data structure that has defaults might be better suited. I can't really wrap my head around why exactly to be honest, it's just a feeling.
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.
not sure what you mean here. but the
feature flagfeature is working and I would descope this discussion from this PR. We can have a discussion about it and then create a separate ticket