Skip to content

Commit e7f7405

Browse files
authored
Merge pull request #90 from NativePHP/hassan/new-design
🖌️ New website design
2 parents 8620c8a + 4524b6a commit e7f7405

File tree

84 files changed

+5308
-1099
lines changed

Some content is hidden

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

84 files changed

+5308
-1099
lines changed

.gitignore

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,55 @@
1+
# php unit
12
/.phpunit.cache
3+
.phpunit.result.cache
4+
5+
# auth
6+
auth.json
7+
8+
# node_modules
29
/node_modules
3-
/public/build
10+
11+
# public
412
/public/hot
513
/public/storage
14+
/public/build
15+
/public/sitemap.xml
16+
17+
# storage
618
/storage/*.key
19+
20+
# vendor
721
/vendor
8-
.env
9-
.env.backup
10-
.env.production
11-
.phpunit.result.cache
22+
23+
# ide
24+
/.fleet
25+
/.idea
26+
/.vscode
27+
_ide_helper*
28+
.phpstorm.meta.php
29+
30+
# .env
31+
.env*
32+
33+
# cache
34+
*.cache
35+
36+
# homestead
1237
Homestead.json
1338
Homestead.yaml
14-
auth.json
39+
40+
# docker
41+
docker-compose.override.yml
42+
43+
# package managers
1544
npm-debug.log
1645
yarn-error.log
17-
/.fleet
18-
/.idea
19-
/.vscode
46+
47+
# logs
48+
worker.log
49+
50+
# windows
51+
*:Zone.Identifier
52+
Thumbs.db
53+
54+
# mac
55+
.DS_Store

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/dist
2+
**/package-lock.json
3+
public/build

.prettierrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"plugins": ["prettier-plugin-blade", "prettier-plugin-tailwindcss"],
3+
"overrides": [
4+
{
5+
"files": ["*.blade.php"],
6+
"options": {
7+
"parser": "blade"
8+
}
9+
}
10+
],
11+
"tailwindConfig": "./tailwind.config.js",
12+
"singleQuote": true,
13+
"semi": false,
14+
"trailingComma": "all",
15+
"singleAttributePerLine": true
16+
}

app/Extensions/TorchlightWithCopyExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function defaultBlockRenderer()
1515
return <<<HTML
1616
<div x-data="codeBlock" class="torchlight-with-copy relative md:rounded-md">
1717
<div class="flex space-x items-center absolute top-0 right-0">
18-
<div x-cloak x-show="showMessage" x-transition class="py-1 transition duration-300 text-indigo-400 font-bold">Copied!</div>
18+
<div x-show="showMessage" x-transition class="py-1 transition duration-300 text-indigo-400 font-bold">Copied!</div>
1919
<button
2020
type="button"
2121
title="Copy to clipboard"

app/Http/Controllers/ShowDocumentationController.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ protected function getPageProperties($platform, $version, $page = null): array
8585
<a href="'.$nav['children'][0]['path'].'" class="flex items-center gap-2 justify-between" x-on:click.prevent="open = !open">
8686
<span>'.$nav['title'].'</span>
8787
<span class="text-gray-400 dark:text-gray-600">
88-
<svg x-show="open" x-cloak class="size-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
89-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
90-
</svg>
91-
<svg x-show="!open" x-cloak class="size-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
88+
<svg class="size-3 transition duration-300 will-change-transform ease-in-out" :class="{\'rotate-180\': open,}" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
9289
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 15l7-7 7 7"></path>
9390
</svg>
9491
</span>
@@ -99,7 +96,6 @@ protected function getPageProperties($platform, $version, $page = null): array
9996
->setAttributes([
10097
'x-show' => 'open',
10198
'x-collapse' => '',
102-
'x-cloak' => '',
10399
]);
104100
foreach ($nav['children'] as $child) {
105101
$submenu->link($child['path'], $child['title']);

app/Providers/AppServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Providers;
44

5+
use App\Support\GitHub;
56
use Illuminate\Support\Facades\View;
67
use Illuminate\Support\ServiceProvider;
78

@@ -12,19 +13,20 @@ class AppServiceProvider extends ServiceProvider
1213
*/
1314
public function register(): void
1415
{
15-
$this->registerSharedViewVariables();
16+
//
1617
}
1718

1819
/**
1920
* Bootstrap any application services.
2021
*/
2122
public function boot(): void
2223
{
23-
//
24+
$this->registerSharedViewVariables();
2425
}
2526

2627
private function registerSharedViewVariables(): void
2728
{
29+
View::share('electronGitHubVersion', GitHub::electron()->latestVersion());
2830
View::share('discordLink', 'https://discord.gg/X62tWNStZK');
2931
View::share('bskyLink', 'https://bsky.app/profile/nativephp.bsky.social');
3032
View::share('openCollectiveLink', 'https://opencollective.com/nativephp');

app/Support/GitHub.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
namespace App\Support;
4+
5+
use Illuminate\Support\Facades\Cache;
6+
use Illuminate\Support\Facades\Http;
7+
8+
class GitHub
9+
{
10+
public const PACKAGE_ELECTRON = 'nativephp/electron';
11+
12+
public const PACKAGE_LARAVEL = 'nativephp/laravel';
13+
14+
public function __construct(
15+
private string $package
16+
) {}
17+
18+
public static function electron(): static
19+
{
20+
return new static(static::PACKAGE_ELECTRON);
21+
}
22+
23+
public static function laravel(): static
24+
{
25+
return new static(static::PACKAGE_LARAVEL);
26+
}
27+
28+
public function latestVersion()
29+
{
30+
$version = Cache::remember(
31+
$this->getCacheKey('latest-version'),
32+
now()->addHour(),
33+
function () {
34+
return $this->fetchLatestVersion();
35+
}
36+
);
37+
38+
return $version['name'] ?? 'Unknown';
39+
}
40+
41+
private function fetchLatestVersion()
42+
{
43+
// Make a request to GitHub
44+
$response = Http::get('https://api.github.com/repos/'.$this->package.'/releases/latest');
45+
46+
// Check if the request was successful
47+
if ($response->failed()) {
48+
return null;
49+
}
50+
51+
return $response->json();
52+
}
53+
54+
private function getCacheKey(string $string): string
55+
{
56+
return sprintf('%s-%s', $this->package, $string);
57+
}
58+
}

config/seotools.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
'type' => false,
4444
'site_name' => false,
4545
'images' => [
46-
'/img/og.png',
46+
'/img/og.jpg',
4747
],
4848
],
4949
],

0 commit comments

Comments
 (0)