' .
+ return '
' .
$table->generate() .
'
';
}
diff --git a/app/Language/en/Podcast.php b/app/Language/en/Podcast.php
index ec83a05e..0683cb2d 100644
--- a/app/Language/en/Podcast.php
+++ b/app/Language/en/Podcast.php
@@ -11,8 +11,8 @@ declare(strict_types=1);
return [
'all_podcasts' => 'All podcasts',
'no_podcast' => 'No podcast found!',
- 'create' => 'Create a podcast',
- 'import' => 'Import a podcast',
+ 'create' => 'Create podcast',
+ 'import' => 'Import podcast',
'new_episode' => 'New Episode',
'feed' => 'RSS',
'view' => 'View podcast',
diff --git a/app/Models/PersonModel.php b/app/Models/PersonModel.php
index 41cc30a2..36fba45c 100644
--- a/app/Models/PersonModel.php
+++ b/app/Models/PersonModel.php
@@ -62,7 +62,7 @@ class PersonModel extends Model
protected $validationRules = [
'full_name' => 'required',
'unique_name' =>
- 'required|regex_match[/^[a-z0-9\-]{1,191}$/]|is_unique[persons.unique_name,id,{id}]',
+ 'required|regex_match[/^[a-z0-9\-]{1,32}$/]|is_unique[persons.unique_name,id,{id}]',
'created_by' => 'required',
'updated_by' => 'required',
];
diff --git a/app/Models/PodcastModel.php b/app/Models/PodcastModel.php
index 8022db3a..5e185491 100644
--- a/app/Models/PodcastModel.php
+++ b/app/Models/PodcastModel.php
@@ -10,6 +10,7 @@ declare(strict_types=1);
namespace App\Models;
+use App\Entities\Actor;
use App\Entities\Podcast;
use CodeIgniter\Database\Query;
use CodeIgniter\HTTP\URI;
@@ -88,7 +89,7 @@ class PodcastModel extends Model
protected $validationRules = [
'title' => 'required',
'handle' =>
- 'required|regex_match[/^[a-zA-Z0-9\_]{1,191}$/]|is_unique[podcasts.handle,id,{id}]',
+ 'required|regex_match[/^[a-zA-Z0-9\_]{1,32}$/]|is_unique[podcasts.handle,id,{id}]',
'description_markdown' => 'required',
'image_path' => 'required',
'language_code' => 'required',
@@ -102,7 +103,7 @@ class PodcastModel extends Model
/**
* @var string[]
*/
- protected $beforeInsert = ['createPodcastActor'];
+ protected $beforeInsert = ['setPodcastGUID', 'createPodcastActor'];
/**
* @var string[]
@@ -489,4 +490,19 @@ class PodcastModel extends Model
return $data;
}
+
+ /**
+ * @param mixed[] $data
+ *
+ * @return mixed[]
+ */
+ protected function setPodcastGUID(array $data): array
+ {
+ if (! array_key_exists('guid', $data['data']) || $data['data']['guid'] === null) {
+ helper('misc');
+ $data['data']['guid'] = podcast_uuid(url_to('podcast_feed', $data['data']['handle']));
+ }
+
+ return $data;
+ }
}
diff --git a/app/Resources/js/modules/markdown-write-preview.ts b/app/Resources/js/modules/markdown-write-preview.ts
index 7c8947c3..7c10359b 100644
--- a/app/Resources/js/modules/markdown-write-preview.ts
+++ b/app/Resources/js/modules/markdown-write-preview.ts
@@ -1,4 +1,4 @@
-import { html, LitElement, TemplateResult } from "lit";
+import { css, html, LitElement, TemplateResult } from "lit";
import { customElement, property, queryAssignedNodes } from "lit/decorators.js";
import { MarkdownPreview } from "./markdown-preview";
@@ -28,20 +28,48 @@ export class MarkdownWritePreview extends LitElement {
) as MarkdownPreview;
}
+ firstUpdated(): void {
+ this.write();
+ }
+
write(): void {
this._markdownPreview.hide();
- this._write[0].classList.add("font-semibold");
- this._preview[0].classList.remove("font-semibold");
+ this._write[0].classList.add("active");
+ this._preview[0].classList.remove("active");
}
preview(): void {
this._markdownPreview.show();
- this._preview[0].classList.add("font-semibold");
- this._write[0].classList.remove("font-semibold");
+ this._preview[0].classList.add("active");
+ this._write[0].classList.remove("active");
}
+ static styles = css`
+ ::slotted(button) {
+ opacity: 0.5;
+ }
+
+ ::slotted(button.active) {
+ position: relative;
+ opacity: 1;
+ }
+
+ ::slotted(button.active)::after {
+ content: "";
+ position: absolute;
+ bottom: -2px;
+ left: 0;
+ right: 0;
+ width: 80%;
+ height: 4px;
+ margin: 0 auto;
+ background-color: #009486;
+ border-radius: 9999px;
+ }
+ `;
+
render(): TemplateResult<1> {
- return html`
+ return html`
`;
}
}
diff --git a/app/Views/Components/Button.php b/app/Views/Components/Button.php
index 34473df4..dc2080fc 100644
--- a/app/Views/Components/Button.php
+++ b/app/Views/Components/Button.php
@@ -28,29 +28,29 @@ class Button extends Component
public function render(): string
{
$baseClass =
- 'inline-flex items-center justify-center font-semibold shadow-xs rounded-full focus:outline-none focus:ring';
+ 'flex-shrink-0 inline-flex items-center justify-center font-semibold shadow-xs rounded-full focus:outline-none focus:ring-2 focus:ring-pine-500 focus:ring-offset-2 focus:ring-offset-pine-100';
$variantClass = [
'default' => 'text-black bg-gray-300 hover:bg-gray-400',
'primary' => 'text-white bg-pine-500 hover:bg-pine-800',
- 'secondary' => 'text-white bg-gray-700 hover:bg-gray-800',
+ 'secondary' => 'border-2 border-pine-500 text-pine-500 bg-pine-100 hover:border-pine-800 hover:text-pine-800',
'accent' => 'text-white bg-rose-600 hover:bg-rose-800',
- 'success' => 'text-white bg-green-600 hover:bg-green-700',
+ 'success' => 'text-white bg-pine-500 hover:bg-pine-800',
'danger' => 'text-white bg-red-600 hover:bg-red-700',
'warning' => 'text-black bg-yellow-500 hover:bg-yellow-600',
'info' => 'text-white bg-blue-500 hover:bg-blue-600',
];
$sizeClass = [
- 'small' => 'text-xs md:text-sm',
- 'base' => 'text-sm md:text-base',
- 'large' => 'text-lg md:text-xl',
+ 'small' => 'text-xs leading-6',
+ 'base' => 'text-sm leading-5',
+ 'large' => 'text-base leading-6',
];
$basePaddings = [
- 'small' => 'px-2 md:px-3 md:py-1',
- 'base' => 'px-3 py-1 md:px-4 md:py-2',
- 'large' => 'px-3 py-2 md:px-5',
+ 'small' => 'px-2 py-1',
+ 'base' => 'px-3 py-2',
+ 'large' => 'px-4 py-2',
];
$squaredPaddings = [
@@ -76,11 +76,11 @@ class Button extends Component
}
if ($this->iconLeft !== '') {
- $this->slot = '
' . $this->slot;
+ $this->slot = '
' . $this->slot;
}
if ($this->iconRight !== '') {
- $this->slot .= '
';
+ $this->slot .= '
';
}
unset($this->attributes['slot']);
diff --git a/app/Views/Components/Forms/FormComponent.php b/app/Views/Components/Forms/FormComponent.php
index 818f1ff5..251187ef 100644
--- a/app/Views/Components/Forms/FormComponent.php
+++ b/app/Views/Components/Forms/FormComponent.php
@@ -31,11 +31,6 @@ class FormComponent extends Component
public function setRequired(string $value): void
{
$this->required = $value === 'true';
- if ($this->required) {
- $this->attributes['required'] = 'required';
- } else {
- unset($this->attributes['required']);
- }
}
public function setReadonly(string $value): void
diff --git a/app/Views/Components/Forms/MarkdownEditor.php b/app/Views/Components/Forms/MarkdownEditor.php
index 4a729729..1c064ae5 100644
--- a/app/Views/Components/Forms/MarkdownEditor.php
+++ b/app/Views/Components/Forms/MarkdownEditor.php
@@ -36,31 +36,33 @@ class MarkdownEditor extends FormComponent
return <<
-