-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Remove unnecessary constructor * Update supported events list * Create components for new GitHub events * Fix data expectations for new events * Add CommitCommentEvent * Fix CommitCommentEvent * Cover ReleaseEvent * Update CHANGELOG
- Loading branch information
Showing
12 changed files
with
313 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
app/View/Components/Github/EventTypes/CommitCommentEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\View\Components\Github\EventTypes; | ||
|
||
use App\Models\GithubEvent; | ||
use App\Traits\CanHaveGitRef; | ||
use App\Traits\CanHavePreposition; | ||
|
||
class CommitCommentEvent extends BaseComponent | ||
{ | ||
use CanHaveGitRef, | ||
CanHavePreposition; | ||
|
||
public function __construct(GithubEvent $event) | ||
{ | ||
parent::__construct( | ||
action: $event->action, | ||
icon: 'fas fa-comment', | ||
event: $event, | ||
); | ||
|
||
if ($this->refNull($this->event->source)) return; | ||
|
||
$this->preposition = 'at'; | ||
$this->setRefName(str($this->event->source)->limit(7, '')); | ||
|
||
if (str($this->action)->contains('deleted', true)) return; | ||
|
||
$this->setRefUrl($this->repoUrl()); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/View/Components/Github/EventTypes/PullRequestReviewCommentEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\View\Components\Github\EventTypes; | ||
|
||
use App\Models\GithubEvent; | ||
use App\Traits\CanHavePreposition; | ||
use App\Traits\HasPullRequestNumber; | ||
|
||
class PullRequestReviewCommentEvent extends BaseComponent | ||
{ | ||
use CanHavePreposition, | ||
HasPullRequestNumber; | ||
|
||
/** | ||
* Create a new component instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(GithubEvent $event) | ||
{ | ||
parent::__construct( | ||
$event->action ?? 'commented on a review of', | ||
'fas fa-comment-alt', | ||
$event | ||
); | ||
|
||
$this->preposition = 'at'; | ||
$this->setPullRequestNumberText($this->event->source); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/View/Components/Github/EventTypes/PullRequestReviewEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\View\Components\Github\EventTypes; | ||
|
||
use App\Models\GithubEvent; | ||
use App\Traits\CanHavePreposition; | ||
use App\Traits\HasPullRequestNumber; | ||
|
||
class PullRequestReviewEvent extends BaseComponent | ||
{ | ||
use CanHavePreposition, | ||
HasPullRequestNumber; | ||
|
||
/** | ||
* Create a new component instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(GithubEvent $event) | ||
{ | ||
parent::__construct( | ||
$event->action ?? 'reviewed', | ||
'fas fa-edit', | ||
$event | ||
); | ||
|
||
$this->preposition = 'at'; | ||
$this->setPullRequestNumberText($this->event->source); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace App\View\Components\Github\EventTypes; | ||
|
||
use App\Models\GithubEvent; | ||
use App\Traits\CanHavePreposition; | ||
|
||
class ReleaseEvent extends BaseComponent | ||
{ | ||
use CanHavePreposition; | ||
|
||
public string $releaseText; | ||
|
||
public string $releaseUrl; | ||
|
||
/** | ||
* Create a new component instance. | ||
*/ | ||
public function __construct(GithubEvent $event) | ||
{ | ||
parent::__construct( | ||
action: $event->action, | ||
icon: 'fas fa-tag', | ||
event: $event, | ||
); | ||
|
||
$this->preposition = 'at'; | ||
$this->releaseUrl = $event->source; | ||
$this->releaseText = str($event->source)->after('releases/'); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
resources/views/components/github/event-types/commit-comment-event.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<div class="flex flex-row relative"> | ||
<div class="text-neutral-800 dark:text-neutral-500 text-center flex-none {{ $icon }}" | ||
style="width: 2rem; font-size: 22px;"></div> | ||
|
||
<div class="pl-4 flex-grow relative"> | ||
<p class="text-neutral-800 dark:text-neutral-500"> | ||
{{ $timeElapsed }} | ||
</p> | ||
|
||
<p class="font-white mt-1 text-sm leading-none"> | ||
<strong> | ||
<a href="{{ $profileUrl() }}" target="_blank"> | ||
{{ $event->user->display_login }} | ||
</a> | ||
|
||
{{ $action }} | ||
|
||
{{-- no refUrl assumes it was deleted --}} | ||
@if($refUrl === null) | ||
<span class="text-caribbeanGreen-600 dark:text-caribbeanGreen-800"> | ||
{{ $refName }} | ||
</span> | ||
@else | ||
<a href="{{ $refUrl }}" target="_blank"> | ||
{{ $refName }} | ||
</a> | ||
@endif | ||
|
||
|
||
{{ $preposition }} | ||
|
||
<a href="{{ $repoUrl() }}" target="_blank"> | ||
{{ $event->repo }} | ||
</a> | ||
</strong> | ||
</p> | ||
</div> | ||
</div> |
31 changes: 31 additions & 0 deletions
31
resources/views/components/github/event-types/pull-request-review-comment-event.blade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="flex flex-row relative"> | ||
<div class="text-neutral-800 dark:text-neutral-500 text-center flex-none {{ $icon }}" | ||
style="width: 2rem; font-size: 22px;"></div> | ||
|
||
<div class="pl-4 flex-grow relative"> | ||
<p class="text-neutral-800 dark:text-neutral-500"> | ||
{{ $timeElapsed }} | ||
</p> | ||
|
||
<p class="font-white mt-1 text-sm leading-none"> | ||
<strong> | ||
<a href="{{ $profileUrl() }}" target="_blank"> | ||
{{ $event->user->display_login }} | ||
</a> | ||
|
||
{{ $action }} | ||
|
||
<a href="{{ $repoUrl() }}/pull/{{ $event->source }}" target="_blank" | ||
class="text-caribbeanGreen-600 dark:text-caribbeanGreen-500"> | ||
{{ $pullRequestNumberText }} | ||
</a> | ||
|
||
{{ $preposition }} | ||
|
||
<a href="{{ $repoUrl() }}" target="_blank"> | ||
{{ $event->repo }} | ||
</a> | ||
</strong> | ||
</p> | ||
</div> | ||
</div> |
Oops, something went wrong.