Skip to content
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

1.2.0 #2

Merged
merged 4 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 2
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_size = 4

[*.{yml,yaml}]
indent_size = 2
indent_style = space
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Do not export those files in the Composer archive (lighter dependency)
/.gitattributes export-ignore
/.gitignore export-ignore
/composer.lock export-ignore
/.nvmrc export-ignore
/.editorconfig export-ignore
/package.json export-ignore
/package-lock.json export-ignore
/postcss.config.js export-ignore
/tailwind.config.js export-ignore
/README.md export-ignore
/LICENSE.md export-ignore
/docs/ export-ignore
/scripts/ export-ignore
/styles/ export-ignore
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release Notes for Palette

## 1.2.0 - 2022-02-07

### Added
- New `badgeCount` property to display Craft's badge count values
- Add badge counts for primary navigation items

### Updated
- Move the Utility navigation badge count into the `badgeCount` property

### Fixed
- Exclude source files from being included in the Composer package

## 1.1.0 - 2022-02-07

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "trendyminds/craft-palette",
"description": "A command palette to easily jump to specific areas within Craft",
"type": "craft-plugin",
"version": "1.1.0",
"version": "1.2.0",
"keywords": ["palette", "craft", "craft cms", "cmdk", "spotlight", "craft plugin"],
"license": "MIT",
"authors": [
Expand Down
42 changes: 36 additions & 6 deletions scripts/palette.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,47 @@ function RenderResults() {
className={clsx(
'vtw-h-5 vtw-w-5',
active
? 'vtw-text-gray-800 dark:vtw-text-neutral-300'
? 'vtw-text-gray-800 dark:vtw-text-neutral-200'
: 'vtw-text-gray-600 dark:vtw-text-neutral-400'
)}
>
<Icon name={item.icon} />
</div>
<div className="vtw-flex vtw-flex-col vtw-gap-1">
<p className="vtw-leading-none vtw-m-0">{item.name}</p>
{item.subtitle && (
<p className="vtw-leading-none vtw-text-xs vtw-text-gray-500 dark:vtw-text-neutral-500 vtw-m-0">
{item.subtitle}
<div className="vtw-flex vtw-justify-between vtw-gap-3 vtw-flex-1">
<div className="vtw-flex vtw-flex-col vtw-gap-1 vtw-flex-1 vtw-justify-center">
<p
className={clsx(
'vtw-leading-none vtw-m-0',
active && 'dark:vtw-text-neutral-50'
)}
>
{item.name}
</p>
{item.subtitle && (
<p className="vtw-leading-none vtw-text-xs vtw-text-gray-500 dark:vtw-text-neutral-400 vtw-m-0">
{item.subtitle}
</p>
)}
</div>

{item?.badgeCount && (
<div
className={clsx(
'vtw-bg-neutral-600 dark:vtw-bg-neutral-400',
'vtw-h-5 vtw-w-5 vtw-rounded-full',
'vtw-flex vtw-items-center vtw-justify-center vtw-self-center'
)}
>
<p
className={clsx(
'vtw-text-[10px] vtw-leading-none vtw-font-bold',
'vtw-text-white dark:vtw-text-neutral-800',
'vtw-m-0'
)}
>
{item?.badgeCount}
</p>
</div>
)}
</div>
</div>
Expand All @@ -91,6 +120,7 @@ function Portal() {
icon: link.icon,
subtitle: link.subtitle,
section: link.section,
badgeCount: link?.badgeCount,
perform: () => (window.location = link.url),
}))

Expand Down
8 changes: 4 additions & 4 deletions src/assetbundles/resources/init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/assetbundles/resources/palette.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions src/controllers/ActionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ private function _navigationActions(): array
'name' => $i['label'],
'subtitle' => '',
'icon' => 'MenuIcon',
'badgeCount' =>
($i['badgeCount'] && $i['badgeCount'] > 0)
? $i['badgeCount']
: null,
'url' => UrlHelper::cpUrl($url),
];
})
Expand All @@ -87,12 +91,13 @@ private function _utilityActions(): array
{
return collect(Craft::$app->getUtilities()->getAuthorizedUtilityTypes())
->map(fn($class) => [
'name' =>
$class::badgeCount()
? "{$class::displayName()} ({$class::badgeCount()})"
: $class::displayName(),
'name' => $class::displayName(),
'subtitle' => 'Utilities',
'icon' => 'AdjustmentsIcon',
'badgeCount' =>
($class::badgeCount() && $class::badgeCount() > 0)
? $class::badgeCount()
: null,
'url' => UrlHelper::cpUrl("utilities/{$class::id()}"),
])
->toArray();
Expand Down