Skip to content

Commit 43066c2

Browse files
committed
Merge branch 'main' into new-testing-api
2 parents 55c5c78 + f2d6e1d commit 43066c2

78 files changed

Lines changed: 5477 additions & 2154 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

components.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"$schema": "https://shadcn-vue.com/schema.json",
3-
"style": "default",
3+
"style": "new-york",
44
"typescript": true,
55
"tailwind": {
6-
"config": "tailwind.config.js",
6+
"config": "",
77
"css": "resources/css/shadcn.css",
88
"baseColor": "slate",
99
"cssVariables": true
1010
},
11-
"framework": "laravel",
1211
"aliases": {
1312
"components": "@/components",
1413
"utils": "@/utils/cn"

demo/app/Sharp/Dashboard/DemoDashboard.php

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
use Code16\Sharp\Dashboard\Layout\DashboardLayoutRow;
1717
use Code16\Sharp\Dashboard\Layout\DashboardLayoutSection;
1818
use Code16\Sharp\Dashboard\SharpDashboard;
19+
use Code16\Sharp\Dashboard\Widgets\SharpAreaGraphWidget;
1920
use Code16\Sharp\Dashboard\Widgets\SharpBarGraphWidget;
2021
use Code16\Sharp\Dashboard\Widgets\SharpFigureWidget;
2122
use Code16\Sharp\Dashboard\Widgets\SharpGraphWidgetDataSet;
22-
use Code16\Sharp\Dashboard\Widgets\SharpLineGraphWidget;
2323
use Code16\Sharp\Dashboard\Widgets\SharpOrderedListWidget;
2424
use Code16\Sharp\Dashboard\Widgets\SharpPanelWidget;
2525
use Code16\Sharp\Dashboard\Widgets\SharpPieGraphWidget;
@@ -31,19 +31,13 @@
3131

3232
class DemoDashboard extends SharpDashboard
3333
{
34-
private static array $colors = [
35-
'#2a9d90',
36-
'#e76e50',
37-
'#274754',
38-
'#e8c468',
39-
'#f4a462',
40-
// '#3B82F6',
41-
// '#064E3B',
42-
// '#EC4899',
43-
// '#78350F',
44-
// '#9CA3AF',
34+
const array COLORS = [
35+
'oklch(0.809 0.105 251.813)',
36+
'oklch(0.623 0.214 259.815)',
37+
'oklch(0.546 0.245 262.881)',
38+
'oklch(0.488 0.243 264.376)',
39+
'oklch(0.424 0.199 265.638)',
4540
];
46-
private static int $colorsIndex = 0;
4741

4842
protected function buildWidgets(WidgetsContainer $widgetsContainer): void
4943
{
@@ -52,19 +46,25 @@ protected function buildWidgets(WidgetsContainer $widgetsContainer): void
5246
SharpBarGraphWidget::make('authors_bar')
5347
->setTitle('Posts by author')
5448
->setShowLegend(false)
55-
->setHorizontal(),
49+
// ->setHorizontal(),
5650
)
5751
->addWidget(
5852
SharpPieGraphWidget::make('categories_pie')
5953
->setTitle('Posts by category'),
6054
)
6155
->addWidget(
62-
SharpLineGraphWidget::make('visits_line')
56+
SharpAreaGraphWidget::make('visits_line')
6357
->setTitle('Visits')
6458
->setHeight(200)
65-
->setShowLegend()
66-
->setMinimal()
67-
->setCurvedLines(),
59+
// ->setStacked()
60+
// ->setShowStackTotal(label: 'Total visits')
61+
// ->setShowLegend()
62+
->setDisplayHorizontalAxisAsTimeline()
63+
// ->setEnableHorizontalAxisLabelSampling()
64+
// ->setShowGradient()
65+
// ->setShowDots()
66+
// ->setMinimal()
67+
6868
)
6969
->addWidget(
7070
SharpFigureWidget::make('draft_panel')
@@ -176,21 +176,21 @@ protected function setLineGraphDataSet(): void
176176
{
177177
$visits = collect(CarbonPeriod::create($this->getStartDate(), $this->getEndDate()))
178178
->mapWithKeys(function (Carbon $day, $k) {
179-
return [$day->isoFormat('L') => (int) (rand(10000, 20000) * 1.02)];
179+
return [$day->format('Y-m-d') => (int) (rand(10000, 20000) * 1.02)];
180180
});
181181

182182
$this
183183
->addGraphDataSet(
184184
'visits_line',
185185
SharpGraphWidgetDataSet::make($visits)
186186
->setLabel('Visits')
187-
->setColor(static::nextColor()),
187+
->setColor(static::COLORS[0]),
188188
)
189189
->addGraphDataSet(
190190
'visits_line',
191191
SharpGraphWidgetDataSet::make($visits->map(fn ($value) => (int) ($value / (rand(20, 40) / 10))))
192192
->setLabel('New')
193-
->setColor(static::nextColor()),
193+
->setColor(static::COLORS[1]),
194194
);
195195
}
196196

@@ -205,14 +205,14 @@ protected function setBarsGraphDataSet(): void
205205
)]
206206
)
207207
->orderBy('posts_count', 'desc')
208-
->limit(8)
208+
->limit(15)
209209
->get()
210210
->pluck('posts_count', 'name');
211211

212212
$this->addGraphDataSet(
213213
'authors_bar',
214214
SharpGraphWidgetDataSet::make($data)
215-
->setColor(static::nextColor()),
215+
->setColor(static::COLORS[1]),
216216
);
217217
}
218218

@@ -229,12 +229,12 @@ protected function setPieGraphDataSet(): void
229229
->limit(5)
230230
->orderBy('posts_count', 'desc')
231231
->get()
232-
->each(function (Category $category) {
232+
->each(function (Category $category, $i) {
233233
$this->addGraphDataSet(
234234
'categories_pie',
235235
SharpGraphWidgetDataSet::make([$category->posts_count])
236236
->setLabel($category->name)
237-
->setColor(static::nextColor()),
237+
->setColor(static::COLORS[$i % count(static::COLORS)]),
238238
);
239239
});
240240
}
@@ -284,15 +284,6 @@ protected function setCustomPanelDataSet(): void
284284
}
285285
}
286286

287-
private static function nextColor(): string
288-
{
289-
if (static::$colorsIndex >= count(static::$colors)) {
290-
static::$colorsIndex = 0;
291-
}
292-
293-
return static::$colors[static::$colorsIndex++];
294-
}
295-
296287
protected function getStartDate(): Carbon
297288
{
298289
return $this->queryParams->filterFor(PeriodRequiredFilter::class)->getStart();

demo/database/seeders/DatabaseSeeder.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public function run()
2626
$editor2 = User::factory(['email' => 'editor2@example.org'])
2727
->create();
2828

29+
User::factory(50)->create();
30+
2931
collect([$admin, $editor1, $editor2])
3032
->shuffle()
3133
->each(function (User $user, int $k) {

dist/assets/CardDescription.vue_vue_type_script_setup_true_lang-Bap6wgVL.js renamed to dist/assets/CardDescription.vue_vue_type_script_setup_true_lang-DtTR16bm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/Dashboard-1KmnU79N.js

Lines changed: 441 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/Dashboard-ByZJWhzV.js

Lines changed: 0 additions & 838 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/DropdownChevronDown.vue_vue_type_script_setup_true_lang-BWhk_XY_.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/DropdownChevronDown.vue_vue_type_script_setup_true_lang-BpPinqBw.js

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)