-
Notifications
You must be signed in to change notification settings - Fork 81
Product tour #3065
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
Merged
Merged
Product tour #3065
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e5e94f2
Product tour doc skeleton
mnocon 0b4a2f7
Review feedback
mnocon 2498bb9
Vale
mnocon 1ba34c7
Review feedback - part 2
mnocon be4a158
Added doc for the new config
mnocon 7bd3cbf
Merge remote-tracking branch 'origin/4.6' into product-tour
mnocon f12bdcb
Review feedback
mnocon ac613fd
Adjusted includes
mnocon 732b6cc
Wording
mnocon a3e33a9
Specified button name
mnocon c356d27
Removed TODO
mnocon 2aafb8b
Help Center and Product tour enabled by default
mnocon a40e9ca
Added images and interactive demo
mnocon 16ff8ea
Apply suggestions from code review
mnocon 8eef362
Manual changes
mnocon 7f38c08
[TMP] Fix build
mnocon fabd783
Fixed build
mnocon ccb6031
Reworded
mnocon 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,45 @@ | ||
| TODO: | ||
| 1) PHP API reference + links | ||
| 2) Arcade video | ||
| 1) Czy typ image działa? Chyba nie? | ||
| 5) Screenshoty | ||
| 6) Custom block type? | ||
|
|
||
| --- | ||
| description: Customize product tour scenarios by creating custom step blocks | ||
| edition: lts-update | ||
| month_change: false | ||
| --- | ||
|
|
||
| # Create custom step blocks | ||
|
|
||
| TODO: This is not possible | ||
|
|
||
| When creating [product tour scenarios](integrated_help.md#product-tours) you're not limited to the [built-in step blocks](configure_product_tour.md#block-types). | ||
| You can create custom block types, allowing you create reusable blocks that can be shared between scenarios. | ||
|
|
||
| It's a more customizable alternative the [custom Twig block](configure_product_tour.md#custom-twig-template-block), as you can pass custom variables and add additional logic before rendering the template. | ||
|
|
||
| The following example creates a custom `tip` block, a reusable component that you can use in different steps to provide tips to the user. | ||
|
|
||
| To create a custom step block, start by creating a class implementing the `Ibexa\Contracts\IntegratedHelp\Builder\Block\BlockBuilderInterface` interface. | ||
| This class is responsbile for converting the YAML configuration into PHP objects. | ||
|
|
||
| ``` php | ||
| ``` | ||
|
|
||
| Register it as a Symfony service and use the `ibexa.product_tour.block_factory` service tag to register is as a custom block configuration option: | ||
|
|
||
| ``` yaml | ||
| ``` | ||
|
|
||
| Then, create a class responsible for rendering the block: | ||
|
|
||
| ``` php | ||
| ``` | ||
|
|
||
| Register it as a Symfony service and use the `ibexa.product_tour.block_renderer` service tag to mark the class as a custom block renderer. | ||
|
|
||
| ``` yaml | ||
|
|
||
| ``` |
39 changes: 39 additions & 0 deletions
39
code_samples/back_office/product_tour/config/general_scenario.yaml
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,39 @@ | ||
| ibexa: | ||
| system: | ||
| default: | ||
| product_tour: | ||
| my_general_scenario: | ||
| type: 'general' | ||
| steps: | ||
| welcome_step: | ||
| step_title_translation_key: title | ||
| background_image: build/images/headless.png | ||
| blocks: | ||
| - type: title | ||
| params: | ||
| text_translation_key: subtitle | ||
| - type: text | ||
| params: | ||
| text_translation_key: tour.step.description | ||
| - type: link | ||
| params: | ||
| url: https://doc.ibexa.co | ||
| text_translation_key: tour.link.documentation | ||
| - type: image | ||
| params: | ||
| src: /bundles/ibexaadminui/img/feature-screenshot.jpg | ||
| alt_translation_key: tour.image.alt | ||
| - type: video | ||
| params: | ||
| # 'Big Buck Bunny' licensed under CC 3.0 by the Blender foundation. Hosted by archive.org | ||
|
Contributor
Author
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. |
||
| url: https://archive.org/download/BigBuckBunny_124/Content/big_buck_bunny_720p_surround.mp4 | ||
| - type: list | ||
| params: | ||
| title_translation_key: tour.list.title | ||
| items_translation_keys: | ||
| - tour.list.item1 | ||
| - tour.list.item2 | ||
| - tour.list.item3 | ||
| - type: twig_template | ||
| params: | ||
| template: custom_template.html.twig | ||
39 changes: 39 additions & 0 deletions
39
code_samples/back_office/product_tour/config/targetable_scenario.yaml
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,39 @@ | ||
| ibexa: | ||
| system: | ||
| default: | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
| product_tour: | ||
| targetable_dashboard_scenario: | ||
| type: 'targetable' | ||
| steps: | ||
| dashboard_options: | ||
| step_title_translation_key: Open Dashboard options | ||
| target: ".ibexa-db-header__more" | ||
| # No interaction_mode specified or the value is set to null | ||
| blocks: | ||
| - type: text | ||
| params: | ||
| text_translation_key: Learn how to customize the blocks displayed on your dashboard | ||
| open_dashboard_options: | ||
| step_title_translation_key: Open Dashboard options | ||
| target: '.ibexa-db-header__more' | ||
| interaction_mode: clickable | ||
| blocks: | ||
| - type: text | ||
| params: | ||
| text_translation_key: Click here to customize your dashboard | ||
| customize_dashboard: | ||
| step_title_translation_key: Customize Dashboard | ||
| target: '.ibexa-db-actions-popup-menu' | ||
| interaction_mode: clickable | ||
| blocks: | ||
| - type: text | ||
| params: | ||
| text_translation_key: Choose "Customize dashboard" | ||
| drag_and_drop_step: | ||
| step_title_translation_key: Drag-and-drop blocks | ||
| target: ".c-pb-toolbox-blocks-group__blocks > * .c-pb-toolbox-block__content:first-of-type" | ||
| interaction_mode: draggable | ||
| blocks: | ||
| - type: text | ||
| params: | ||
| text_translation_key: Drag-and-drop blocks from the sidebar to the dashboard to customize it | ||
65 changes: 65 additions & 0 deletions
65
code_samples/back_office/product_tour/src/EventSubscriber/NotificationScenarioSubscriber.php
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,65 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace App\EventSubscriber; | ||
|
|
||
| use Ibexa\Contracts\Core\Repository\NotificationService; | ||
| use Ibexa\Contracts\IntegratedHelp\Event\RenderProductTourScenarioEvent; | ||
| use Ibexa\IntegratedHelp\ProductTour\Block\LinkBlock; | ||
| use Ibexa\IntegratedHelp\ProductTour\Block\TextBlock; | ||
| use Ibexa\IntegratedHelp\ProductTour\ProductTourStep; | ||
| use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
|
||
| final class NotificationScenarioSubscriber implements EventSubscriberInterface | ||
| { | ||
| private NotificationService $notificationService; | ||
|
|
||
| public function __construct(NotificationService $notificationService) | ||
| { | ||
| $this->notificationService = $notificationService; | ||
| } | ||
|
|
||
| public static function getSubscribedEvents(): array | ||
| { | ||
| return [ | ||
| RenderProductTourScenarioEvent::class => ['onRenderScenario'], | ||
| ]; | ||
| } | ||
|
|
||
| public function onRenderScenario(RenderProductTourScenarioEvent $event): void | ||
| { | ||
| $scenario = $event->getScenario(); | ||
| $steps = $scenario->getSteps(); | ||
|
|
||
| if ($scenario->getIdentifier() !== 'notifications') { | ||
| return; | ||
| } | ||
|
|
||
| foreach ($steps as $step) { | ||
| $scenario->removeStep($step); | ||
| } | ||
|
|
||
| if (!$this->hasUnreadNotifications()) { | ||
| return; | ||
| } | ||
|
|
||
| $customStep = new ProductTourStep(); | ||
| $customStep->setIdentifier('custom_step_identifier'); | ||
| $customStep->setInteractionMode('clickable'); | ||
| $customStep->setTarget('.ibexa-header-user-menu__notifications-toggler'); | ||
| $customStep->setTitle('You have unread notifications'); | ||
| $customStep->addBlock(new TextBlock('Click here to preview your unread notifications.')); | ||
| $customStep->addBlock(new LinkBlock( | ||
| 'https://doc.ibexa.co/projects/userguide/en/latest/getting_started/notifications/', | ||
| 'Learn more about notifications' | ||
| )); | ||
|
|
||
| $scenario->addStep($customStep); | ||
| } | ||
|
|
||
| private function hasUnreadNotifications(): bool | ||
| { | ||
| return $this->notificationService->getPendingNotificationCount() > 0; | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -75,7 +75,8 @@ | |
| "ibexa/messenger": "~4.6.x-dev", | ||
| "ibexa/collaboration": "~4.6.x-dev", | ||
| "ibexa/share": "~4.6.x-dev", | ||
| "ibexa/phpstan": "~4.6.-dev" | ||
| "ibexa/phpstan": "~4.6.-dev", | ||
| "ibexa/integrated-help": "dev-dev as 4.6.x-dev" | ||
|
Contributor
Author
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. TMP branch to make PHPStan happy |
||
| }, | ||
| "scripts": { | ||
| "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", | ||
|
|
||
Oops, something went wrong.
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.
This comment was marked as resolved.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.