diff --git a/CHANGES.md b/CHANGES.md index 16fcbb7..0720dfc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,13 @@ # Changelog +## v1.2.0 (TBD) + +- Added `icon_type` parameter for widgets: `fa` (Font Awesome, default) or `text` (for emoji/plain text) + ## v1.1.0 (2025-11-07) - Added support for multiple config filenames: `.disco-devbar.yaml`, `.disco-devbar.yml` -## v1.0.0 (2025-qq-05) +## v1.0.0 (2025-11-05) - Initial public release diff --git a/README.md b/README.md index ce63f8f..0d5e909 100644 --- a/README.md +++ b/README.md @@ -9,17 +9,34 @@ # Welcome! -Development toolbar/banner for Symfony worktree-based workflows. Displays project information, links -to tools, and ticket details in development environment. +**DiscoDevBar** is a developer tool that adds a customizable toolbar/banner to your Symfony application, +providing all-time access to essential development resources right from your browser. Perfect for +streamlining your development workflow by keeping frequently-used tools, admin panels, and services +just one click away. + +## What is DiscoDevBar? + +DiscoDevBar creates a persistent banner (typically placed at the top of your layout) that displays +during development. It's highly configurable via YAML, allowing you to create custom buttons and +links to anything you need: admin panels, database tools, email catchers, API documentation, or +any other development resource. + +### Perfect for Docker Environments + +Since configuration is YAML-based, it's incredibly easy to generate dynamically when setting up new +development environments. When using Docker or similar containerization, port numbers often change +between setups - but with DiscoDevBar, you can regenerate the configuration file on each environment +startup, ensuring all links always point to the correct ports and services. ## Features -- Widget-based configuration system via YAML -- Displays milestone, PR, and ticket information -- Quick links to admin panel, phpMyAdmin, Mailpit -- Customizable icons, text, and links -- Only loads in development environment -- Zero production overhead +- **Fully customizable via YAML** - Easy to configure and regenerate for different environments +- **Flexible widget system** - Create buttons with Font Awesome icons, emoji, text labels, or any combination +- **Display anything** - Add links to admin panels, database tools, email catchers, API docs, or any development resource +- **Action buttons** - Direct access to frequently-used tools and services +- **Environment-aware** - Only loads in development environment, zero production overhead +- **Dynamic configuration** - Perfect for Docker setups where ports change - regenerate config on startup +- **Customizable placement** - Position widgets on left or right side of the toolbar ## Requirements diff --git a/Resources/views/devbar.html.twig b/Resources/views/devbar.html.twig index 3e259bd..758fa61 100644 --- a/Resources/views/devbar.html.twig +++ b/Resources/views/devbar.html.twig @@ -16,7 +16,13 @@ {% if widget.target %}target="{{ widget.target }}"{% endif %} {% if widget.title %}title="{{ widget.title }}"{% endif %}> - {% if widget.icon %}{% endif %} + {% if widget.icon %} + {% if widget.iconType.value == 'fa' %} + + {% else %} + {{ widget.icon }} + {% endif %} + {% endif %} {% if widget.text %}{{ widget.text }}{% endif %} @@ -34,7 +40,13 @@ {% if widget.target %}target="{{ widget.target }}"{% endif %} {% if widget.title %}title="{{ widget.title }}"{% endif %}> - {% if widget.icon %}{% endif %} + {% if widget.icon %} + {% if widget.iconType.value == 'fa' %} + + {% else %} + {{ widget.icon }} + {% endif %} + {% endif %} {% if widget.text %}{{ widget.text }}{% endif %} diff --git a/composer.json b/composer.json index 2ebfb17..7368fa8 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "marcin-orlowski/symfony-discodevbar", "description": "Development toolbar/banner for Symfony project", "type": "symfony-bundle", - "version": "1.1.0", + "version": "1.2.0", "license": "MIT", "keywords": [ "symfony", diff --git a/src/Dto/IconType.php b/src/Dto/IconType.php new file mode 100644 index 0000000..bc7fc45 --- /dev/null +++ b/src/Dto/IconType.php @@ -0,0 +1,27 @@ + + * @copyright 2025 Marcin Orlowski + * @license https://opensource.org/license/mit MIT + * @link https://github.com/MarcinOrlowski/php-symfony-discodevbar + * + * ########################################################################## */ + +namespace MarcinOrlowski\DiscoDevBar\Dto; + +enum IconType: string +{ + case FONT_AWESOME = 'fa'; + case TEXT = 'text'; +} diff --git a/src/Dto/Widget.php b/src/Dto/Widget.php index ee171de..761dbec 100644 --- a/src/Dto/Widget.php +++ b/src/Dto/Widget.php @@ -28,7 +28,8 @@ public function __construct( public readonly string $url, public readonly string $target, public readonly string $title, - public readonly bool $expand + public readonly bool $expand, + public readonly IconType $iconType = IconType::FONT_AWESOME ) { } @@ -45,14 +46,16 @@ public static function fromArray(array $data): self $target = $data['target'] ?? ''; $title = $data['title'] ?? ''; $expand = $data['expand'] ?? false; + $iconType = $data['icon_type'] ?? 'fa'; return new self( - icon: \is_string($icon) ? $icon : '', - text: \is_string($text) ? $text : '', - url: \is_string($url) ? $url : '', - target: \is_string($target) ? $target : '', - title: \is_string($title) ? $title : '', - expand: \is_bool($expand) ? $expand : false + icon: \is_string($icon) ? $icon : '', + text: \is_string($text) ? $text : '', + url: \is_string($url) ? $url : '', + target: \is_string($target) ? $target : '', + title: \is_string($title) ? $title : '', + expand: \is_bool($expand) ? $expand : false, + iconType: IconType::tryFrom(\is_string($iconType) ? $iconType : 'fa') ?? IconType::FONT_AWESOME ); } }