Commit b05d177f authored by Yassine Doghri's avatar Yassine Doghri
Browse files

fix: update MarkdownEditor component + restyle Button and other components

parent 746b5187
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -57,14 +57,14 @@ if (! function_exists('data_table')) {
            'table_open' => '<table class="w-full whitespace-no-wrap">',

            'thead_open' =>
                '<thead class="text-xs font-semibold text-left text-gray-500 uppercase border-b">',
                '<thead class="text-xs font-semibold text-left text-gray-500 uppercase">',

            'heading_cell_start' => '<th class="px-4 py-2">',
            'cell_start' => '<td class="px-4 py-2">',
            'cell_alt_start' => '<td class="px-4 py-2">',

            'row_start' => '<tr class="bg-gray-50 hover:bg-pine-50">',
            'row_alt_start' => '<tr class="hover:bg-pine-50">',
            'row_start' => '<tr class="border-t hover:bg-pine-50">',
            'row_alt_start' => '<tr class="border-t hover:bg-pine-50">',
        ];

        $table->setTemplate($template);
@@ -89,7 +89,7 @@ if (! function_exists('data_table')) {
            return lang('Common.no_data');
        }

        return '<div class="overflow-x-auto bg-white rounded-lg shadow ' . $class . '" >' .
        return '<div class="overflow-x-auto bg-white rounded-lg border-3 border-pine-100 ' . $class . '" >' .
            $table->generate() .
            '</div>';
    }
+2 −2
Original line number Diff line number Diff line
@@ -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',
+1 −1
Original line number Diff line number Diff line
@@ -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',
    ];
+18 −2
Original line number Diff line number Diff line
@@ -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;
    }
}
+34 −6
Original line number Diff line number Diff line
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`<slot name="write" @click="${this.write}"></slot>
    return html`<slot name="write" class="active" @click="${this.write}"></slot>
      <slot name="preview" @click="${this.preview}"></slot>`;
  }
}
Loading