Skip to content

Commit a3fb4a5

Browse files
V2 (#216)
* Add support for 'extras' disk and bundling application resources * Change path to extras * add webPreferences to docs * update packages * update filament resources * duplicate v1 docs * update namespaces to `Native\Desktop` * update installation instructions * target v2 branch * target v2 branch * fix namespace * add `native:init` to the broadcasting docs * basic version switcher * page-switcher fallback fallback to introduction when target page doesn't exist * add context * version switcher styling * update vertical margins * version switcher - final touches * add fill currentColor * add desktop repo to release notes * added v2 upgrade guide * spelling & sentence flow * wip - wording * update links * rename `native:serve` to `native:run` * wip - missed a `native:serve` reference * remove references to Tauri * improve wording & open outbound links in new tab * add `ChildProcess::node()` to docs * updated node example * update upgdrade guide * update upgrade guide * add `assertNode` to childprocess fake * add `Shell` fake * improve assertion naming * Fix link * Update links * More links * Update support policy * Remove Tauri --------- Co-authored-by: Simon Hamp <[email protected]>
1 parent a529ac5 commit a3fb4a5

File tree

82 files changed

+6255
-801
lines changed

Some content is hidden

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

82 files changed

+6255
-801
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ Also, be sure to read our [contributing guidelines](CONTRIBUTING.md) for help ge
1010

1111
## Issues
1212

13-
Please raise any issues on the [NativePHP/laravel](https://github.com/NativePHP/laravel/issues) repo.
13+
Please raise any issues on the [NativePHP/desktop](https://github.com/nativephp/desktop/issues) repo.

app/Livewire/VersionSwitcher.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
namespace App\Livewire;
4+
5+
use Illuminate\View\ViewException;
6+
use Livewire\Component;
7+
8+
class VersionSwitcher extends Component
9+
{
10+
public string $platform;
11+
12+
public array $versions;
13+
14+
public int $version;
15+
16+
public string $page;
17+
18+
public function mount(array $versions)
19+
{
20+
// Since the props are always bound to the uri we fetch them
21+
// from the route instead of prop drilling or adding
22+
// single-use view data to the controller
23+
24+
throw_unless(
25+
request()->route()->named('docs.show'),
26+
ViewException::class,
27+
"The version switcher can only be used on the 'docs.show' route."
28+
);
29+
30+
$this->platform = request()->route()->parameter('platform');
31+
$this->version = request()->route()->parameter('version');
32+
$this->page = request()->route()->parameter('page');
33+
$this->versions = $versions;
34+
}
35+
36+
public function updatedVersion()
37+
{
38+
if (! $this->pageExists($this->platform, $this->version, $this->page)) {
39+
$this->page = 'introduction';
40+
}
41+
42+
return redirect()->route('docs.show', [
43+
'platform' => $this->platform,
44+
'version' => $this->version,
45+
'page' => $this->page,
46+
]);
47+
}
48+
49+
protected function pageExists(string $platform, int $version, string $page): bool
50+
{
51+
return file_exists(resource_path("views/docs/{$platform}/{$version}/{$page}.md"));
52+
}
53+
}

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ private function registerSharedViewVariables(): void
4848
? GitHub::electron()->latestVersion()
4949
: 'dev'
5050
);
51-
View::share('discordLink', 'https://discord.gg/X62tWNStZK');
51+
View::share('discordLink', 'https://discord.gg/nativephp');
5252
View::share('bskyLink', 'https://bsky.app/profile/nativephp.bsky.social');
5353
View::share('openCollectiveLink', 'https://opencollective.com/nativephp');
54-
View::share('githubLink', 'https://github.com/NativePHP');
54+
View::share('githubLink', 'https://github.com/nativephp');
5555
}
5656

5757
private function sendFailingJobsToSentry(): void

app/Support/GitHub.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,26 @@ class GitHub
1313

1414
public const PACKAGE_LARAVEL = 'nativephp/laravel';
1515

16+
public const PACKAGE_DESKTOP = 'nativephp/desktop';
17+
1618
public const PACKAGE_PHP_BIN = 'nativephp/php-bin';
1719

1820
public function __construct(
1921
private string $package
2022
) {}
2123

24+
public static function desktop(): static
25+
{
26+
return new static(static::PACKAGE_DESKTOP);
27+
}
28+
29+
// V1
2230
public static function electron(): static
2331
{
2432
return new static(static::PACKAGE_ELECTRON);
2533
}
2634

35+
// V1
2736
public static function laravel(): static
2837
{
2938
return new static(static::PACKAGE_LARAVEL);

0 commit comments

Comments
 (0)