Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

Add a Board view to Publish, remember the last view and redesign Settings → Channels (#499)

Paulo Castellano27b2e4529b6e
diff --git a/.agents/skills/in-app-copy/SKILL.md b/.agents/skills/in-app-copy/SKILL.md
index b3445a8b8..45ed98ff4 100644
--- a/.agents/skills/in-app-copy/SKILL.md
+++ b/.agents/skills/in-app-copy/SKILL.md
@@ -99,6 +99,7 @@ Never a bare "Nothing here".
### Toasts and success feedback
- No success toast after creating, editing, deleting or copying everyday resources: the visible change (a new row, an inline check) is the feedback (owner decision, September 2026). Errors still toast.
+- Exception: approving or rejecting a post toasts the result ("Post approved and scheduled", "Post rejected and moved to drafts", `posts.approvals.toasts.*`), because the card leaves the place the approver is looking at, often for a column or tab off screen (owner decision November 2026).
- When a toast is needed, it names the result in the past tense of the action: "Added to queue" after "Add to queue".
### Settings descriptions and helper text
diff --git a/.claude/skills/in-app-copy/SKILL.md b/.claude/skills/in-app-copy/SKILL.md
index b3445a8b8..45ed98ff4 100644
--- a/.claude/skills/in-app-copy/SKILL.md
+++ b/.claude/skills/in-app-copy/SKILL.md
@@ -99,6 +99,7 @@ Never a bare "Nothing here".
### Toasts and success feedback
- No success toast after creating, editing, deleting or copying everyday resources: the visible change (a new row, an inline check) is the feedback (owner decision, September 2026). Errors still toast.
+- Exception: approving or rejecting a post toasts the result ("Post approved and scheduled", "Post rejected and moved to drafts", `posts.approvals.toasts.*`), because the card leaves the place the approver is looking at, often for a column or tab off screen (owner decision November 2026).
- When a toast is needed, it names the result in the past tense of the action: "Added to queue" after "Add to queue".
### Settings descriptions and helper text
diff --git a/.cursor/skills/in-app-copy/SKILL.md b/.cursor/skills/in-app-copy/SKILL.md
index b3445a8b8..45ed98ff4 100644
--- a/.cursor/skills/in-app-copy/SKILL.md
+++ b/.cursor/skills/in-app-copy/SKILL.md
@@ -99,6 +99,7 @@ Never a bare "Nothing here".
### Toasts and success feedback
- No success toast after creating, editing, deleting or copying everyday resources: the visible change (a new row, an inline check) is the feedback (owner decision, September 2026). Errors still toast.
+- Exception: approving or rejecting a post toasts the result ("Post approved and scheduled", "Post rejected and moved to drafts", `posts.approvals.toasts.*`), because the card leaves the place the approver is looking at, often for a column or tab off screen (owner decision November 2026).
- When a toast is needed, it names the result in the past tense of the action: "Added to queue" after "Add to queue".
### Settings descriptions and helper text
diff --git a/AGENTS.md b/AGENTS.md
index 81a3a96f5..583b8cfff 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -203,6 +203,24 @@ Vue components must have a single root element.
# Project-Specific Rules
+## Branching reads top to bottom (PHP and TypeScript)
+
+A function that decides between several outcomes is a list of early returns, one case per `if`, read from top to bottom (owner decision November 2026). Never a ternary inside a ternary, a ternary inside an `if`, or a ternary whose condition joins several checks with `||` / `&&`.
+
+- One ternary with a single plain condition is fine (`filled($channel) ? 'channel' : 'all'`). Anything more becomes `if` blocks with braces.
+- Name a check used twice (`const imported = post.origin === PostOrigin.Network`) instead of repeating it in each branch.
+- When the outcome follows from what the user clicked, let each action say it (`publishNow()` toasts "publishing") instead of guessing it back from the payload.
+- A `match` lists every case it accepts and has no `default` that hides an unknown value; an unknown value should fail, not read as another case.
+- Code written before this rule moves to it when touched, not in a sweep. `PostTimelineCard`'s `scheduleMode` is the reference.
+
+### On the frontend, never inline a decision (owner decision November 2026)
+
+- **A function or computed that decides is a block with `if`s, never a one-expression body.** No `(x) => a ? b : c`, no `a || b ? … : …`, no `x === A || x === B` returned as a boolean, no `?.` / `??` chain that picks between several sources. Write each case as its own `if` with braces and an early return, as `postAttemptAt()`, `postChannelLabel()` and `accountTypeKey()` (`lib/postCard.ts`, `types/social-account.ts`) do.
+- **A set of values checked together is a named constant**, read with `.includes()` inside an `if` (`CONNECTION_LOST_STATUSES`, `PLATFORMS_WITH_ACCOUNT_TYPE`), not a chain of `===` joined by `||`.
+- **Templates hold no logic.** No ternary, `||` / `??` fallback, `.join()`, arithmetic or comparison inside `{{ }}`, `:class`, `:title`, `:aria-label` or a `v-if`: the template calls a named computed (`hasPostingTimes`, `textColor`) or a named function (`openLabel($t)`, `networkLine($t)`). A fallback that needs a translation is a function that takes the template's `$t` (see `.ai/rules/js.md`: never `trans()` in a script-level computed).
+- **A simple value is not a decision:** a plain read (`post.id`), a single `filled(x)` / `!isPending` in a `v-if`, and a `v-if` / `v-else` pair that swaps two elements stay as they are. Everything else gets a name.
+- `ChannelListItem.vue`, `PostBoardCard.vue` and `ApprovePostButton.vue` are the references.
+
## Frontend (Vue/TypeScript)
- **TypeScript only, never JavaScript** (owner decision November 2026). Every script, config and test harness is a `.ts` file: `eslint.config.ts`, `vite.config.ts`, the Node harnesses in `tests/fixtures/*-harness.ts` (Node strips the types when it runs them, so they need no build step). Never add a `.js` or `.mjs` file. The one exception is the Maizzle email project (`maizzle/*.js`), which keeps its own JavaScript config.
@@ -212,9 +230,10 @@ Vue components must have a single root element.
- **A button that waits on a request shows it through the `Button` component's own `loading` prop whenever possible** (`<Button :loading="form.processing">`): it disables the button and swaps its label for the spinner, so every button waits the same way. Do not hand-roll a `<Spinner v-if>` inside the label or a separate disabled flag for this. When `loading` cannot fit (the label must stay visible next to the spinner, an `as-child` link, a control that is not our `Button`), keep the label and add the spinner next to it. Many existing buttons predate this rule; move them to `loading` when touching them, not in a sweep.
- **Unsaved changes in the composer** go through `composables/composer/useUnsavedChanges.ts` (the history guard) and `useComposerUnsavedChanges.ts` (what counts as a change). The owner treats this guard as critical. How the guard works is written in the composable's docblock; three rules hold around it:
- The composer's save visits (`router.put` / `router.post` in `pages/publish/Index.vue`) send `replace: true`, so the saved page takes the place of the edit's history entry instead of stacking on it.
- - A composer opened from a page of the app (`lib/inAppHistory.ts`, `cameFromAppPage()`) leaves through history: closing goes back, and saving goes back once the saved page lands and reloads that page. So after a save or close, one browser Back reaches the page before the list, calendar or tab it was opened from. A composer reached by its link or a reload has nothing behind it and still replaces its entry with the list.
+ - A composer opened from a page of the app (`lib/inAppHistory.ts`, `cameFromAppPage()`) leaves through history: closing goes back, and saving goes back once the saved page lands and reloads that page. So after a save or close, one browser Back reaches the page before the list, calendar or tab it was opened from. A composer reached by its link or a reload has nothing behind it and still replaces its entry with the list. Duplicating a post (a POST that lands on the copy's composer) counts as opened from the page it was duplicated from (`rememberInAppPush()`), so closing the copy goes back to that List, Calendar or Board.
- "Is there unsaved work" is decided by the snapshot comparison alone, never by `isSubmitting` or another request flag.
- Every change to the guard ships with a browser test in `tests/Browser/ComposerUnsavedChangesTest.php` that fails without it, checked by removing the change and running the test. History bugs here showed up only in a real browser (Inertia's own popstate handler is part of every flow).
+- **A post's status badge is always `PostStatusBadge`** (`components/publish/PostStatusBadge.vue`, owner decision November 2026). Never build one by hand from `<Badge>`, an icon and `posts.status.*`. It takes two props only: `status`, the status to show (a `PostDisplayStatus`: the post's status, or `pending_review` / `deleted_on_network`; read a post's with `postDisplayStatus(post)` from `composables/usePostStatus.ts`), and `compact`, the smaller badge of a dense card (the board), which changes the size only, never the text. Color and icon come from `getPostStatusConfig()` in `usePostStatus.ts`, the label from `posts.status.<status>`: one short label per status, the same at both sizes and in every place it shows (no long and short variants, no per-screen override). A new status adds its row there and its key in the 16 locales and in `tests/fixtures/single-line-copy.php`. The calendar chip's icon-only marker (`CalendarPostChip`, `calendar.post_status.*` in its tooltip) is a separate thing and stays as it is.
- **Composables are scoped by area.** A composable used by one area only lives in that area's folder, `resources/js/composables/<area>/` (e.g. `composables/composer/useComposerUnsavedChanges.ts`, `composables/echo/usePostEcho.ts`). Only composables shared across areas stay at the root of `resources/js/composables/`. When a scoped composable gains a consumer in another area, move it to the root in the same change.
- Searching a list in the UI goes through `matchesSearch` / `filterBySearch` (`resources/js/lib/search.ts`): word by word, ignoring case and accents. Never hand-roll `.toLowerCase().includes(...)` for a search box.
- **Value checks go through `@/lib/helpers`** (owner decision November 2026), the front-end mirror of Laravel's helpers, so a check reads the same on both sides: `blank()` / `filled()` for emptiness, `isEmpty()` (Laravel's `isEmpty()` on a string or a collection) when spaces count, instead of `=== ''` or `.length === 0`, `isString()` / `isNumber()` instead of `typeof x === 'string'`, `transform(value, callback, fallback)` instead of `value ? callback(value) : fallback`, and `clamp()` (Laravel's `Number::clamp`) instead of `Math.min(Math.max(...))`. Emptiness reads `filled(reply.media)`, not `reply.media.length > 0`; `filled(limits)`, not `limits !== null`. Every helper follows its PHP twin, kept equal by `tests/Unit/HelpersParityTest.php`: null, undefined, a whitespace-only string and an empty array or plain object are blank; numbers and booleans (zero and false included) never are. `filled()` narrows the type, so after `if (filled(reply))` the value is no longer null or undefined. Keep an exact `=== undefined` where an empty object is a real value (a poll or meta that may be `{}`), since `blank({})` is true. A new helper (Laravel's `transform`, `value`, …) goes in the same file with a case in the parity test. Existing hand-written checks move to the helpers when touched, not in a sweep.
@@ -983,6 +1002,15 @@ A controller serves **one resource**. Network-specific endpoints never pile up i
- **MCP has no controllers**: one tool class per action (`app/Mcp/Tools/<Area>/<Verb><Resource>Tool.php`), never one tool that switches on the network.
- Moving an endpoint between controllers keeps its URL and route name, so API clients see no change; the parity tests in `tests/Feature/Parity` must pass unchanged.
+## The current workspace is guaranteed by middleware
+
+Every app route that works on the current workspace sits behind `EnsureHasWorkspace` (`routes/app.php`), which redirects a user without one to `app.workspaces.create` before the controller runs (owner decision November 2026). A controller reads `$request->user()->currentWorkspace` and uses it; it never checks it again.
+
+- Never write `if (! $workspace) { return redirect()->route('app.workspaces.create'); }`, `abort_unless($workspace, ...)` or any other "no workspace" guard in a controller, a FormRequest or an action reached from those routes. The guard was copied into 27 controller actions and never ran; all of it was removed.
+- A new route that needs the current workspace goes inside the `EnsureHasWorkspace` group, never outside it with its own check. Its return type does not carry `|RedirectResponse` for that redirect.
+- A route that must work without a workspace (creating the first one, Welcome) stays outside the group and handles that case itself.
+- The redirect is covered once, for the middleware, by the tests that hit an app page without a workspace; a controller test does not repeat it.
+
## MCP tools list in one page
`tools/list` returns every tool in a single response (owner decision October 2026): some MCP clients do not follow `nextCursor` and silently see only the first page. `TryPostServer` sets both `defaultPaginationLength` and `maxPaginationLength` to 200; laravel/mcp uses the smaller of the two, so raising only the default does nothing (the package's max is 50). The same page size applies to `resources/list`, `resources/templates/list` and `prompts/list`. Raise both before the server reaches 200 tools. A client may still ask for a smaller page (`per_page`, a laravel/mcp extension; the MCP spec only defines `cursor`) and follow `nextCursor`; a bigger request is capped at 200. `tests/Feature/Mcp/ToolListPaginationTest.php` calls the real endpoint and fails when the list is split.
@@ -1102,7 +1130,7 @@ an `enabled` flag or posts with several channels. Posts created together share
`scopePublicationPublished()`. On the post cards, the calendar chip and the details
dialog, `isDeletedOnNetwork()` and `postPermalink()`
(`lib/postNetwork.ts`) decide the badge and the link, and
- `getPostCardStatusConfig()` (`usePostStatus.ts`) the status shown; the repurpose
+ `postDisplayStatus()` (`usePostStatus.ts`, shown by `PostStatusBadge`) the status shown; the repurpose
activity list labels `publish_status` directly. Insights keep the historical
numbers and drop the network link (`PublicationAvailability::visiblePermalink()`).
- **Publication writes have their own clock.** `writePublication()` (and every
diff --git a/app/Actions/Analytics/BuildWorkspaceAnalyticsReport.php b/app/Actions/Analytics/BuildWorkspaceAnalyticsReport.php
index 98d563a65..3ef2c9f5b 100644
--- a/app/Actions/Analytics/BuildWorkspaceAnalyticsReport.php
+++ b/app/Actions/Analytics/BuildWorkspaceAnalyticsReport.php
@@ -27,13 +27,14 @@ class BuildWorkspaceAnalyticsReport
/**
* @param array{start?: string, end?: string, observed_through?: string, timezone?: string} $selected
* @param array<string, string>|null $channelKeys Analytics key of each selected social account (already resolved for tenancy), keyed by account id; null means every channel.
+ * @param PublicationFilter|null $filter Narrows post metrics only; followers stay account-wide.
* @return array<string, mixed>
*/
- public function forSelection(Workspace $workspace, array $selected = [], ?array $channelKeys = null, bool $clampToBounds = true, WeekStart $weekStart = WeekStart::DEFAULT): array
+ public function forSelection(Workspace $workspace, array $selected = [], ?array $channelKeys = null, bool $clampToBounds = true, WeekStart $weekStart = WeekStart::DEFAULT, ?PublicationFilter $filter = null): array
{
['bounds' => $bounds, 'range' => $range] = $this->resolveRange($workspace, $selected, $this->keys($channelKeys), $clampToBounds);
- return $this->forRange($workspace, $range, $bounds, $channelKeys, $weekStart);
+ return $this->forRange($workspace, $range, $bounds, $channelKeys, $weekStart, $filter);
}
/**
diff --git a/app/Actions/Post/BuildBoardPageProps.php b/app/Actions/Post/BuildBoardPageProps.php
new file mode 100644
index 000000000..d6ec443c5
--- /dev/null
+++ b/app/Actions/Post/BuildBoardPageProps.php
@@ -0,0 +1,204 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\Post;
+
+use App\Http\Resources\App\PostCardResource;
+use App\Http\Resources\App\SocialAccountResource;
+use App\Models\SocialAccount;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+use App\Support\PublishFilters;
+use App\Support\Timezone;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Http\Request;
+use Illuminate\Pagination\LengthAwarePaginator;
+use Illuminate\Support\Collection;
+use Inertia\Inertia;
+
+class BuildBoardPageProps
+{
+ public const COMPONENT = 'posts/Board';
+
+ private const GROUPS = ['status', 'tag', 'channel'];
+
+ private const STATUS_COLUMNS = ['draft', 'approvals', 'scheduled', 'published', 'failed'];
+
+ private const UNTAGGED_COLUMN = ['key' => 'untagged', 'type' => 'untagged'];
+
+ /**
+ * @return array<string, mixed>
+ */
+ public static function handle(Request $request, Workspace $workspace, ?SocialAccount $channel): array
+ {
+ $user = $request->user();
+ $filters = PublishFilters::fromRequest($request, $channel, $user);
+ $groups = self::groups($channel);
+ $group = self::group($request->query('group'), $groups);
+
+ $accounts = filled($channel) ? collect() : $workspace->socialAccounts()->get();
+ $labels = $workspace->labels()->orderBy('name')->get(['id', 'name', 'color']);
+ $hasChannels = filled($channel) || filled($accounts);
+
+ $posts = BuildPublishPageProps::cardQuery($workspace->posts()->onChannels($filters->scopedChannelIds), [], false)
+ ->when($group !== 'tag', fn (Builder $posts): Builder => $posts->matchingLabelFilter($filters->labelIds, $filters->untagged))
+ ->visiblePendingApprovalsFor(BuildPublishPageProps::pendingApprovalsRequester($user, $workspace));
+
+ $columnQuery = fn (array $column): Builder => self::columnQuery($column, clone $posts);
+
+ $columns = self::columns($group, $hasChannels, $labels, $accounts, $filters);
+
+ return [
+ 'scope' => filled($channel) ? 'channel' : 'all',
+ 'channel' => fn (): ?array => transform($channel, fn (SocialAccount $channel): array => BuildPublishPageProps::channelHeader($channel, $user->week_starts_on)),
+ 'group' => $group,
+ 'groups' => $groups,
+ 'boardColumns' => $columns->all(),
+ 'columns' => $columns
+ ->keyBy('key')
+ ->map(fn (array $column) => Inertia::scroll(fn () => self::page($column, $columnQuery($column)))->defer()->matchOn('data.id'))
+ ->all(),
+ 'displayTimezone' => $filters->displayTimezone,
+ 'timezones' => fn (): array => Timezone::options(),
+ 'labels' => $labels,
+ 'filters' => $filters->toProp(),
+ 'filterAccounts' => fn () => SocialAccountResource::collection($accounts),
+ 'hasChannels' => $hasChannels,
+ ];
+ }
+
+ /**
+ * A channel page has a single channel, so it cannot be grouped by channel.
+ *
+ * @return list<string>
+ */
+ private static function groups(?SocialAccount $channel): array
+ {
+ if (filled($channel)) {
+ return collect(self::GROUPS)->diff(['channel'])->values()->all();
+ }
+
+ return self::GROUPS;
+ }
+
+ /**
+ * The group asked for when it is one of the page's, else Status (an unknown value or a hand-made `group[]=` alike).
+ *
+ * @param list<string> $groups
+ */
+ private static function group(mixed $requested, array $groups): string
+ {
+ if (! collect($groups)->containsStrict($requested)) {
+ return 'status';
+ }
+
+ return $requested;
+ }
+
+ /**
+ * The board's columns for the group, none while the workspace has no channel.
+ *
+ * @param Collection<int, WorkspaceLabel> $labels
+ * @param Collection<int, SocialAccount> $accounts
+ * @return Collection<int, array<string, mixed>>
+ */
+ private static function columns(string $group, bool $hasChannels, Collection $labels, Collection $accounts, PublishFilters $filters): Collection
+ {
+ if (! $hasChannels) {
+ return collect();
+ }
+
+ return match ($group) {
+ 'status' => collect(self::STATUS_COLUMNS)->map(fn (string $key): array => ['key' => $key, 'type' => 'status']),
+ 'tag' => self::tagColumns($labels, $filters),
+ 'channel' => self::channelColumns($accounts, $filters),
+ };
+ }
+
+ /**
+ * One column per tag (only the filtered ones while filtering), then Untagged
+ * unless the filter leaves it out.
+ *
+ * @param Collection<int, WorkspaceLabel> $labels
+ * @return Collection<int, array<string, mixed>>
+ */
+ private static function tagColumns(Collection $labels, PublishFilters $filters): Collection
+ {
+ $filtering = filled($filters->labelIds) || $filters->untagged;
+
+ $columns = $labels
+ ->when($filtering, fn (Collection $labels): Collection => $labels->whereIn('id', $filters->labelIds))
+ ->map(fn (WorkspaceLabel $label): array => [
+ 'key' => "label_{$label->id}",
+ 'type' => 'label',
+ 'label' => ['id' => $label->id, 'name' => $label->name, 'color' => $label->color],
+ ])
+ ->values();
+
+ if ($filtering && ! $filters->untagged) {
+ return $columns;
+ }
+
+ return $columns->push(self::UNTAGGED_COLUMN);
+ }
+
+ /**
+ * One column per channel, only the filtered ones while filtering.
+ *
+ * @param Collection<int, SocialAccount> $accounts
+ * @return Collection<int, array<string, mixed>>
+ */
+ private static function channelColumns(Collection $accounts, PublishFilters $filters): Collection
+ {
+ return $accounts
+ ->when(filled($filters->requestedChannelIds), fn (Collection $accounts): Collection => $accounts->whereIn('id', $filters->requestedChannelIds))
+ ->map(fn (SocialAccount $account): array => [
+ 'key' => "channel_{$account->id}",
+ 'type' => 'channel',
+ 'channel' => SocialAccountResource::make($account)->resolve(),
+ ])
+ ->values();
+ }
+
+ /**
+ * @param array<string, mixed> $column
+ */
+ private static function columnQuery(array $column, Builder $posts): Builder
+ {
+ return match (data_get($column, 'type')) {
+ 'status' => self::statusQuery(data_get($column, 'key'), $posts),
+ 'label' => $posts->whereRelation('labels', 'workspace_labels.id', data_get($column, 'label.id'))->latestAttempt(),
+ 'untagged' => $posts->whereDoesntHave('labels')->latestAttempt(),
+ 'channel' => $posts->where('posts.social_account_id', data_get($column, 'channel.id'))->latestAttempt(),
+ };
+ }
+
+ private static function statusQuery(string $status, Builder $posts): Builder
+ {
+ return match ($status) {
+ 'draft' => $posts->draft()->latest('posts.created_at'),
+ 'approvals' => $posts->pendingApproval()->approvalOrder(),
+ 'scheduled' => $posts->whereIn('posts.status', BuildPublishPageProps::QUEUE_STATUSES)->orderBy('posts.scheduled_at'),
+ 'published' => $posts->published()->latestAttempt(),
+ 'failed' => $posts->failed()->latestAttempt(),
+ };
+ }
+
+ /**
+ * One page of a column, its cards ready for the board: the viewer's
+ * permissions, the sent posts' metrics, each channel serialized once.
+ *
+ * @param array<string, mixed> $column
+ */
+ private static function page(array $column, Builder $query): LengthAwarePaginator
+ {
+ $key = data_get($column, 'key');
+ $page = $query->orderBy('posts.id')->paginate(config()->integer('app.pagination.default'), pageName: "{$key}_page");
+
+ BuildPublishPageProps::decorate($page->getCollection());
+ BuildPublishPageProps::attachMetrics($page->getCollection());
+
+ return $page->through(PostCardResource::serializer());
+ }
+}
diff --git a/app/Actions/Post/BuildCalendarPageProps.php b/app/Actions/Post/BuildCalendarPageProps.php
index a2288751b..29779211f 100644
--- a/app/Actions/Post/BuildCalendarPageProps.php
+++ b/app/Actions/Post/BuildCalendarPageProps.php
@@ -12,7 +12,7 @@ use App\Http\Resources\App\SocialAccountResource;
use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\Workspace;
-use App\Support\RequestIds;
+use App\Support\PublishFilters;
use App\Support\Timezone;
use Carbon\CarbonImmutable;
use Carbon\CarbonInterface;
@@ -39,15 +39,14 @@ class BuildCalendarPageProps
*/
public static function handle(Request $request, Workspace $workspace, ?SocialAccount $channel, ?string $view): array
{
- $userTimezone = Timezone::normalize($request->user()->timezone);
- $timezone = BuildPublishPageProps::displayTimezone($request->query('tz'), $userTimezone);
+ $filters = PublishFilters::fromRequest($request, $channel, $request->user());
+ $timezone = $filters->displayTimezone;
$view = in_array($view, self::VIEWS, true) ? $view : 'week';
$status = in_array($request->query('status'), self::STATUSES, true) ? $request->query('status') : self::STATUS_ALL;
- $labelIds = RequestIds::uuidList($request->collect('labels'));
- $untagged = $request->boolean('untagged');
- $requestedChannelIds = $channel ? [] : RequestIds::uuidList($request->collect('channels')->unique());
- $scopedChannelIds = $channel ? [$channel->id] : ($requestedChannelIds !== [] ? $requestedChannelIds : null);
+ $labelIds = $filters->labelIds;
+ $untagged = $filters->untagged;
+ $requestedChannelIds = $filters->requestedChannelIds;
$weekStartsOn = $request->user()->week_starts_on;
$today = CarbonImmutable::now($timezone)->startOfDay();
@@ -67,7 +66,7 @@ class BuildCalendarPageProps
};
$scopedPosts = fn (): Builder => BuildPublishPageProps::cardQuery($workspace->posts(), $labelIds, $untagged)
- ->onChannels($scopedChannelIds)
+ ->onChannels($filters->scopedChannelIds)
->visiblePendingApprovalsFor(BuildPublishPageProps::pendingApprovalsRequester($request->user(), $workspace));
$range = [$rangeStart->utc(), $rangeEnd->utc()];
@@ -107,9 +106,7 @@ class BuildCalendarPageProps
'timezones' => fn (): array => Timezone::options(),
'labels' => fn () => $workspace->labels()->orderBy('name')->get(['id', 'name', 'color']),
'filters' => [
- 'labels' => $labelIds,
- 'untagged' => $untagged,
- 'channels' => $requestedChannelIds,
+ ...$filters->toProp(),
'status' => $status,
],
'filterAccounts' => fn () => SocialAccountResource::collection($filterAccounts()),
diff --git a/app/Actions/Post/BuildPublishPageProps.php b/app/Actions/Post/BuildPublishPageProps.php
index 38b789edf..c18b77fad 100644
--- a/app/Actions/Post/BuildPublishPageProps.php
+++ b/app/Actions/Post/BuildPublishPageProps.php
@@ -7,8 +7,7 @@ namespace App\Actions\Post;
use App\Actions\Analytics\ReadPublicationAnalytics;
use App\Actions\Post\Queue\BuildQueueTimeline;
use App\Actions\PostNote\BuildPostNotesProps;
-use App\Actions\SocialAccount\CountPostsScheduledThisWeek;
-use App\Actions\SocialAccount\CountPostsSentThisWeek;
+use App\Actions\SocialAccount\BuildPostingGoalProgress;
use App\Enums\Post\ScheduleMode;
use App\Enums\Post\Status as PostStatus;
use App\Enums\User\WeekStart;
@@ -19,6 +18,7 @@ use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use App\Support\PostStatusRules;
+use App\Support\PublishFilters;
use App\Support\RequestIds;
use App\Support\Timezone;
use Illuminate\Database\Eloquent\Builder;
@@ -63,12 +63,11 @@ class BuildPublishPageProps
{
$user = $request->user();
$requester = self::pendingApprovalsRequester($user, $workspace);
- $userTimezone = Timezone::normalize($user->timezone);
- $displayTimezone = self::displayTimezone($request->query('tz'), $userTimezone);
-
- $labelIds = RequestIds::uuidList($request->collect('labels'));
- $untagged = $request->boolean('untagged');
- $requestedChannelIds = $channel ? [] : RequestIds::uuidList($request->collect('channels')->unique());
+ $filters = PublishFilters::fromRequest($request, $channel, $user);
+ $displayTimezone = $filters->displayTimezone;
+ $labelIds = $filters->labelIds;
+ $untagged = $filters->untagged;
+ $requestedChannelIds = $filters->requestedChannelIds;
$workspaceAccounts = null;
$filterAccounts = function () use (&$workspaceAccounts, $channel, $workspace): Collection {
@@ -81,9 +80,7 @@ class BuildPublishPageProps
default => $filterAccounts(),
};
- $scopedChannelIds = $channel ? [$channel->id] : ($requestedChannelIds !== [] ? $requestedChannelIds : null);
-
- $basePosts = $workspace->posts()->onChannels($scopedChannelIds);
+ $basePosts = $workspace->posts()->onChannels($filters->scopedChannelIds);
$openPostNotesId = RequestIds::uuid($request->query('notes'));
$openPostDetailsId = RequestIds::uuid($request->query('post'));
@@ -118,11 +115,7 @@ class BuildPublishPageProps
'displayTimezone' => $displayTimezone,
'timezones' => fn (): array => Timezone::options(),
'labels' => fn () => $workspace->labels()->orderBy('name')->get(['id', 'name', 'color']),
- 'filters' => [
- 'labels' => $labelIds,
- 'untagged' => $untagged,
- 'channels' => $requestedChannelIds,
- ],
+ 'filters' => $filters->toProp(),
'filterAccounts' => fn () => SocialAccountResource::collection($filterAccounts()),
'hasData' => $hasData,
'hasQueueSlots' => $hasQueueSlots,
@@ -158,24 +151,11 @@ class BuildPublishPageProps
{
return [
...SocialAccountResource::make($channel)->resolve(),
- 'posting_goal' => $channel->posting_goal,
- 'sent_this_week' => CountPostsSentThisWeek::handle($channel, $weekStart),
- 'scheduled_this_week' => CountPostsScheduledThisWeek::handle($channel, $weekStart),
+ ...BuildPostingGoalProgress::forChannel($channel, $weekStart),
'has_grid' => $channel->platform->hasProfileGrid(),
];
}
- public static function displayTimezone(mixed $requested, string $userTimezone): string
- {
- if (! is_string($requested) || $requested === '') {
- return $userTimezone;
- }
-
- $normalized = Timezone::normalize($requested);
-
- return $normalized === Timezone::DEFAULT && $requested !== Timezone::DEFAULT ? $userTimezone : $normalized;
- }
-
/**
* Whether the tab has any post at all on this page, read without the label and
* channel filters, so an empty list can tell first use from no results.
@@ -352,9 +332,7 @@ class BuildPublishPageProps
->latest('posts.created_at'),
self::TAB_APPROVALS => $query->pendingApproval()
->visiblePendingApprovalsFor($requester)
- ->orderByRaw('CASE WHEN posts.scheduled_at IS NULL THEN 1 ELSE 0 END')
- ->orderBy('posts.scheduled_at')
- ->orderBy('posts.approval_requested_at'),
+ ->approvalOrder(),
default => $query->whereIn('status', self::SENT_STATUSES)
->latestAttempt(),
};
@@ -367,7 +345,7 @@ class BuildPublishPageProps
self::attachMetrics($paginator->getCollection());
}
- return $paginator->through(fn (Post $post): array => PostCardResource::make($post)->resolve());
+ return $paginator->through(PostCardResource::serializer());
}
/**
diff --git a/app/Actions/SocialAccount/BuildPostingGoalProgress.php b/app/Actions/SocialAccount/BuildPostingGoalProgress.php
new file mode 100644
index 000000000..07cdbe638
--- /dev/null
+++ b/app/Actions/SocialAccount/BuildPostingGoalProgress.php
@@ -0,0 +1,43 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\SocialAccount;
+
+use App\Enums\User\WeekStart;
+use App\Models\SocialAccount;
+use Illuminate\Support\Collection;
+
+class BuildPostingGoalProgress
+{
+ /**
+ * Each channel's weekly posting goal and where the viewer's week stands,
+ * keyed by channel id, in two queries whatever the number of channels.
+ *
+ * @param Collection<int, SocialAccount> $channels
+ * @return array<string, array{posting_goal: ?int, sent_this_week: int, scheduled_this_week: int}>
+ */
+ public static function forChannels(Collection $channels, WeekStart $weekStart): array
+ {
+ $sent = CountPostsSentThisWeek::forChannels($channels, $weekStart);
+ $scheduled = CountPostsScheduledThisWeek::forChannels($channels, $weekStart);
+
+ return $channels
+ ->mapWithKeys(fn (SocialAccount $channel): array => [
+ $channel->id => [
+ 'posting_goal' => $channel->posting_goal,
+ 'sent_this_week' => data_get($sent, $channel->id, 0),
+ 'scheduled_this_week' => data_get($scheduled, $channel->id, 0),
+ ],
+ ])
+ ->all();
+ }
+
+ /**
+ * @return array{posting_goal: ?int, sent_this_week: int, scheduled_this_week: int}
+ */
+ public static function forChannel(SocialAccount $channel, WeekStart $weekStart): array
+ {
+ return data_get(self::forChannels(collect([$channel]), $weekStart), $channel->id);
+ }
+}
diff --git a/app/Actions/SocialAccount/CountPostsScheduledThisWeek.php b/app/Actions/SocialAccount/CountPostsScheduledThisWeek.php
index 4ea9607e1..af5bb60ac 100644
--- a/app/Actions/SocialAccount/CountPostsScheduledThisWeek.php
+++ b/app/Actions/SocialAccount/CountPostsScheduledThisWeek.php
@@ -8,16 +8,36 @@ use App\Enums\User\WeekStart;
use App\Models\Post;
use App\Models\SocialAccount;
use App\Support\Timezone;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Collection;
class CountPostsScheduledThisWeek
{
- public static function handle(SocialAccount $channel, WeekStart $weekStart): int
+ /**
+ * Posts scheduled on each channel from now to the end of the viewer's
+ * current week, keyed by channel id, in one query: the week follows the
+ * viewer's `week_starts_on` and each channel's time zone. A channel with
+ * nothing scheduled is absent.
+ *
+ * @param Collection<int, SocialAccount> $channels
+ * @return array<string, int>
+ */
+ public static function forChannels(Collection $channels, WeekStart $weekStart): array
{
- $now = now(Timezone::normalize($channel->timezone));
+ if (blank($channels)) {
+ return [];
+ }
- return Post::query()
- ->scheduledOn($channel->id, $now->utc())
- ->where('scheduled_at', '<=', $now->endOfWeek($weekStart->lastDay())->utc())
- ->count();
+ return Post::countPerChannel(Post::query()
+ ->where(fn (Builder $any): Builder => $channels->reduce(
+ fn (Builder $query, SocialAccount $channel): Builder => $query->orWhere(function (Builder $week) use ($channel, $weekStart): void {
+ $now = now(Timezone::normalize($channel->timezone));
+
+ $week->scheduledOn($channel->id, $now->utc())
+ ->where('scheduled_at', '<=', $now->endOfWeek($weekStart->lastDay())->utc());
+ }),
+ $any,
+ ))
+ );
}
}
diff --git a/app/Actions/SocialAccount/CountPostsSentThisWeek.php b/app/Actions/SocialAccount/CountPostsSentThisWeek.php
index d17e4ae4d..b9c42284c 100644
--- a/app/Actions/SocialAccount/CountPostsSentThisWeek.php
+++ b/app/Actions/SocialAccount/CountPostsSentThisWeek.php
@@ -8,25 +8,41 @@ use App\Enums\User\WeekStart;
use App\Models\Post;
use App\Models\SocialAccount;
use App\Support\Timezone;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Collection;
class CountPostsSentThisWeek
{
/**
- * Posts the channel published in the viewer's current week: the week starts
- * on the viewer's `week_starts_on`, its days follow the channel time zone.
+ * Posts each channel published in the viewer's current week, keyed by
+ * channel id, in one query: the week starts on the viewer's
+ * `week_starts_on`, its days follow each channel's time zone. A channel
+ * with no post is absent.
+ *
+ * @param Collection<int, SocialAccount> $channels
+ * @return array<string, int>
*/
- public static function handle(SocialAccount $channel, WeekStart $weekStart): int
+ public static function forChannels(Collection $channels, WeekStart $weekStart): array
{
- $now = now(Timezone::normalize($channel->timezone));
+ if (blank($channels)) {
+ return [];
+ }
- return Post::query()
- ->where('social_account_id', $channel->id)
+ return Post::countPerChannel(Post::query()
->wentOut()
->whereNotNull('published_at')
- ->whereBetween('published_at', [
- $now->startOfWeek($weekStart->firstDay())->utc(),
- $now->endOfWeek($weekStart->lastDay())->utc(),
- ])
- ->count();
+ ->where(fn (Builder $any): Builder => $channels->reduce(
+ fn (Builder $query, SocialAccount $channel): Builder => $query->orWhere(function (Builder $week) use ($channel, $weekStart): void {
+ $now = now(Timezone::normalize($channel->timezone));
+
+ $week->where('posts.social_account_id', $channel->id)
+ ->whereBetween('published_at', [
+ $now->startOfWeek($weekStart->firstDay())->utc(),
+ $now->endOfWeek($weekStart->lastDay())->utc(),
+ ]);
+ }),
+ $any,
+ ))
+ );
}
}
diff --git a/app/Actions/SocialAccount/ListWorkspaceChannels.php b/app/Actions/SocialAccount/ListWorkspaceChannels.php
new file mode 100644
index 000000000..28f53b04c
--- /dev/null
+++ b/app/Actions/SocialAccount/ListWorkspaceChannels.php
@@ -0,0 +1,98 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Actions\SocialAccount;
+
+use App\Enums\SocialAccount\Platform;
+use App\Enums\User\WeekStart;
+use App\Models\SocialAccount;
+use App\Models\Workspace;
+use Closure;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Pagination\LengthAwarePaginator;
+use Illuminate\Support\Str;
+
+class ListWorkspaceChannels
+{
+ /**
+ * The workspace's channels in the sidebar order, matching every word of the
+ * search in the name, the username (stored without "@", so a word's leading
+ * "@" is dropped) or the network's name ("youtube"), on the networks asked for.
+ *
+ * @param list<string> $networks
+ * @return Builder<SocialAccount>
+ */
+ public static function query(Workspace $workspace, string $search = '', array $networks = []): Builder
+ {
+ $platforms = self::platformsWhere(fn (Platform $platform): bool => in_array($platform->network(), $networks, true));
+
+ return $workspace->socialAccounts()->getQuery()
+ ->when(filled($networks), fn (Builder $query): Builder => $query->whereIn('platform', $platforms))
+ ->when(filled($search), function (Builder $query) use ($search): Builder {
+ $words = Str::of($search)->squish()->explode(' ')
+ ->map(fn (string $word): string => Str::chopStart($word, '@'))
+ ->filter();
+
+ foreach ($words as $word) {
+ $query->where(fn (Builder $match): Builder => $match
+ ->whereLike('display_name', "%{$word}%")
+ ->orWhereLike('username', "%{$word}%")
+ ->orWhereIn('platform', self::platformsWhere(fn (Platform $platform): bool => Str::contains($platform->label(), $word, ignoreCase: true))));
+ }
+
+ return $query;
+ });
+ }
+
+ /**
+ * One page of the channels list, each channel carrying how many posts it
+ * sent and has scheduled this week (counted, in two queries for the whole
+ * page, only for the channels with a weekly goal; 0 for the others).
+ *
+ * @param list<string> $networks
+ * @return LengthAwarePaginator<int, SocialAccount>
+ */
+ public static function page(Workspace $workspace, string $search, array $networks, WeekStart $weekStart): LengthAwarePaginator
+ {
+ $page = self::query($workspace, $search, $networks)->paginate((int) config('app.pagination.default'));
+ $withGoal = $page->getCollection()->filter(fn (SocialAccount $account): bool => filled($account->posting_goal));
+ $progress = BuildPostingGoalProgress::forChannels($withGoal, $weekStart);
+
+ $page->getCollection()->each(fn (SocialAccount $account): SocialAccount => $account
+ ->setAttribute('sent_this_week', data_get($progress, "{$account->id}.sent_this_week", 0))
+ ->setAttribute('scheduled_this_week', data_get($progress, "{$account->id}.scheduled_this_week", 0)));
+
+ return $page;
+ }
+
+ /**
+ * Every network the workspace has a channel on, each once, in channel order.
+ *
+ * @return list<string>
+ */
+ public static function networks(Workspace $workspace): array
+ {
+ return $workspace->socialAccounts()
+ ->pluck('platform')
+ ->map(fn (Platform $platform): string => $platform->network())
+ ->unique()
+ ->values()
+ ->all();
+ }
+
+ /**
+ * The platforms that pass the check, as stored on the accounts.
+ *
+ * @param Closure(Platform): bool $check
+ * @return list<string>
+ */
+ private static function platformsWhere(Closure $check): array
+ {
+ return collect(Platform::cases())
+ ->filter($check)
+ ->map(fn (Platform $platform): string => $platform->value)
+ ->values()
+ ->all();
+ }
+}
diff --git a/app/Dto/Analytics/PublicationFilter.php b/app/Dto/Analytics/PublicationFilter.php
index e6dd2ba54..21eca9305 100644
--- a/app/Dto/Analytics/PublicationFilter.php
+++ b/app/Dto/Analytics/PublicationFilter.php
@@ -10,9 +10,11 @@ use App\Enums\SocialAccount\Platform;
use App\Models\Post;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Query\Builder;
+use Illuminate\Support\ValidatedInput;
/**
- * Narrows a channel's publications by the labels of their TryPost post and by post type.
+ * Narrows publications by the labels of their TryPost post and, for one channel, by post type.
+ * Without a platform (the workspace Insights, across every network) it narrows by label only.
*
* Expects the publication query aliased as `publication`, left-joined to its post as `destination`.
* A publication with a post platform takes that post platform's content type; one without (published
@@ -23,11 +25,11 @@ use Illuminate\Database\Query\Builder;
final readonly class PublicationFilter
{
/**
- * @param list<string> $labelIds Workspace label ids already validated for tenancy.
- * @param list<ContentType> $contentTypes Content types of $platform.
+ * @param list<string> $labelIds Label UUIDs; one deleted or of another workspace matches no post, since only this workspace's posts carry its labels.
+ * @param list<ContentType> $contentTypes Content types of $platform; none without one.
*/
public function __construct(
- public Platform $platform,
+ public ?Platform $platform,
public array $labelIds = [],
public bool $untagged = false,
public array $contentTypes = [],
@@ -49,6 +51,14 @@ final readonly class PublicationFilter
);
}
+ /**
+ * Narrows the publications of every network by label, from the validated `labels` and `untagged`.
+ */
+ public static function labelsFrom(ValidatedInput $validated): self
+ {
+ return new self(null, $validated->array('labels'), $validated->boolean('untagged'));
+ }
+
/**
* @return list<string>
*/
@@ -93,6 +103,10 @@ final readonly class PublicationFilter
*/
private function publicationTypes(): array
{
+ if (blank($this->platform)) {
+ return [];
+ }
+
return array_values(array_map(
fn (PublicationContentType $type): string => $type->value,
array_filter(
diff --git a/app/Http/Controllers/Api/AnalyticsController.php b/app/Http/Controllers/Api/AnalyticsController.php
index 0f593489b..4e2496f92 100644
--- a/app/Http/Controllers/Api/AnalyticsController.php
+++ b/app/Http/Controllers/Api/AnalyticsController.php
@@ -8,6 +8,7 @@ use App\Actions\Analytics\BuildWorkspaceAnalyticsReport;
use App\Actions\Analytics\ReadPublicationAnalytics;
use App\Actions\Analytics\ResolveAnalyticsChannelFilter;
use App\Actions\Analytics\ResolveAnalyticsRangePreset;
+use App\Dto\Analytics\PublicationFilter;
use App\Http\Requests\Api\Analytics\ShowAnalyticsReportRequest;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -26,7 +27,14 @@ class AnalyticsController extends Controller
['selection' => $selection, 'clamped' => $clamped] = $presets->selection($request->validated(), $request->user()->timezone);
['keys' => $channelKeys] = $channelFilter->execute($workspace, $request->collect('channels'));
- return response()->json($analytics->forSelection($workspace, $selection, $channelKeys, $clamped, weekStart: $request->user()->week_starts_on));
+ return response()->json($analytics->forSelection(
+ $workspace,
+ $selection,
+ $channelKeys,
+ $clamped,
+ weekStart: $request->user()->week_starts_on,
+ filter: PublicationFilter::labelsFrom($request->safe()),
+ ));
}
public function showPublication(Request $request, string $publication, ReadPublicationAnalytics $analytics): JsonResponse
diff --git a/app/Http/Controllers/App/ApiKeyController.php b/app/Http/Controllers/App/ApiKeyController.php
index d908a2db3..71080677c 100644
--- a/app/Http/Controllers/App/ApiKeyController.php
+++ b/app/Http/Controllers/App/ApiKeyController.php
@@ -17,14 +17,10 @@ use Symfony\Component\HttpFoundation\Response;
class ApiKeyController extends Controller
{
- public function index(Request $request): InertiaResponse|RedirectResponse
+ public function index(Request $request): InertiaResponse
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
$tokens = AccessToken::where('user_id', $request->user()->id)
@@ -52,10 +48,6 @@ class ApiKeyController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
$created = CreateApiKey::execute(
@@ -71,10 +63,6 @@ class ApiKeyController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
$regenerated = RegenerateApiKey::execute(
@@ -90,10 +78,6 @@ class ApiKeyController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
$this->findToken($request, $workspace->id, $tokenId)
diff --git a/app/Http/Controllers/App/ChannelController.php b/app/Http/Controllers/App/ChannelController.php
index 9fc750b48..d963a157d 100644
--- a/app/Http/Controllers/App/ChannelController.php
+++ b/app/Http/Controllers/App/ChannelController.php
@@ -12,9 +12,11 @@ use App\Actions\Analytics\ListAvailableChannelMetrics;
use App\Actions\Analytics\ListChannelPublicationPerformance;
use App\Actions\Analytics\ResolveAnalyticsAccountKey;
use App\Actions\Analytics\ResolveAnalyticsRangePreset;
+use App\Actions\Post\BuildBoardPageProps;
use App\Actions\Post\BuildCalendarPageProps;
use App\Actions\Post\BuildPublishPageProps;
use App\Actions\SocialAccount\ListInstagramGridPosts;
+use App\Actions\SocialAccount\ListWorkspaceChannels;
use App\Actions\SocialAccount\ReorderSocialAccounts;
use App\Enums\Analytics\ExportFormat;
use App\Enums\PostPlatform\ContentType;
@@ -22,7 +24,9 @@ use App\Http\Controllers\App\Concerns\EnsuresChannelInCurrentWorkspace;
use App\Http\Controllers\App\Concerns\RendersPublishPage;
use App\Http\Requests\App\Channel\ChannelInsightsRequest;
use App\Http\Requests\App\Channel\DownloadChannelInsightsRequest;
+use App\Http\Requests\App\Channel\ListChannelsRequest;
use App\Http\Requests\App\Channel\ReorderChannelsRequest;
+use App\Http\Resources\App\ChannelListRowResource;
use App\Http\Resources\App\ChannelPostingScheduleResource;
use App\Http\Resources\App\InstagramGridTileResource;
use App\Http\Resources\App\SocialAccountResource;
@@ -43,16 +47,23 @@ class ChannelController extends Controller
{
use EnsuresChannelInCurrentWorkspace, RendersPublishPage;
- public function index(Request $request): Response
+ public function index(ListChannelsRequest $request): Response
{
$workspace = $request->user()->currentWorkspace;
-
- $this->authorize('manageAccounts', $workspace);
+ $weekStart = $request->user()->week_starts_on;
+ $search = $request->search();
+ $networks = $request->networks();
return Inertia::render('settings/workspace/Channels', [
- 'connectedChannels' => SocialAccountResource::collection(
- $workspace->socialAccounts()->get(),
- )->resolve(),
+ 'connectedChannels' => Inertia::scroll(fn () => ChannelListRowResource::collection(
+ ListWorkspaceChannels::page($workspace, $search, $networks, $weekStart),
+ ))->matchOn('data.id'),
+ 'total' => fn (): int => $workspace->socialAccounts()->count(),
+ 'networks' => fn (): array => $request->availableNetworks(),
+ 'filters' => [
+ 'search' => $search,
+ 'networks' => $networks,
+ ],
]);
}
@@ -125,6 +136,27 @@ class ChannelController extends Controller
return Inertia::render('posts/Calendar', BuildCalendarPageProps::handle($request, $workspace, $account, $view));
}
+ public function board(Request $request, SocialAccount $account): Response|RedirectResponse
+ {
+ $this->ensureCurrentWorkspace($request, $account);
+ $workspace = $request->user()->currentWorkspace;
+ $this->authorize('view', $workspace);
+
+ if ($request->boolean('compose')) {
+ $this->authorize('createPost', $workspace);
+
+ return $this->redirectToComposer($request, 'app.channels.board', [
+ 'account' => $account->id,
+ 'group' => $request->query('group'),
+ 'labels' => $request->query('labels'),
+ 'untagged' => $request->query('untagged'),
+ 'tz' => $request->query('tz'),
+ ]);
+ }
+
+ return Inertia::render(BuildBoardPageProps::COMPONENT, BuildBoardPageProps::handle($request, $workspace, $account));
+ }
+
public function insights(
ChannelInsightsRequest $request,
SocialAccount $account,
diff --git a/app/Http/Controllers/App/InsightsController.php b/app/Http/Controllers/App/InsightsController.php
index d9251abfb..0a2779708 100644
--- a/app/Http/Controllers/App/InsightsController.php
+++ b/app/Http/Controllers/App/InsightsController.php
@@ -10,6 +10,7 @@ use App\Actions\Analytics\ListAvailableChannelMetrics;
use App\Actions\Analytics\ReadPublicationAnalytics;
use App\Actions\Analytics\ResolveAnalyticsChannelFilter;
use App\Actions\Analytics\ResolveAnalyticsRangePreset;
+use App\Dto\Analytics\PublicationFilter;
use App\Enums\Analytics\ExportFormat;
use App\Http\Controllers\Controller;
use App\Http\Requests\AnalyticsReportRequest;
@@ -36,11 +37,13 @@ class InsightsController extends Controller
['range' => $range, 'selection' => $selection, 'clamped' => $clamped] = $presets->selection($request->validated(), $request->user()->timezone);
['channels' => $channels, 'selected' => $selectedChannels, 'keys' => $channelKeys] = $channelFilter->execute($workspace, $request->collect('channels'));
- $report = $analytics->forSelection($workspace, $selection, $channelKeys, $clamped, weekStart: $request->user()->week_starts_on);
+ $filter = PublicationFilter::labelsFrom($request->safe());
+ $report = $analytics->forSelection($workspace, $selection, $channelKeys, $clamped, weekStart: $request->user()->week_starts_on, filter: $filter);
$single = $selectedChannels->count() === 1 ? $selectedChannels->first() : null;
return Inertia::render('insights/Index', [
'channelOptions' => $channels,
+ 'labels' => fn () => $workspace->labels()->orderBy('name')->get(['id', 'name', 'color']),
'availableMetrics' => $single === null ? null : $availableMetrics->handle($single, data_get($channelKeys, $single->id)),
'sync' => SyncCadence::toArray(),
'report' => [
@@ -50,6 +53,8 @@ class InsightsController extends Controller
'start' => data_get($report, 'range.start'),
'end' => data_get($report, 'range.end'),
'channels' => $selectedChannels->pluck('id')->all(),
+ 'labels' => $filter->labelIds,
+ 'untagged' => $filter->untagged,
],
],
]);
@@ -72,7 +77,7 @@ class InsightsController extends Controller
['keys' => $channelKeys] = $channelFilter->execute($workspace, $request->collect('channels'));
$accountKeys = $analytics->keys($channelKeys);
['bounds' => $bounds, 'range' => $current] = $analytics->resolveRange($workspace, $selection, $accountKeys, $clamped);
- $report = $analytics->forRange($workspace, $current, $bounds, $channelKeys, $request->user()->week_starts_on);
+ $report = $analytics->forRange($workspace, $current, $bounds, $channelKeys, $request->user()->week_starts_on, PublicationFilter::labelsFrom($request->safe()));
$sections = $export->execute($workspace, $report, $current, $accountKeys, $timezone);
$filename = 'trypost-insights-'.now($timezone)->toDateString().".{$format->value}";
diff --git a/app/Http/Controllers/App/PostController.php b/app/Http/Controllers/App/PostController.php
index befc4000b..308b1d775 100644
--- a/app/Http/Controllers/App/PostController.php
+++ b/app/Http/Controllers/App/PostController.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Http\Controllers\App;
+use App\Actions\Post\BuildBoardPageProps;
use App\Actions\Post\BuildCalendarPageProps;
use App\Actions\Post\CreatePosts;
use App\Actions\Post\DeletePost;
@@ -33,10 +34,6 @@ class PostController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('view', $workspace);
if ($request->boolean('compose')) {
@@ -59,10 +56,6 @@ class PostController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('view', $workspace);
if ($request->boolean('compose')) {
@@ -84,6 +77,27 @@ class PostController extends Controller
return Inertia::render('posts/Calendar', BuildCalendarPageProps::handle($request, $workspace, null, $view ?? $request->query('view')));
}
+ public function board(Request $request): Response|RedirectResponse
+ {
+ $workspace = $request->user()->currentWorkspace;
+
+ $this->authorize('view', $workspace);
+
+ if ($request->boolean('compose')) {
+ $this->authorize('createPost', $workspace);
+
+ return $this->redirectToComposer($request, 'app.posts.board', [
+ 'group' => $request->query('group'),
+ 'labels' => $request->query('labels'),
+ 'untagged' => $request->query('untagged'),
+ 'channels' => $request->query('channels'),
+ 'tz' => $request->query('tz'),
+ ]);
+ }
+
+ return Inertia::render(BuildBoardPageProps::COMPONENT, BuildBoardPageProps::handle($request, $workspace, null));
+ }
+
public function create(Request $request): RedirectResponse
{
$workspace = $request->user()->currentWorkspace;
@@ -97,10 +111,6 @@ class PostController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
if (! $workspace->socialAccounts()->exists()) {
@@ -134,14 +144,8 @@ class PostController extends Controller
->with('created_post_ids', $posts->pluck('id')->all());
}
- public function edit(Request $request, Post $post): Response|RedirectResponse
+ public function edit(Request $request, Post $post): RedirectResponse
{
- $workspace = $request->user()->currentWorkspace;
-
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('view', $post);
if ($request->filled('comment')) {
@@ -158,17 +162,12 @@ class PostController extends Controller
return redirect()->route('app.posts.index', [
'edit' => $post->id,
]);
-
}
public function update(UpdatePostRequest $request, Post $post): RedirectResponse
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('update', $post);
$result = UpdatePost::execute($workspace, $post, $request->validated(), $request->user());
@@ -193,12 +192,6 @@ class PostController extends Controller
public function destroy(Request $request, Post $post): RedirectResponse
{
- $workspace = $request->user()->currentWorkspace;
-
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('delete', $post);
try {
diff --git a/app/Http/Controllers/App/PostScheduleController.php b/app/Http/Controllers/App/PostScheduleController.php
index ab9a4b604..76fe27656 100644
--- a/app/Http/Controllers/App/PostScheduleController.php
+++ b/app/Http/Controllers/App/PostScheduleController.php
@@ -22,10 +22,6 @@ class PostScheduleController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('update', $post);
$scheduleAction = $request->enum('action', ScheduleAction::class);
diff --git a/app/Http/Controllers/App/WorkspaceController.php b/app/Http/Controllers/App/WorkspaceController.php
index 52ed9fdac..0ca08ea6e 100644
--- a/app/Http/Controllers/App/WorkspaceController.php
+++ b/app/Http/Controllers/App/WorkspaceController.php
@@ -131,15 +131,11 @@ class WorkspaceController extends Controller
return redirect()->route('app.calendar');
}
- public function settings(Request $request): Response|RedirectResponse
+ public function settings(Request $request): Response
{
$user = $request->user();
$workspace = $user->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('update', $workspace);
return Inertia::render('settings/workspace/Workspace', [
@@ -192,10 +188,6 @@ class WorkspaceController extends Controller
$user = $request->user();
$workspace = $user->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('update', $workspace);
$workspace->update($request->validated());
diff --git a/app/Http/Controllers/App/WorkspaceInviteController.php b/app/Http/Controllers/App/WorkspaceInviteController.php
index b5f99b86c..510f3e4f7 100644
--- a/app/Http/Controllers/App/WorkspaceInviteController.php
+++ b/app/Http/Controllers/App/WorkspaceInviteController.php
@@ -20,14 +20,10 @@ use Symfony\Component\HttpFoundation\Response;
class WorkspaceInviteController extends Controller
{
- public function index(Request $request): InertiaResponse|RedirectResponse
+ public function index(Request $request): InertiaResponse
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
return Inertia::render('settings/workspace/Members', [
@@ -57,10 +53,6 @@ class WorkspaceInviteController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('inviteMember', $workspace);
$existingInvite = $workspace->invites()
@@ -94,10 +86,6 @@ class WorkspaceInviteController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
if ($invite->account_id !== $workspace->account_id) {
@@ -116,10 +104,6 @@ class WorkspaceInviteController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('manageTeam', $workspace);
if ($userId === $request->user()->id) {
@@ -142,10 +126,6 @@ class WorkspaceInviteController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
if ($userId === $request->user()->id) {
return back()->withErrors(['is_admin' => __('settings.members.errors.cannot_change_own_access')]);
}
diff --git a/app/Http/Controllers/App/WorkspaceLabelController.php b/app/Http/Controllers/App/WorkspaceLabelController.php
index 20242970e..d8d4c50c6 100644
--- a/app/Http/Controllers/App/WorkspaceLabelController.php
+++ b/app/Http/Controllers/App/WorkspaceLabelController.php
@@ -18,14 +18,10 @@ use Inertia\Response;
class WorkspaceLabelController extends Controller
{
- public function index(Request $request): Response|RedirectResponse
+ public function index(Request $request): Response
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
$labels = ListLabels::execute($workspace, $request->input('search'))
@@ -46,10 +42,6 @@ class WorkspaceLabelController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
$label = CreateLabel::execute($workspace, $request->validated());
@@ -61,10 +53,6 @@ class WorkspaceLabelController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
if ($label->workspace_id !== $workspace->id) {
@@ -80,10 +68,6 @@ class WorkspaceLabelController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
if ($label->workspace_id !== $workspace->id) {
diff --git a/app/Http/Controllers/App/WorkspaceSignatureController.php b/app/Http/Controllers/App/WorkspaceSignatureController.php
index 2f546505a..a13952fe2 100644
--- a/app/Http/Controllers/App/WorkspaceSignatureController.php
+++ b/app/Http/Controllers/App/WorkspaceSignatureController.php
@@ -20,14 +20,10 @@ use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
class WorkspaceSignatureController extends Controller
{
- public function index(Request $request): Response|RedirectResponse
+ public function index(Request $request): Response
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
$signatures = ListSignatures::execute($workspace, $request->input('search'))
@@ -47,10 +43,6 @@ class WorkspaceSignatureController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
$signature = CreateSignature::execute($workspace, $request->validated());
@@ -66,10 +58,6 @@ class WorkspaceSignatureController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
if ($signature->workspace_id !== $workspace->id) {
@@ -89,10 +77,6 @@ class WorkspaceSignatureController extends Controller
{
$workspace = $request->user()->currentWorkspace;
- if (! $workspace) {
- return redirect()->route('app.workspaces.create');
- }
-
$this->authorize('createPost', $workspace);
if ($signature->workspace_id !== $workspace->id) {
diff --git a/app/Http/Requests/AnalyticsReportRequest.php b/app/Http/Requests/AnalyticsReportRequest.php
index 23ae3e199..fc1f651ec 100644
--- a/app/Http/Requests/AnalyticsReportRequest.php
+++ b/app/Http/Requests/AnalyticsReportRequest.php
@@ -28,6 +28,9 @@ class AnalyticsReportRequest extends FormRequest
'range' => ['sometimes', Rule::in(ResolveAnalyticsRangePreset::PRESETS)],
'start' => [$exclude, ...$presence, 'date_format:Y-m-d'],
'end' => [$exclude, ...$presence, 'date_format:Y-m-d', 'after_or_equal:start'],
+ 'labels' => ['sometimes', 'array'],
+ 'labels.*' => ['uuid'],
+ 'untagged' => ['sometimes', 'boolean'],
];
}
}
diff --git a/app/Http/Requests/Api/Analytics/ShowAnalyticsReportRequest.php b/app/Http/Requests/Api/Analytics/ShowAnalyticsReportRequest.php
index 0e43c8308..9038b6c36 100644
--- a/app/Http/Requests/Api/Analytics/ShowAnalyticsReportRequest.php
+++ b/app/Http/Requests/Api/Analytics/ShowAnalyticsReportRequest.php
@@ -28,6 +28,9 @@ class ShowAnalyticsReportRequest extends FormRequest
'range' => ['sometimes', Rule::in(ResolveAnalyticsRangePreset::PRESETS)],
'start' => [$exclude, ...$presence, 'date_format:Y-m-d'],
'end' => [$exclude, ...$presence, 'date_format:Y-m-d', 'after_or_equal:start'],
+ 'labels' => ['sometimes', 'array'],
+ 'labels.*' => ['uuid'],
+ 'untagged' => ['sometimes', 'boolean'],
];
}
}
diff --git a/app/Http/Requests/Api/Channel/ChannelInsightsRequest.php b/app/Http/Requests/Api/Channel/ChannelInsightsRequest.php
index b984aae81..6a3bb41d6 100644
--- a/app/Http/Requests/Api/Channel/ChannelInsightsRequest.php
+++ b/app/Http/Requests/Api/Channel/ChannelInsightsRequest.php
@@ -7,7 +7,6 @@ namespace App\Http\Requests\Api\Channel;
use App\Actions\Analytics\ResolveAnalyticsRangePreset;
use App\Dto\Analytics\PublicationFilter;
use App\Models\SocialAccount;
-use App\Models\WorkspaceLabel;
use App\Support\Analytics\ChannelMetrics;
use Illuminate\Auth\Access\Response;
use Illuminate\Contracts\Validation\ValidationRule;
@@ -38,9 +37,7 @@ class ChannelInsightsRequest extends FormRequest
'period' => ['sometimes', Rule::in(['current', 'previous'])],
'sort' => ['sometimes', Rule::in(ChannelMetrics::sortable())],
'labels' => ['sometimes', 'array'],
- 'labels.*' => ['bail', 'uuid', Rule::exists(WorkspaceLabel::class, 'id')
- ->where('workspace_id', $this->user()->current_workspace_id)
- ->withoutTrashed()],
+ 'labels.*' => ['uuid'],
'untagged' => ['sometimes', 'boolean'],
'types' => ['sometimes', 'array'],
'types.*' => [Rule::in(PublicationFilter::typesFor($this->channel()->platform))],
diff --git a/app/Http/Requests/App/Channel/ChannelInsightsRequest.php b/app/Http/Requests/App/Channel/ChannelInsightsRequest.php
index a669f70a7..27fa3494e 100644
--- a/app/Http/Requests/App/Channel/ChannelInsightsRequest.php
+++ b/app/Http/Requests/App/Channel/ChannelInsightsRequest.php
@@ -8,7 +8,6 @@ use App\Actions\Analytics\ResolveAnalyticsRangePreset;
use App\Dto\Analytics\PublicationFilter;
use App\Http\Controllers\App\Concerns\EnsuresChannelInCurrentWorkspace;
use App\Models\SocialAccount;
-use App\Models\WorkspaceLabel;
use App\Support\Analytics\ChannelMetrics;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
@@ -39,9 +38,7 @@ class ChannelInsightsRequest extends FormRequest
'period' => ['sometimes', Rule::in(['current', 'previous'])],
'sort' => ['sometimes', Rule::in(ChannelMetrics::sortable())],
'labels' => ['sometimes', 'array'],
- 'labels.*' => ['bail', 'uuid', Rule::exists(WorkspaceLabel::class, 'id')
- ->where('workspace_id', $this->user()->current_workspace_id)
- ->withoutTrashed()],
+ 'labels.*' => ['uuid'],
'untagged' => ['sometimes', 'boolean'],
'types' => ['sometimes', 'array'],
'types.*' => [Rule::in(PublicationFilter::typesFor($this->channel()->platform))],
diff --git a/app/Http/Requests/App/Channel/DownloadChannelInsightsRequest.php b/app/Http/Requests/App/Channel/DownloadChannelInsightsRequest.php
index 0c9c16800..1cef915db 100644
--- a/app/Http/Requests/App/Channel/DownloadChannelInsightsRequest.php
+++ b/app/Http/Requests/App/Channel/DownloadChannelInsightsRequest.php
@@ -8,7 +8,6 @@ use App\Actions\Analytics\ResolveAnalyticsRangePreset;
use App\Dto\Analytics\PublicationFilter;
use App\Http\Controllers\App\Concerns\EnsuresChannelInCurrentWorkspace;
use App\Models\SocialAccount;
-use App\Models\WorkspaceLabel;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
@@ -36,9 +35,7 @@ class DownloadChannelInsightsRequest extends FormRequest
'start' => [$exclude, 'required_if:range,custom', 'date_format:Y-m-d'],
'end' => [$exclude, 'required_if:range,custom', 'date_format:Y-m-d', 'after_or_equal:start'],
'labels' => ['sometimes', 'array'],
- 'labels.*' => ['bail', 'uuid', Rule::exists(WorkspaceLabel::class, 'id')
- ->where('workspace_id', $this->user()->current_workspace_id)
- ->withoutTrashed()],
+ 'labels.*' => ['uuid'],
'untagged' => ['sometimes', 'boolean'],
'types' => ['sometimes', 'array'],
'types.*' => [Rule::in(PublicationFilter::typesFor($this->channel()->platform))],
diff --git a/app/Http/Requests/App/Channel/ListChannelsRequest.php b/app/Http/Requests/App/Channel/ListChannelsRequest.php
new file mode 100644
index 000000000..a94b83417
--- /dev/null
+++ b/app/Http/Requests/App/Channel/ListChannelsRequest.php
@@ -0,0 +1,66 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Requests\App\Channel;
+
+use App\Actions\SocialAccount\ListWorkspaceChannels;
+use Illuminate\Foundation\Http\FormRequest;
+
+class ListChannelsRequest extends FormRequest
+{
+ public function authorize(): bool
+ {
+ return $this->user()->can('manageAccounts', $this->user()->currentWorkspace);
+ }
+
+ /**
+ * @return array<string, mixed>
+ */
+ public function rules(): array
+ {
+ return [
+ 'search' => ['nullable', 'string', 'max:255'],
+ 'networks' => ['nullable', 'array'],
+ 'networks.*' => ['string'],
+ ];
+ }
+
+ public function search(): string
+ {
+ return $this->string('search')->trim()->toString();
+ }
+
+ /**
+ * The networks asked for that the workspace has a channel on ("instagram",
+ * "linkedin"), each once, so a filter left on a network the workspace no
+ * longer has is dropped instead of hiding every channel.
+ *
+ * @return list<string>
+ */
+ public function networks(): array
+ {
+ $requested = $this->collect('networks');
+
+ if ($requested->isEmpty()) {
+ return [];
+ }
+
+ return $requested
+ ->filter(fn (mixed $network): bool => in_array($network, $this->availableNetworks(), true))
+ ->unique()
+ ->values()
+ ->all();
+ }
+
+ /**
+ * Every network the workspace has a channel on, read once per request:
+ * the filter checks the networks asked for against it and the page lists it.
+ *
+ * @return list<string>
+ */
+ public function availableNetworks(): array
+ {
+ return once(fn (): array => ListWorkspaceChannels::networks($this->user()->currentWorkspace));
+ }
+}
diff --git a/app/Http/Resources/App/ChannelListRowResource.php b/app/Http/Resources/App/ChannelListRowResource.php
new file mode 100644
index 000000000..45430b484
--- /dev/null
+++ b/app/Http/Resources/App/ChannelListRowResource.php
@@ -0,0 +1,34 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Http\Resources\App;
+
+use App\Models\SocialAccount;
+use App\Support\Timezone;
+use Illuminate\Http\Request;
+
+/**
+ * A channel as a row of the channels settings list: the channel, its time
+ * zone, its posting times a week and where its weekly goal stands (attached by
+ * ListWorkspaceChannels::page()).
+ *
+ * @mixin SocialAccount
+ */
+class ChannelListRowResource extends SocialAccountResource
+{
+ /**
+ * @return array<string, mixed>
+ */
+ public function toArray(Request $request): array
+ {
+ return [
+ ...parent::toArray($request),
+ 'timezone_option' => Timezone::option($this->timezone),
+ 'posting_times_per_week' => $this->posting_schedule?->slotCount() ?? 0,
+ 'posting_goal' => $this->posting_goal,
+ 'sent_this_week' => $this->sent_this_week,
+ 'scheduled_this_week' => $this->scheduled_this_week,
+ ];
+ }
+}
diff --git a/app/Http/Resources/App/PostCardResource.php b/app/Http/Resources/App/PostCardResource.php
index f13efe779..2602e8d68 100644
--- a/app/Http/Resources/App/PostCardResource.php
+++ b/app/Http/Resources/App/PostCardResource.php
@@ -5,8 +5,12 @@ declare(strict_types=1);
namespace App\Http\Resources\App;
use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
+use Illuminate\Support\Arr;
/**
* A post in the shape the publish page cards read (see BuildPublishPageProps::decorate).
@@ -16,28 +20,38 @@ use Illuminate\Http\Resources\Json\JsonResource;
*/
class PostCardResource extends JsonResource
{
+ /**
+ * The channels already serialized in this batch of cards, so a page of
+ * posts on a few channels serializes each channel once.
+ *
+ * Keyed by channel id. A card alone keeps its own; the cards of one
+ * serializer() share it.
+ *
+ * @var array<string, array<string, mixed>>
+ */
+ private array $serializedAccounts = [];
+
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
- $card = [
- ...$this->resource->toArray(),
- 'failure' => $this->resource->error_context === null ? null : [
- 'category' => data_get($this->resource->error_context, 'category'),
- 'failed_at' => data_get($this->resource->error_context, 'failed_at'),
- ],
- ];
+ $post = $this->resource;
- if ($this->resource->relationLoaded('user')) {
- $card['user'] = $this->user === null ? null : [
- 'id' => $this->user->id,
- 'name' => $this->user->name,
- 'photo_url' => $this->user->photo_url,
- ];
- }
-
- return $card;
+ return [
+ ...$post->attributesToArray(),
+ ...$this->otherRelations($post),
+ 'social_account' => $this->whenLoaded('socialAccount', fn (SocialAccount $account): array => $this->accountArray($account)),
+ 'user' => $this->whenLoaded('user', fn (User $user): array => [
+ 'id' => $user->id,
+ 'name' => $user->name,
+ 'photo_url' => $user->photo_url,
+ ]),
+ 'failure' => transform($post->error_context, fn (array $context): array => [
+ 'category' => data_get($context, 'category'),
+ 'failed_at' => data_get($context, 'failed_at'),
+ ]),
+ ];
}
/**
@@ -46,6 +60,43 @@ class PostCardResource extends JsonResource
*/
public static function cards(iterable $posts): array
{
- return collect($posts)->map(fn (Post $post): array => self::make($post)->resolve())->values()->all();
+ return collect($posts)->map(self::serializer())->values()->all();
+ }
+
+ /**
+ * Resolves cards one by one while sharing the work between them: each
+ * channel is serialized once for every card that uses this serializer.
+ *
+ * @return Closure(Post): array<string, mixed>
+ */
+ public static function serializer(): Closure
+ {
+ $accounts = [];
+
+ return function (Post $post) use (&$accounts): array {
+ $resource = self::make($post);
+ $resource->serializedAccounts = &$accounts;
+
+ return $resource->resolve();
+ };
+ }
+
+ /**
+ * The post's loaded relations as `toArray()` writes them (its labels…),
+ * except its channel and its author, which the card writes itself.
+ *
+ * @return array<string, mixed>
+ */
+ private function otherRelations(Post $post): array
+ {
+ return Arr::except($post->relationsToArray(), ['social_account', 'user']);
+ }
+
+ /**
+ * @return array<string, mixed>
+ */
+ private function accountArray(SocialAccount $account): array
+ {
+ return $this->serializedAccounts[$account->id] ??= $account->toArray();
}
}
diff --git a/app/Mcp/Tools/Analytics/GetAnalyticsReportTool.php b/app/Mcp/Tools/Analytics/GetAnalyticsReportTool.php
index 44a481a71..a5b60cb9a 100644
--- a/app/Mcp/Tools/Analytics/GetAnalyticsReportTool.php
+++ b/app/Mcp/Tools/Analytics/GetAnalyticsReportTool.php
@@ -7,9 +7,11 @@ namespace App\Mcp\Tools\Analytics;
use App\Actions\Analytics\BuildWorkspaceAnalyticsReport;
use App\Actions\Analytics\ResolveAnalyticsChannelFilter;
use App\Actions\Analytics\ResolveAnalyticsRangePreset;
+use App\Dto\Analytics\PublicationFilter;
use App\Mcp\Concerns\AuthorizesMcpTool;
use App\Models\Workspace;
use Illuminate\Contracts\JsonSchema\JsonSchema;
+use Illuminate\Support\ValidatedInput;
use Illuminate\Validation\Rule;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
@@ -23,7 +25,7 @@ use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
#[IsReadOnly(true)]
#[IsDestructive(false)]
#[IsOpenWorld(false)]
-#[Description('Get the current workspace analytics report for a date range (range preset 7d, 30d, mtd or custom with start and end; defaults to the last 30 days in your time zone), optionally narrowed to some channels (unknown channel ids are ignored, like the web Insights page), including summary, follower and post charts, top posts, per-account performance, data bounds, and sync coverage.')]
+#[Description('Get the current workspace analytics report for a date range (range preset 7d, 30d, mtd or custom with start and end; defaults to the last 30 days in your time zone), optionally narrowed to some channels (unknown channel ids are ignored, like the web Insights page) and by labels or untagged posts (post metrics only; followers stay account-wide), including summary, follower and post charts, top posts, per-account performance, data bounds, and sync coverage.')]
class GetAnalyticsReportTool extends Tool
{
use AuthorizesMcpTool;
@@ -48,13 +50,23 @@ class GetAnalyticsReportTool extends Tool
'range' => ['sometimes', Rule::in(ResolveAnalyticsRangePreset::PRESETS)],
'start' => [$exclude, ...$presence, 'date_format:Y-m-d'],
'end' => [$exclude, ...$presence, 'date_format:Y-m-d', 'after_or_equal:start'],
+ 'labels' => ['sometimes', 'array'],
+ 'labels.*' => ['uuid'],
+ 'untagged' => ['sometimes', 'boolean'],
]);
$user = $request->user();
['selection' => $selection, 'clamped' => $clamped] = $this->presets->selection($validated, $user->timezone);
['keys' => $channelKeys] = $this->channelFilter->execute($workspace, collect($request->get('channels', [])));
- return Response::structured($this->analytics->forSelection($workspace, $selection, $channelKeys, $clamped, weekStart: $user->week_starts_on));
+ return Response::structured($this->analytics->forSelection(
+ $workspace,
+ $selection,
+ $channelKeys,
+ $clamped,
+ weekStart: $user->week_starts_on,
+ filter: PublicationFilter::labelsFrom(new ValidatedInput($validated)),
+ ));
}
/** @return array<string, mixed> */
@@ -65,6 +77,8 @@ class GetAnalyticsReportTool extends Tool
'start' => $schema->string()->description('Optional start date in YYYY-MM-DD format.'),
'end' => $schema->string()->description('Optional end date in YYYY-MM-DD format.'),
'channels' => $schema->array()->items($schema->string())->description('Optional social account UUIDs to report on; omitted or empty reports every channel included in analytics.'),
+ 'labels' => $schema->array()->items($schema->string())->description('Optional workspace label UUIDs; only posts with one of them count in the post metrics (followers stay account-wide). A deleted or unknown label matches nothing.'),
+ 'untagged' => $schema->boolean()->description('Optional: include posts without labels (and posts published outside TryPost).'),
];
}
}
diff --git a/app/Mcp/Tools/Analytics/GetChannelInsightsTool.php b/app/Mcp/Tools/Analytics/GetChannelInsightsTool.php
index 91ce1d897..ff2c69a44 100644
--- a/app/Mcp/Tools/Analytics/GetChannelInsightsTool.php
+++ b/app/Mcp/Tools/Analytics/GetChannelInsightsTool.php
@@ -11,7 +11,6 @@ use App\Http\Resources\Api\ChannelInsightsResource;
use App\Mcp\Concerns\AuthorizesMcpTool;
use App\Models\SocialAccount;
use App\Models\Workspace;
-use App\Models\WorkspaceLabel;
use App\Support\Analytics\ChannelMetrics;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Illuminate\Validation\Rule;
@@ -61,9 +60,7 @@ class GetChannelInsightsTool extends Tool
'period' => ['sometimes', Rule::in(['current', 'previous'])],
'sort' => ['sometimes', Rule::in(ChannelMetrics::sortable())],
'labels' => ['sometimes', 'array'],
- 'labels.*' => ['bail', 'uuid', Rule::exists(WorkspaceLabel::class, 'id')
- ->where('workspace_id', $workspace->id)
- ->withoutTrashed()],
+ 'labels.*' => ['uuid'],
'untagged' => ['sometimes', 'boolean'],
'types' => ['sometimes', 'array'],
'types.*' => [Rule::in(PublicationFilter::typesFor($account->platform))],
@@ -84,7 +81,7 @@ class GetChannelInsightsTool extends Tool
'end' => $schema->string()->description('Optional end date in YYYY-MM-DD format.'),
'period' => $schema->string()->enum(['current', 'previous'])->description('Optional publication period the ranking reads (current or previous range); echoed back in filters.period.'),
'sort' => $schema->string()->enum(ChannelMetrics::sortable())->description('Optional metric the publication ranking sorts by; echoed back in filters.sort, falling back to the first metric the channel reports.'),
- 'labels' => $schema->array()->items($schema->string())->description('Optional workspace label UUIDs; only posts with one of them count.'),
+ 'labels' => $schema->array()->items($schema->string())->description('Optional workspace label UUIDs; only posts with one of them count. A deleted or unknown label matches nothing.'),
'untagged' => $schema->boolean()->description('Optional: include posts without labels (and posts published outside TryPost).'),
'types' => $schema->array()->items($schema->string())->description('Optional post types of this channel\'s platform (see list-content-types-tool); only those posts count.'),
];
diff --git a/app/Mcp/Tools/Analytics/ListChannelPublicationsTool.php b/app/Mcp/Tools/Analytics/ListChannelPublicationsTool.php
index 7becb5dfe..571b2c9dd 100644
--- a/app/Mcp/Tools/Analytics/ListChannelPublicationsTool.php
+++ b/app/Mcp/Tools/Analytics/ListChannelPublicationsTool.php
@@ -11,7 +11,6 @@ use App\Http\Resources\Api\ChannelPublicationPerformanceResource;
use App\Mcp\Concerns\AuthorizesMcpTool;
use App\Models\SocialAccount;
use App\Models\Workspace;
-use App\Models\WorkspaceLabel;
use App\Support\Analytics\ChannelMetrics;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Illuminate\Validation\Rule;
@@ -61,9 +60,7 @@ class ListChannelPublicationsTool extends Tool
'period' => ['sometimes', Rule::in(['current', 'previous'])],
'sort' => ['sometimes', Rule::in(ChannelMetrics::sortable())],
'labels' => ['sometimes', 'array'],
- 'labels.*' => ['bail', 'uuid', Rule::exists(WorkspaceLabel::class, 'id')
- ->where('workspace_id', $workspace->id)
- ->withoutTrashed()],
+ 'labels.*' => ['uuid'],
'untagged' => ['sometimes', 'boolean'],
'types' => ['sometimes', 'array'],
'types.*' => [Rule::in(PublicationFilter::typesFor($account->platform))],
@@ -94,7 +91,7 @@ class ListChannelPublicationsTool extends Tool
'end' => $schema->string()->description('Optional end date in YYYY-MM-DD format.'),
'period' => $schema->string()->enum(['current', 'previous'])->description('Optional: rank the posts of the current range (default) or of the previous range of the same length.'),
'sort' => $schema->string()->enum(ChannelMetrics::sortable())->description('Optional metric to rank by; a metric the channel does not report falls back to the first one it does (see filters.sort).'),
- 'labels' => $schema->array()->items($schema->string())->description('Optional workspace label UUIDs; only posts with one of them count.'),
+ 'labels' => $schema->array()->items($schema->string())->description('Optional workspace label UUIDs; only posts with one of them count. A deleted or unknown label matches nothing.'),
'untagged' => $schema->boolean()->description('Optional: include posts without labels (and posts published outside TryPost).'),
'types' => $schema->array()->items($schema->string())->description('Optional post types of this channel\'s platform (see list-content-types-tool); only those posts count.'),
'page' => $schema->integer()->description('Page number.'),
diff --git a/app/Models/Post.php b/app/Models/Post.php
index 768414d52..4ad56d5d3 100644
--- a/app/Models/Post.php
+++ b/app/Models/Post.php
@@ -337,6 +337,35 @@ class Post extends Model
return $query->orderByRaw('COALESCE(posts.published_at, posts.scheduled_at, posts.created_at) DESC');
}
+ /**
+ * Approval requests by when they are due, requests without a time last,
+ * then by when they were asked for.
+ */
+ public function scopeApprovalOrder(Builder $query): Builder
+ {
+ return $query->orderByRaw('posts.scheduled_at IS NULL')
+ ->orderBy('posts.scheduled_at')
+ ->orderBy('posts.approval_requested_at');
+ }
+
+ /**
+ * How many posts of the query each channel has, keyed by channel id, in
+ * one grouped count; a channel with none is absent.
+ *
+ * @param Builder<Post> $query
+ * @return array<string, int>
+ */
+ public static function countPerChannel(Builder $query): array
+ {
+ return $query->toBase()
+ ->select('posts.social_account_id')
+ ->selectRaw('count(*) as aggregate')
+ ->groupBy('posts.social_account_id')
+ ->pluck('aggregate', 'social_account_id')
+ ->map(fn (mixed $count): int => (int) $count)
+ ->all();
+ }
+
/**
* Posts on any of the channels; no filter when $channelIds is null.
*
diff --git a/app/Support/PublishFilters.php b/app/Support/PublishFilters.php
new file mode 100644
index 000000000..d6c2a371f
--- /dev/null
+++ b/app/Support/PublishFilters.php
@@ -0,0 +1,76 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Support;
+
+use App\Models\SocialAccount;
+use App\Models\User;
+use Illuminate\Http\Request;
+
+/**
+ * The filters every view of the Publish page (List, Calendar, Board) reads from
+ * the URL: labels, untagged, the requested channels on the all-channels page and
+ * the display time zone.
+ */
+final class PublishFilters
+{
+ /**
+ * @param list<string> $labelIds
+ * @param list<string> $requestedChannelIds
+ * @param list<string>|null $scopedChannelIds
+ */
+ private function __construct(
+ public readonly array $labelIds,
+ public readonly bool $untagged,
+ public readonly array $requestedChannelIds,
+ public readonly ?array $scopedChannelIds,
+ public readonly string $displayTimezone,
+ ) {}
+
+ public static function fromRequest(Request $request, ?SocialAccount $channel, User $user): self
+ {
+ $requestedChannelIds = filled($channel) ? [] : RequestIds::uuidList($request->collect('channels')->unique());
+ $timezone = $request->query('tz');
+
+ return new self(
+ labelIds: RequestIds::uuidList($request->collect('labels')),
+ untagged: $request->boolean('untagged'),
+ requestedChannelIds: $requestedChannelIds,
+ scopedChannelIds: self::scopedChannelIds($channel, $requestedChannelIds),
+ displayTimezone: Timezone::known(is_string($timezone) ? $timezone : null) ?? Timezone::normalize($user->timezone),
+ );
+ }
+
+ /**
+ * The channels the posts are read from: the page's channel, else the ones
+ * asked for, else every channel (null).
+ *
+ * @param list<string> $requestedChannelIds
+ * @return list<string>|null
+ */
+ private static function scopedChannelIds(?SocialAccount $channel, array $requestedChannelIds): ?array
+ {
+ if (filled($channel)) {
+ return [$channel->id];
+ }
+
+ if (filled($requestedChannelIds)) {
+ return $requestedChannelIds;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return array{labels: list<string>, untagged: bool, channels: list<string>}
+ */
+ public function toProp(): array
+ {
+ return [
+ 'labels' => $this->labelIds,
+ 'untagged' => $this->untagged,
+ 'channels' => $this->requestedChannelIds,
+ ];
+ }
+}
diff --git a/app/Support/Timezone.php b/app/Support/Timezone.php
index 5ac2aa483..0ebfa0c3e 100644
--- a/app/Support/Timezone.php
+++ b/app/Support/Timezone.php
@@ -4,9 +4,11 @@ declare(strict_types=1);
namespace App\Support;
-use DateTimeImmutable;
+use Carbon\CarbonInterface;
+use Carbon\CarbonTimeZone;
use DateTimeZone;
use Illuminate\Support\Collection;
+use Illuminate\Support\Str;
use IntlTimeZone;
class Timezone
@@ -14,15 +16,24 @@ class Timezone
public const DEFAULT = 'UTC';
public static function normalize(?string $value): string
+ {
+ return self::known($value) ?? self::DEFAULT;
+ }
+
+ /**
+ * The canonical identifier of a zone PHP knows (its IANA alias resolved),
+ * or null for a blank or unknown one.
+ */
+ public static function known(?string $value): ?string
{
if (blank($value)) {
- return self::DEFAULT;
+ return null;
}
$canonical = once(fn (): Collection => collect(DateTimeZone::listIdentifiers())->flip());
return collect([$value, IntlTimeZone::getIanaID($value)])
- ->first(fn (mixed $zone): bool => is_string($zone) && $canonical->has($zone), self::DEFAULT);
+ ->first(fn (mixed $zone): bool => is_string($zone) && $canonical->has($zone));
}
/**
@@ -32,10 +43,19 @@ class Timezone
*/
public static function usable(string $value): string
{
- $known = once(fn (): Collection => collect(DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC))->flip());
- $normalized = self::normalize($value);
+ $canonical = self::known($value);
+
+ if (filled($canonical)) {
+ return $canonical;
+ }
- return $normalized === self::DEFAULT && $known->has($value) ? $value : $normalized;
+ $understood = once(fn (): Collection => collect(DateTimeZone::listIdentifiers(DateTimeZone::ALL_WITH_BC))->flip());
+
+ if ($understood->has($value)) {
+ return $value;
+ }
+
+ return self::DEFAULT;
}
/**
@@ -43,23 +63,45 @@ class Timezone
*/
public static function options(): array
{
- $now = new DateTimeImmutable('now');
-
- return array_map(function (string $identifier) use ($now): array {
- $seconds = (new DateTimeZone($identifier))->getOffset($now);
- $sign = $seconds < 0 ? '-' : '+';
- $hours = intdiv(abs($seconds), 3600);
- $minutes = intdiv(abs($seconds) % 3600, 60);
- $offset = $seconds === 0
- ? 'GMT'
- : ($minutes === 0 ? "GMT{$sign}{$hours}" : sprintf('GMT%s%d:%02d', $sign, $hours, $minutes));
- $segments = explode('/', $identifier);
-
- return [
- 'value' => $identifier,
- 'label' => str_replace('_', ' ', (string) end($segments)),
- 'offset' => $offset,
- ];
- }, DateTimeZone::listIdentifiers());
+ $now = now();
+
+ return collect(DateTimeZone::listIdentifiers())
+ ->map(fn (string $identifier): array => self::option($identifier, $now))
+ ->all();
+ }
+
+ /**
+ * A canonical time zone as the pickers show it: its city ("Sao Paulo") and
+ * its offset at that instant ("GMT-3").
+ *
+ * @return array{value: string, label: string, offset: string}
+ */
+ public static function option(string $identifier, ?CarbonInterface $at = null): array
+ {
+ return [
+ 'value' => $identifier,
+ 'label' => Str::of($identifier)->afterLast('/')->replace('_', ' ')->toString(),
+ 'offset' => self::gmtOffset(intdiv(CarbonTimeZone::create($identifier)->getOffset($at ?? now()), 60)),
+ ];
+ }
+
+ /**
+ * An offset in minutes as the pickers write it: "GMT", "GMT-3", "GMT+5:30".
+ */
+ private static function gmtOffset(int $minutes): string
+ {
+ if ($minutes === 0) {
+ return 'GMT';
+ }
+
+ $sign = $minutes < 0 ? '-' : '+';
+ $hours = intdiv(abs($minutes), 60);
+ $rest = abs($minutes) % 60;
+
+ if ($rest === 0) {
+ return "GMT{$sign}{$hours}";
+ }
+
+ return sprintf('GMT%s%d:%02d', $sign, $hours, $rest);
}
}
diff --git a/lang/ar/channels.php b/lang/ar/channels.php
index 4a15951f8..b94407b95 100644
--- a/lang/ar/channels.php
+++ b/lang/ar/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'أدر قنوات مساحة العمل هذه.',
'connect' => 'ربط قناة',
'settings' => 'إعدادات القناة',
+ 'manage' => 'إدارة القنوات',
+ 'set_goal' => 'حدّد هدف النشر',
'publish' => 'نشر',
'insights' => 'Insights',
'new_post' => 'منشور جديد في هذه القناة',
@@ -170,6 +172,25 @@ return [
'cancel' => 'إلغاء',
],
+ 'list' => [
+ 'search' => 'ابحث بالاسم أو @اسم المستخدم أو الشبكة',
+ 'networks' => 'الشبكات',
+ 'networks_search' => 'ابحث في الشبكات',
+ 'no_networks' => 'لم يتم العثور على شبكات',
+ 'columns' => [
+ 'channel' => 'القناة',
+ 'timezone' => 'المنطقة الزمنية',
+ 'posting_times' => 'أوقات النشر',
+ 'this_week' => 'هذا الأسبوع',
+ ],
+ 'posting_times_per_week' => ':count في الأسبوع',
+ 'no_posting_times' => 'لا توجد أوقات نشر',
+ 'no_results' => 'لا توجد قنوات تطابق بحثك.',
+ 'connection_lost' => 'فقدت هذه القناة الاتصال',
+ 'settings' => 'الإعدادات',
+ 'more_actions' => 'إجراءات أخرى',
+ ],
+
'settings_page' => [
'subtitle' => 'إعدادات القناة',
'back' => 'العودة إلى القنوات',
diff --git a/lang/ar/labels.php b/lang/ar/labels.php
index e81f4b8e4..aca521980 100644
--- a/lang/ar/labels.php
+++ b/lang/ar/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'تعديل التسمية',
'delete' => 'حذف التسمية',
'more' => 'مزيد من الإجراءات',
+ 'settings' => 'الإعدادات',
'view_posts' => 'عرض المنشورات',
+ 'view_insights' => 'عرض Insights',
],
'create' => [
diff --git a/lang/ar/posts.php b/lang/ar/posts.php
index dbbc8d6bb..1f98aeae6 100644
--- a/lang/ar/posts.php
+++ b/lang/ar/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'قائمة',
+ 'board' => [
+ 'view' => 'لوحة',
+ 'group_by' => 'تجميع حسب',
+ 'group_by_value' => 'تجميع حسب: :group',
+ 'groups' => [
+ 'status' => 'الحالة',
+ 'tag' => 'التسمية',
+ 'channel' => 'القناة',
+ ],
+ 'columns' => [
+ 'draft' => 'مسودة',
+ 'approvals' => 'الموافقات',
+ 'scheduled' => 'مجدول',
+ 'published' => 'منشور',
+ 'failed' => 'فشل',
+ 'untagged' => 'بدون تسمية',
+ 'no_channel' => 'بلا قناة',
+ ],
+ 'empty_column' => 'لا شيء هنا',
+ 'no_columns' => [
+ 'title' => 'لا شيء يطابق هذه الفلاتر',
+ 'description' => 'امسح فلتر التسمية أو القناة لعرض كل الأعمدة.',
+ ],
+ 'column_aria' => '{1} :name، المنشورات: :count|[0,*] :name، المنشورات: :count',
+ ],
'view_switcher' => 'عرض الجدول',
'all_posts' => 'جميع المنشورات',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'قيد الانتظار',
'draft' => 'مسودة',
- 'pending_approval' => 'بانتظار الموافقة',
+ 'pending_approval' => 'قيد الانتظار',
'scheduled' => 'مجدول',
'publishing' => 'قيد النشر',
'retrying' => 'إعادة المحاولة',
'published' => 'منشور',
'failed' => 'فشل',
+ 'pending_review' => 'قيد مراجعة Google',
+ 'deleted_on_network' => 'محذوف',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'القنوات (:count)',
],
'approvals' => [
- 'badge' => 'موافقة',
'time_passed' => 'انقضى الوقت',
'approve' => 'وافق',
'schedule' => 'جدولة',
'reject' => 'رفض',
'revert' => 'إلغاء طلب الموافقة',
'requested' => 'تم طلب الموافقة',
+ 'toasts' => [
+ 'scheduled' => 'تمت الموافقة على المنشور وجدولته',
+ 'queued' => 'تمت الموافقة على المنشور وإضافته إلى قائمة الانتظار',
+ 'publishing' => 'تمت الموافقة على المنشور وجارٍ نشره الآن',
+ 'rejected' => 'تم رفض المنشور ونقله إلى المسودات',
+ ],
'errors' => [
'not_pending' => 'لم يعد هذا المنشور بانتظار الموافقة.',
'time_passed' => 'انقضى الوقت المطلوب. اختر وقتًا جديدًا.',
diff --git a/lang/ar/sidebar.php b/lang/ar/sidebar.php
index 7accbc31f..1513aab46 100644
--- a/lang/ar/sidebar.php
+++ b/lang/ar/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'اختر مساحة العمل',
'create_workspace' => 'إنشاء مساحة عمل',
'new' => 'جديد',
+ 'unfinished_post' => 'لديك منشور لم تُكمله',
'create' => 'إنشاء',
'new_menu' => [
'post' => 'منشور',
diff --git a/lang/ar/signatures.php b/lang/ar/signatures.php
index 4e6248e7a..2b11327ca 100644
--- a/lang/ar/signatures.php
+++ b/lang/ar/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'تاريخ الإنشاء',
],
- 'row_actions' => 'إجراءات التوقيع',
'actions' => [
'edit' => 'تعديل التوقيع',
- 'delete' => 'حذف التوقيع',
+ 'delete' => 'حذف',
+ 'settings' => 'الإعدادات',
],
'create' => [
diff --git a/lang/de/channels.php b/lang/de/channels.php
index e753b7bb9..8fce5cbfb 100644
--- a/lang/de/channels.php
+++ b/lang/de/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Verwalte die Kanäle dieses Workspace.',
'connect' => 'Kanal verbinden',
'settings' => 'Kanaleinstellungen',
+ 'manage' => 'Kanäle verwalten',
+ 'set_goal' => 'Veröffentlichungsziel festlegen',
'publish' => 'Veröffentlichen',
'insights' => 'Insights',
'new_post' => 'Neuer Beitrag in diesem Kanal',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Abbrechen',
],
+ 'list' => [
+ 'search' => 'Nach Name, @Benutzername oder Netzwerk suchen',
+ 'networks' => 'Netzwerke',
+ 'networks_search' => 'Netzwerke suchen',
+ 'no_networks' => 'Keine Netzwerke gefunden',
+ 'columns' => [
+ 'channel' => 'Kanal',
+ 'timezone' => 'Zeitzone',
+ 'posting_times' => 'Zeiten',
+ 'this_week' => 'Diese Woche',
+ ],
+ 'posting_times_per_week' => ':count pro Woche',
+ 'no_posting_times' => 'Keine Zeiten',
+ 'no_results' => 'Kein Kanal passt zu deiner Suche.',
+ 'connection_lost' => 'Dieser Kanal hat die Verbindung verloren',
+ 'settings' => 'Einstellungen',
+ 'more_actions' => 'Weitere Aktionen',
+ ],
+
'settings_page' => [
'subtitle' => 'Kanaleinstellungen',
'back' => 'Zurück zu den Kanälen',
diff --git a/lang/de/labels.php b/lang/de/labels.php
index 09fc27090..f43c83576 100644
--- a/lang/de/labels.php
+++ b/lang/de/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Label bearbeiten',
'delete' => 'Label löschen',
'more' => 'Weitere Aktionen',
+ 'settings' => 'Einstellungen',
'view_posts' => 'Beiträge ansehen',
+ 'view_insights' => 'Insights ansehen',
],
'create' => [
diff --git a/lang/de/posts.php b/lang/de/posts.php
index a066ea139..e145c166c 100644
--- a/lang/de/posts.php
+++ b/lang/de/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Liste',
+ 'board' => [
+ 'view' => 'Board',
+ 'group_by' => 'Gruppieren nach',
+ 'group_by_value' => 'Gruppieren nach: :group',
+ 'groups' => [
+ 'status' => 'Status',
+ 'tag' => 'Label',
+ 'channel' => 'Kanal',
+ ],
+ 'columns' => [
+ 'draft' => 'Entwurf',
+ 'approvals' => 'Freigaben',
+ 'scheduled' => 'Geplant',
+ 'published' => 'Veröffentlicht',
+ 'failed' => 'Fehlgeschlagen',
+ 'untagged' => 'Ohne Label',
+ 'no_channel' => 'Kein Kanal',
+ ],
+ 'empty_column' => 'Hier ist nichts',
+ 'no_columns' => [
+ 'title' => 'Nichts passt zu diesen Filtern',
+ 'description' => 'Entferne den Label- oder Kanalfilter, um alle Spalten zu sehen.',
+ ],
+ 'column_aria' => '{1} :name, :count Beitrag|[0,*] :name, :count Beiträge',
+ ],
'view_switcher' => 'Planungsansicht',
'all_posts' => 'Alle Beiträge',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Ausstehend',
'draft' => 'Entwurf',
- 'pending_approval' => 'Wartet auf Freigabe',
+ 'pending_approval' => 'Ausstehend',
'scheduled' => 'Geplant',
'publishing' => 'Wird veröffentlicht',
'retrying' => 'Erneuter Versuch',
'published' => 'Veröffentlicht',
'failed' => 'Fehlgeschlagen',
+ 'pending_review' => 'Google-Prüfung läuft',
+ 'deleted_on_network' => 'Gelöscht',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Kanäle (:count)',
],
'approvals' => [
- 'badge' => 'Freigabe',
'time_passed' => 'Zeitpunkt verstrichen',
'approve' => 'Freigeben',
'schedule' => 'Planen',
'reject' => 'Ablehnen',
'revert' => 'Freigabeanfrage zurückziehen',
'requested' => 'Freigabe angefragt',
+ 'toasts' => [
+ 'scheduled' => 'Beitrag freigegeben und geplant',
+ 'queued' => 'Beitrag freigegeben und zur Warteschlange hinzugefügt',
+ 'publishing' => 'Beitrag freigegeben, wird jetzt veröffentlicht',
+ 'rejected' => 'Beitrag abgelehnt und zu den Entwürfen verschoben',
+ ],
'errors' => [
'not_pending' => 'Dieser Beitrag wartet nicht mehr auf Freigabe.',
'time_passed' => 'Der gewünschte Zeitpunkt ist vorbei. Wähle einen neuen.',
diff --git a/lang/de/sidebar.php b/lang/de/sidebar.php
index b2cb82a3a..e36021d7e 100644
--- a/lang/de/sidebar.php
+++ b/lang/de/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Workspace auswählen',
'create_workspace' => 'Workspace erstellen',
'new' => 'Neu',
+ 'unfinished_post' => 'Du hast einen Beitrag nicht fertiggestellt',
'create' => 'Erstellen',
'new_menu' => [
'post' => 'Beitrag',
diff --git a/lang/de/signatures.php b/lang/de/signatures.php
index 51bcf329d..80d5d735f 100644
--- a/lang/de/signatures.php
+++ b/lang/de/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Erstellt',
],
- 'row_actions' => 'Signatur-Aktionen',
'actions' => [
'edit' => 'Signatur bearbeiten',
- 'delete' => 'Signatur löschen',
+ 'delete' => 'Löschen',
+ 'settings' => 'Einstellungen',
],
'create' => [
diff --git a/lang/el/channels.php b/lang/el/channels.php
index 3e43a6ce7..bd62f82b1 100644
--- a/lang/el/channels.php
+++ b/lang/el/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Διαχειριστείτε τα κανάλια του χώρου σας.',
'connect' => 'Σύνδεση καναλιού',
'settings' => 'Ρυθμίσεις καναλιού',
+ 'manage' => 'Διαχείριση καναλιών',
+ 'set_goal' => 'Ορισμός στόχου δημοσιεύσεων',
'publish' => 'Δημοσίευση',
'insights' => 'Insights',
'new_post' => 'Νέα ανάρτηση σε αυτό το κανάλι',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Ακύρωση',
],
+ 'list' => [
+ 'search' => 'Αναζήτηση με όνομα, @όνομα χρήστη ή δίκτυο',
+ 'networks' => 'Δίκτυα',
+ 'networks_search' => 'Αναζήτηση δικτύων',
+ 'no_networks' => 'Δεν βρέθηκαν δίκτυα',
+ 'columns' => [
+ 'channel' => 'Κανάλι',
+ 'timezone' => 'Ζώνη ώρας',
+ 'posting_times' => 'Ώρες',
+ 'this_week' => 'Αυτή την εβδομάδα',
+ ],
+ 'posting_times_per_week' => ':count την εβδομάδα',
+ 'no_posting_times' => 'Χωρίς ώρες',
+ 'no_results' => 'Κανένα κανάλι δεν ταιριάζει με την αναζήτηση.',
+ 'connection_lost' => 'Αυτό το κανάλι έχασε τη σύνδεση',
+ 'settings' => 'Ρυθμίσεις',
+ 'more_actions' => 'Περισσότερες ενέργειες',
+ ],
+
'settings_page' => [
'subtitle' => 'Ρυθμίσεις καναλιού',
'back' => 'Πίσω στα κανάλια',
diff --git a/lang/el/labels.php b/lang/el/labels.php
index 380a33571..513e22f61 100644
--- a/lang/el/labels.php
+++ b/lang/el/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Επεξεργασία ετικέτας',
'delete' => 'Διαγραφή ετικέτας',
'more' => 'Περισσότερες ενέργειες',
+ 'settings' => 'Ρυθμίσεις',
'view_posts' => 'Προβολή αναρτήσεων',
+ 'view_insights' => 'Προβολή Insights',
],
'create' => [
diff --git a/lang/el/posts.php b/lang/el/posts.php
index c7c49741d..c855ae3c5 100644
--- a/lang/el/posts.php
+++ b/lang/el/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Λίστα',
+ 'board' => [
+ 'view' => 'Πίνακας',
+ 'group_by' => 'Ομαδοποίηση κατά',
+ 'group_by_value' => 'Ομαδοποίηση κατά: :group',
+ 'groups' => [
+ 'status' => 'Κατάσταση',
+ 'tag' => 'Ετικέτα',
+ 'channel' => 'Κανάλι',
+ ],
+ 'columns' => [
+ 'draft' => 'Πρόχειρο',
+ 'approvals' => 'Εγκρίσεις',
+ 'scheduled' => 'Προγραμματισμένη',
+ 'published' => 'Δημοσιεύτηκε',
+ 'failed' => 'Απέτυχε',
+ 'untagged' => 'Χωρίς ετικέτα',
+ 'no_channel' => 'Χωρίς κανάλι',
+ ],
+ 'empty_column' => 'Δεν υπάρχει τίποτα εδώ',
+ 'no_columns' => [
+ 'title' => 'Τίποτα δεν ταιριάζει σε αυτά τα φίλτρα',
+ 'description' => 'Καθαρίστε το φίλτρο ετικέτας ή καναλιού για να δείτε όλες τις στήλες.',
+ ],
+ 'column_aria' => '{1} :name, :count δημοσίευση|[0,*] :name, :count δημοσιεύσεις',
+ ],
'view_switcher' => 'Προβολή προγράμματος',
'all_posts' => 'Όλες οι δημοσιεύσεις',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Σε εκκρεμότητα',
'draft' => 'Πρόχειρο',
- 'pending_approval' => 'Σε αναμονή έγκρισης',
+ 'pending_approval' => 'Σε αναμονή',
'scheduled' => 'Προγραμματισμένη',
'publishing' => 'Δημοσιεύεται',
'retrying' => 'Επανάληψη',
'published' => 'Δημοσιεύτηκε',
'failed' => 'Απέτυχε',
+ 'pending_review' => 'Σε έλεγχο από την Google',
+ 'deleted_on_network' => 'Διαγράφηκε',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Κανάλια (:count)',
],
'approvals' => [
- 'badge' => 'Προς έγκριση',
'time_passed' => 'Η ώρα πέρασε',
'approve' => 'Έγκριση',
'schedule' => 'Προγραμματισμός',
'reject' => 'Απόρριψη',
'revert' => 'Ανάκληση αιτήματος έγκρισης',
'requested' => 'Ζητήθηκε έγκριση',
+ 'toasts' => [
+ 'scheduled' => 'Η ανάρτηση εγκρίθηκε και προγραμματίστηκε',
+ 'queued' => 'Η ανάρτηση εγκρίθηκε και προστέθηκε στην ουρά',
+ 'publishing' => 'Η ανάρτηση εγκρίθηκε και δημοσιεύεται τώρα',
+ 'rejected' => 'Η ανάρτηση απορρίφθηκε και μεταφέρθηκε στα πρόχειρα',
+ ],
'errors' => [
'not_pending' => 'Αυτή η ανάρτηση δεν περιμένει πλέον έγκριση.',
'time_passed' => 'Η ώρα που ζητήθηκε έχει περάσει. Επιλέξτε νέα ώρα.',
diff --git a/lang/el/sidebar.php b/lang/el/sidebar.php
index d2289dede..288ecffcb 100644
--- a/lang/el/sidebar.php
+++ b/lang/el/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Επιλογή workspace',
'create_workspace' => 'Δημιουργία workspace',
'new' => 'Νέο',
+ 'unfinished_post' => 'Έχετε μια ανάρτηση που δεν ολοκληρώσατε',
'create' => 'Δημιουργία',
'new_menu' => [
'post' => 'Ανάρτηση',
diff --git a/lang/el/signatures.php b/lang/el/signatures.php
index e0a8b357c..65eff86b3 100644
--- a/lang/el/signatures.php
+++ b/lang/el/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Δημιουργήθηκε',
],
- 'row_actions' => 'Ενέργειες υπογραφής',
'actions' => [
'edit' => 'Επεξεργασία υπογραφής',
- 'delete' => 'Διαγραφή υπογραφής',
+ 'delete' => 'Διαγραφή',
+ 'settings' => 'Ρυθμίσεις',
],
'create' => [
diff --git a/lang/en/channels.php b/lang/en/channels.php
index 2b245522a..65138724a 100644
--- a/lang/en/channels.php
+++ b/lang/en/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Manage this workspace\'s connected channels.',
'connect' => 'Connect channel',
'settings' => 'Channel settings',
+ 'manage' => 'Manage channels',
+ 'set_goal' => 'Set a posting goal',
'publish' => 'Publish',
'insights' => 'Insights',
'new_post' => 'New post in this channel',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Cancel',
],
+ 'list' => [
+ 'search' => 'Search by name, @username or network',
+ 'networks' => 'Networks',
+ 'networks_search' => 'Search networks',
+ 'no_networks' => 'No networks found',
+ 'columns' => [
+ 'channel' => 'Channel',
+ 'timezone' => 'Time zone',
+ 'posting_times' => 'Posting times',
+ 'this_week' => 'This week',
+ ],
+ 'posting_times_per_week' => ':count per week',
+ 'no_posting_times' => 'No posting times',
+ 'no_results' => 'No channels match your search.',
+ 'connection_lost' => 'This channel lost its connection',
+ 'settings' => 'Settings',
+ 'more_actions' => 'More actions',
+ ],
+
'settings_page' => [
'subtitle' => 'Channel settings',
'back' => 'Back to channels',
diff --git a/lang/en/labels.php b/lang/en/labels.php
index 95b6fcbbc..57fe6288c 100644
--- a/lang/en/labels.php
+++ b/lang/en/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Edit label',
'delete' => 'Delete label',
'more' => 'More actions',
+ 'settings' => 'Settings',
'view_posts' => 'View posts',
+ 'view_insights' => 'View insights',
],
'create' => [
diff --git a/lang/en/posts.php b/lang/en/posts.php
index 6ffda5b67..5ae35983b 100644
--- a/lang/en/posts.php
+++ b/lang/en/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'List',
+ 'board' => [
+ 'view' => 'Board',
+ 'group_by' => 'Group by',
+ 'group_by_value' => 'Group by: :group',
+ 'groups' => [
+ 'status' => 'Status',
+ 'tag' => 'Label',
+ 'channel' => 'Channel',
+ ],
+ 'columns' => [
+ 'draft' => 'Draft',
+ 'approvals' => 'Approvals',
+ 'scheduled' => 'Scheduled',
+ 'published' => 'Published',
+ 'failed' => 'Failed',
+ 'untagged' => 'Untagged',
+ 'no_channel' => 'No channel',
+ ],
+ 'empty_column' => 'Nothing here',
+ 'no_columns' => [
+ 'title' => 'Nothing matches these filters',
+ 'description' => 'Clear the label or channel filter to see every column.',
+ ],
+ 'column_aria' => '{1} :name, :count post|[0,*] :name, :count posts',
+ ],
'view_switcher' => 'Schedule view',
'all_posts' => 'All Posts',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Pending',
'draft' => 'Draft',
- 'pending_approval' => 'Pending approval',
+ 'pending_approval' => 'Pending',
'scheduled' => 'Scheduled',
'publishing' => 'Publishing',
'retrying' => 'Retrying',
'published' => 'Published',
'failed' => 'Failed',
+ 'pending_review' => 'In review by Google',
+ 'deleted_on_network' => 'Deleted',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Channels (:count)',
],
'approvals' => [
- 'badge' => 'Approval',
'time_passed' => 'Time has passed',
'approve' => 'Approve',
'schedule' => 'Schedule',
'reject' => 'Reject',
'revert' => 'Revert approval request',
'requested' => 'Approval requested',
+ 'toasts' => [
+ 'scheduled' => 'Post approved and scheduled',
+ 'queued' => 'Post approved and added to queue',
+ 'publishing' => 'Post approved and publishing now',
+ 'rejected' => 'Post rejected and moved to drafts',
+ ],
'errors' => [
'not_pending' => 'This post is no longer waiting for approval.',
'time_passed' => 'The requested time has passed. Choose a new time.',
diff --git a/lang/en/sidebar.php b/lang/en/sidebar.php
index 155e4a5fa..af526601b 100644
--- a/lang/en/sidebar.php
+++ b/lang/en/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Select workspace',
'create_workspace' => 'Create workspace',
'new' => 'New',
+ 'unfinished_post' => 'You have a post you didn\'t finish',
'create' => 'Create',
'new_menu' => [
'post' => 'Post',
diff --git a/lang/en/signatures.php b/lang/en/signatures.php
index 2f026e5db..499313db6 100644
--- a/lang/en/signatures.php
+++ b/lang/en/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Created',
],
- 'row_actions' => 'Signature actions',
'actions' => [
'edit' => 'Edit signature',
- 'delete' => 'Delete signature',
+ 'delete' => 'Delete',
+ 'settings' => 'Settings',
],
'create' => [
diff --git a/lang/es/channels.php b/lang/es/channels.php
index 77049de36..dfe09d3b3 100644
--- a/lang/es/channels.php
+++ b/lang/es/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Gestiona los canales de este workspace.',
'connect' => 'Conectar canal',
'settings' => 'Configuración del canal',
+ 'manage' => 'Gestionar canales',
+ 'set_goal' => 'Definir un objetivo de publicación',
'publish' => 'Publicar',
'insights' => 'Insights',
'new_post' => 'Nueva publicación en este canal',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Cancelar',
],
+ 'list' => [
+ 'search' => 'Buscar por nombre, @usuario o red',
+ 'networks' => 'Redes',
+ 'networks_search' => 'Buscar redes',
+ 'no_networks' => 'No se encontraron redes',
+ 'columns' => [
+ 'channel' => 'Canal',
+ 'timezone' => 'Zona horaria',
+ 'posting_times' => 'Horarios',
+ 'this_week' => 'Esta semana',
+ ],
+ 'posting_times_per_week' => ':count por semana',
+ 'no_posting_times' => 'Sin horarios',
+ 'no_results' => 'Ningún canal coincide con tu búsqueda.',
+ 'connection_lost' => 'Este canal perdió la conexión',
+ 'settings' => 'Configuración',
+ 'more_actions' => 'Más acciones',
+ ],
+
'settings_page' => [
'subtitle' => 'Configuración del canal',
'back' => 'Volver a los canales',
diff --git a/lang/es/labels.php b/lang/es/labels.php
index 272add25d..cb4a003d5 100644
--- a/lang/es/labels.php
+++ b/lang/es/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Editar etiqueta',
'delete' => 'Eliminar etiqueta',
'more' => 'Más acciones',
+ 'settings' => 'Configuración',
'view_posts' => 'Ver publicaciones',
+ 'view_insights' => 'Ver insights',
],
'create' => [
diff --git a/lang/es/posts.php b/lang/es/posts.php
index 3b4c44d83..77d4abe1c 100644
--- a/lang/es/posts.php
+++ b/lang/es/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Lista',
+ 'board' => [
+ 'view' => 'Tablero',
+ 'group_by' => 'Agrupar por',
+ 'group_by_value' => 'Agrupar por: :group',
+ 'groups' => [
+ 'status' => 'Estado',
+ 'tag' => 'Etiqueta',
+ 'channel' => 'Canal',
+ ],
+ 'columns' => [
+ 'draft' => 'Borrador',
+ 'approvals' => 'Aprobaciones',
+ 'scheduled' => 'Programado',
+ 'published' => 'Publicado',
+ 'failed' => 'Fallido',
+ 'untagged' => 'Sin etiqueta',
+ 'no_channel' => 'Sin canal',
+ ],
+ 'empty_column' => 'Nada por aquí',
+ 'no_columns' => [
+ 'title' => 'Nada coincide con estos filtros',
+ 'description' => 'Quita el filtro de etiqueta o de canal para ver todas las columnas.',
+ ],
+ 'column_aria' => '{1} :name, :count publicación|[0,*] :name, :count publicaciones',
+ ],
'view_switcher' => 'Vista de programación',
'all_posts' => 'Todos los posts',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Pendiente',
'draft' => 'Borrador',
- 'pending_approval' => 'Pendiente de aprobación',
+ 'pending_approval' => 'Pendiente',
'scheduled' => 'Programado',
'publishing' => 'Publicando',
'retrying' => 'Reintentando',
'published' => 'Publicado',
'failed' => 'Fallido',
+ 'pending_review' => 'En revisión por Google',
+ 'deleted_on_network' => 'Eliminado',
],
'descriptions' => [
@@ -1103,13 +1130,18 @@ return [
'channels' => 'Canales (:count)',
],
'approvals' => [
- 'badge' => 'Aprobación',
'time_passed' => 'La hora ya pasó',
'approve' => 'Aprobar',
'schedule' => 'Programar',
'reject' => 'Rechazar',
'revert' => 'Retirar solicitud de aprobación',
'requested' => 'Aprobación solicitada',
+ 'toasts' => [
+ 'scheduled' => 'Publicación aprobada y programada',
+ 'queued' => 'Publicación aprobada y añadida a la cola',
+ 'publishing' => 'Publicación aprobada, publicándose ahora',
+ 'rejected' => 'Publicación rechazada y movida a borradores',
+ ],
'errors' => [
'not_pending' => 'Esta publicación ya no está pendiente de aprobación.',
'time_passed' => 'La hora solicitada ya pasó. Elige una nueva hora.',
diff --git a/lang/es/sidebar.php b/lang/es/sidebar.php
index 02cabaeb5..e3702a141 100644
--- a/lang/es/sidebar.php
+++ b/lang/es/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Seleccionar workspace',
'create_workspace' => 'Crear workspace',
'new' => 'Nuevo',
+ 'unfinished_post' => 'Tienes una publicación sin terminar',
'create' => 'Crear',
'new_menu' => [
'post' => 'Publicación',
diff --git a/lang/es/signatures.php b/lang/es/signatures.php
index 345c12c0a..0beb5cba9 100644
--- a/lang/es/signatures.php
+++ b/lang/es/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Creado',
],
- 'row_actions' => 'Acciones de la firma',
'actions' => [
'edit' => 'Editar firma',
- 'delete' => 'Eliminar firma',
+ 'delete' => 'Eliminar',
+ 'settings' => 'Configuración',
],
'create' => [
diff --git a/lang/fr/channels.php b/lang/fr/channels.php
index 017e4563b..c34c04631 100644
--- a/lang/fr/channels.php
+++ b/lang/fr/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Gérez les canaux de cet espace.',
'connect' => 'Connecter un canal',
'settings' => 'Paramètres du canal',
+ 'manage' => 'Gérer les canaux',
+ 'set_goal' => 'Définir un objectif de publication',
'publish' => 'Publier',
'insights' => 'Insights',
'new_post' => 'Nouvelle publication dans ce canal',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Annuler',
],
+ 'list' => [
+ 'search' => 'Rechercher par nom, @identifiant ou réseau',
+ 'networks' => 'Réseaux',
+ 'networks_search' => 'Rechercher des réseaux',
+ 'no_networks' => 'Aucun réseau trouvé',
+ 'columns' => [
+ 'channel' => 'Canal',
+ 'timezone' => 'Fuseau horaire',
+ 'posting_times' => 'Horaires',
+ 'this_week' => 'Cette semaine',
+ ],
+ 'posting_times_per_week' => ':count par semaine',
+ 'no_posting_times' => 'Aucun horaire',
+ 'no_results' => 'Aucun canal ne correspond à votre recherche.',
+ 'connection_lost' => 'Ce canal a perdu sa connexion',
+ 'settings' => 'Paramètres',
+ 'more_actions' => 'Plus d\'actions',
+ ],
+
'settings_page' => [
'subtitle' => 'Paramètres du canal',
'back' => 'Retour aux canaux',
diff --git a/lang/fr/labels.php b/lang/fr/labels.php
index 253a79967..8afaf34a0 100644
--- a/lang/fr/labels.php
+++ b/lang/fr/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Modifier l\'étiquette',
'delete' => 'Supprimer l\'étiquette',
'more' => 'Plus d\'actions',
+ 'settings' => 'Paramètres',
'view_posts' => 'Voir les publications',
+ 'view_insights' => 'Voir les insights',
],
'create' => [
diff --git a/lang/fr/posts.php b/lang/fr/posts.php
index 13a5fb380..2ba935314 100644
--- a/lang/fr/posts.php
+++ b/lang/fr/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Liste',
+ 'board' => [
+ 'view' => 'Tableau',
+ 'group_by' => 'Grouper par',
+ 'group_by_value' => 'Grouper par : :group',
+ 'groups' => [
+ 'status' => 'Statut',
+ 'tag' => 'Étiquette',
+ 'channel' => 'Canal',
+ ],
+ 'columns' => [
+ 'draft' => 'Brouillon',
+ 'approvals' => 'Approbations',
+ 'scheduled' => 'Programmée',
+ 'published' => 'Publiée',
+ 'failed' => 'Échec',
+ 'untagged' => 'Sans étiquette',
+ 'no_channel' => 'Aucun canal',
+ ],
+ 'empty_column' => 'Rien ici',
+ 'no_columns' => [
+ 'title' => 'Rien ne correspond à ces filtres',
+ 'description' => 'Retirez le filtre d\'étiquette ou de canal pour voir toutes les colonnes.',
+ ],
+ 'column_aria' => '{1} :name, :count publication|[0,*] :name, :count publications',
+ ],
'view_switcher' => 'Vue du calendrier',
'all_posts' => 'Toutes les publications',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'En attente',
'draft' => 'Brouillon',
- 'pending_approval' => 'En attente d\'approbation',
+ 'pending_approval' => 'En attente',
'scheduled' => 'Programmée',
'publishing' => 'Publication en cours',
'retrying' => 'Nouvelle tentative',
'published' => 'Publiée',
'failed' => 'Échec',
+ 'pending_review' => 'En cours d\'examen par Google',
+ 'deleted_on_network' => 'Supprimée',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Canaux (:count)',
],
'approvals' => [
- 'badge' => 'Approbation',
'time_passed' => 'Heure dépassée',
'approve' => 'Approuver',
'schedule' => 'Programmer',
'reject' => 'Refuser',
'revert' => 'Annuler la demande d\'approbation',
'requested' => 'Approbation demandée',
+ 'toasts' => [
+ 'scheduled' => 'Publication approuvée et programmée',
+ 'queued' => 'Publication approuvée et ajoutée à la file',
+ 'publishing' => 'Publication approuvée, en cours de publication',
+ 'rejected' => 'Publication refusée et remise en brouillon',
+ ],
'errors' => [
'not_pending' => 'Cette publication n\'attend plus d\'approbation.',
'time_passed' => 'L\'heure demandée est passée. Choisissez une nouvelle heure.',
diff --git a/lang/fr/sidebar.php b/lang/fr/sidebar.php
index 9004c177a..065153bdc 100644
--- a/lang/fr/sidebar.php
+++ b/lang/fr/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Sélectionner un espace de travail',
'create_workspace' => 'Créer un espace',
'new' => 'Nouveau',
+ 'unfinished_post' => 'Vous avez une publication inachevée',
'create' => 'Créer',
'new_menu' => [
'post' => 'Publication',
diff --git a/lang/fr/signatures.php b/lang/fr/signatures.php
index 65200e111..29c7d08a3 100644
--- a/lang/fr/signatures.php
+++ b/lang/fr/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Créée le',
],
- 'row_actions' => 'Actions de la signature',
'actions' => [
'edit' => 'Modifier la signature',
- 'delete' => 'Supprimer la signature',
+ 'delete' => 'Supprimer',
+ 'settings' => 'Paramètres',
],
'create' => [
diff --git a/lang/it/channels.php b/lang/it/channels.php
index 9cdd4b65a..eb870a03f 100644
--- a/lang/it/channels.php
+++ b/lang/it/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Gestisci i canali di questo workspace.',
'connect' => 'Collega canale',
'settings' => 'Impostazioni del canale',
+ 'manage' => 'Gestisci canali',
+ 'set_goal' => 'Imposta un obiettivo di pubblicazione',
'publish' => 'Pubblica',
'insights' => 'Insights',
'new_post' => 'Nuovo post in questo canale',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Annulla',
],
+ 'list' => [
+ 'search' => 'Cerca per nome, @utente o social',
+ 'networks' => 'Reti',
+ 'networks_search' => 'Cerca reti',
+ 'no_networks' => 'Nessuna rete trovata',
+ 'columns' => [
+ 'channel' => 'Canale',
+ 'timezone' => 'Fuso orario',
+ 'posting_times' => 'Orari',
+ 'this_week' => 'Questa settimana',
+ ],
+ 'posting_times_per_week' => ':count a settimana',
+ 'no_posting_times' => 'Nessun orario',
+ 'no_results' => 'Nessun canale corrisponde alla ricerca.',
+ 'connection_lost' => 'Questo canale ha perso la connessione',
+ 'settings' => 'Impostazioni',
+ 'more_actions' => 'Altre azioni',
+ ],
+
'settings_page' => [
'subtitle' => 'Impostazioni del canale',
'back' => 'Torna ai canali',
diff --git a/lang/it/labels.php b/lang/it/labels.php
index b805724d5..88b8cc710 100644
--- a/lang/it/labels.php
+++ b/lang/it/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Modifica etichetta',
'delete' => 'Elimina etichetta',
'more' => 'Altre azioni',
+ 'settings' => 'Impostazioni',
'view_posts' => 'Visualizza post',
+ 'view_insights' => 'Visualizza insights',
],
'create' => [
diff --git a/lang/it/posts.php b/lang/it/posts.php
index bccbe772c..44ca538e6 100644
--- a/lang/it/posts.php
+++ b/lang/it/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Elenco',
+ 'board' => [
+ 'view' => 'Bacheca',
+ 'group_by' => 'Raggruppa per',
+ 'group_by_value' => 'Raggruppa per: :group',
+ 'groups' => [
+ 'status' => 'Stato',
+ 'tag' => 'Etichetta',
+ 'channel' => 'Canale',
+ ],
+ 'columns' => [
+ 'draft' => 'Bozza',
+ 'approvals' => 'Approvazioni',
+ 'scheduled' => 'Programmato',
+ 'published' => 'Pubblicato',
+ 'failed' => 'Non riuscito',
+ 'untagged' => 'Senza etichetta',
+ 'no_channel' => 'Nessun canale',
+ ],
+ 'empty_column' => 'Niente qui',
+ 'no_columns' => [
+ 'title' => 'Nessun risultato per questi filtri',
+ 'description' => 'Rimuovi il filtro per etichetta o canale per vedere tutte le colonne.',
+ ],
+ 'column_aria' => '{1} :name, :count post|[0,*] :name, :count post',
+ ],
'view_switcher' => 'Vista programmazione',
'all_posts' => 'Tutti i post',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'In attesa',
'draft' => 'Bozza',
- 'pending_approval' => 'In attesa di approvazione',
+ 'pending_approval' => 'In attesa',
'scheduled' => 'Programmato',
'publishing' => 'In pubblicazione',
'retrying' => 'Nuovo tentativo',
'published' => 'Pubblicato',
'failed' => 'Non riuscito',
+ 'pending_review' => 'In revisione da Google',
+ 'deleted_on_network' => 'Eliminato',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Canali (:count)',
],
'approvals' => [
- 'badge' => 'Approvazione',
'time_passed' => 'Orario superato',
'approve' => 'Approva',
'schedule' => 'Programma',
'reject' => 'Rifiuta',
'revert' => 'Ritira richiesta di approvazione',
'requested' => 'Approvazione richiesta',
+ 'toasts' => [
+ 'scheduled' => 'Post approvato e programmato',
+ 'queued' => 'Post approvato e aggiunto alla coda',
+ 'publishing' => 'Post approvato, pubblicazione in corso',
+ 'rejected' => 'Post rifiutato e spostato nelle bozze',
+ ],
'errors' => [
'not_pending' => 'Questo post non è più in attesa di approvazione.',
'time_passed' => 'L\'orario richiesto è passato. Scegli un nuovo orario.',
diff --git a/lang/it/sidebar.php b/lang/it/sidebar.php
index 07393313e..97e5afcba 100644
--- a/lang/it/sidebar.php
+++ b/lang/it/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Seleziona workspace',
'create_workspace' => 'Crea workspace',
'new' => 'Nuovo',
+ 'unfinished_post' => 'Hai un post che non hai finito',
'create' => 'Crea',
'new_menu' => [
'post' => 'Post',
diff --git a/lang/it/signatures.php b/lang/it/signatures.php
index d94d58c46..099bac29a 100644
--- a/lang/it/signatures.php
+++ b/lang/it/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Creata',
],
- 'row_actions' => 'Azioni della firma',
'actions' => [
'edit' => 'Modifica firma',
- 'delete' => 'Elimina firma',
+ 'delete' => 'Elimina',
+ 'settings' => 'Impostazioni',
],
'create' => [
diff --git a/lang/ja/channels.php b/lang/ja/channels.php
index e0d6198c3..ecd618d43 100644
--- a/lang/ja/channels.php
+++ b/lang/ja/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'このワークスペースのチャンネルを管理します。',
'connect' => 'チャンネルを接続',
'settings' => 'チャンネル設定',
+ 'manage' => 'チャンネルを管理',
+ 'set_goal' => '投稿目標を設定',
'publish' => '投稿する',
'insights' => 'Insights',
'new_post' => 'このチャンネルで新規投稿',
@@ -170,6 +172,25 @@ return [
'cancel' => 'キャンセル',
],
+ 'list' => [
+ 'search' => '名前、@ユーザー名、ネットワークで検索',
+ 'networks' => 'ネットワーク',
+ 'networks_search' => 'ネットワークを検索',
+ 'no_networks' => 'ネットワークが見つかりません',
+ 'columns' => [
+ 'channel' => 'チャンネル',
+ 'timezone' => 'タイムゾーン',
+ 'posting_times' => '投稿時間',
+ 'this_week' => '今週',
+ ],
+ 'posting_times_per_week' => '週:count回',
+ 'no_posting_times' => '投稿時間なし',
+ 'no_results' => '検索に一致するチャンネルはありません。',
+ 'connection_lost' => 'このチャンネルの接続が切れました',
+ 'settings' => '設定',
+ 'more_actions' => 'その他の操作',
+ ],
+
'settings_page' => [
'subtitle' => 'チャンネル設定',
'back' => 'チャンネルに戻る',
diff --git a/lang/ja/labels.php b/lang/ja/labels.php
index 4c9a9e218..3e760c1d8 100644
--- a/lang/ja/labels.php
+++ b/lang/ja/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'ラベルを編集',
'delete' => 'ラベルを削除',
'more' => 'その他の操作',
+ 'settings' => '設定',
'view_posts' => '投稿を表示',
+ 'view_insights' => 'Insightsを表示',
],
'create' => [
diff --git a/lang/ja/posts.php b/lang/ja/posts.php
index 16839da5c..cdae02fcd 100644
--- a/lang/ja/posts.php
+++ b/lang/ja/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'リスト',
+ 'board' => [
+ 'view' => 'ボード',
+ 'group_by' => 'グループ化',
+ 'group_by_value' => 'グループ化::group',
+ 'groups' => [
+ 'status' => 'ステータス',
+ 'tag' => 'ラベル',
+ 'channel' => 'チャンネル',
+ ],
+ 'columns' => [
+ 'draft' => '下書き',
+ 'approvals' => '承認',
+ 'scheduled' => '予約済み',
+ 'published' => '公開済み',
+ 'failed' => '失敗',
+ 'untagged' => 'ラベルなし',
+ 'no_channel' => 'チャンネルなし',
+ ],
+ 'empty_column' => '何もありません',
+ 'no_columns' => [
+ 'title' => 'このフィルターに一致するものはありません',
+ 'description' => 'すべての列を表示するには、ラベルまたはチャンネルのフィルターを解除してください。',
+ ],
+ 'column_aria' => '{1} :name、:count件の投稿|[0,*] :name、:count件の投稿',
+ ],
'view_switcher' => 'スケジュール表示',
'all_posts' => 'すべての投稿',
'composer' => [
@@ -622,6 +647,8 @@ return [
'retrying' => '再試行中',
'published' => '公開済み',
'failed' => '失敗',
+ 'pending_review' => 'Google が審査中',
+ 'deleted_on_network' => '削除済み',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'チャンネル (:count)',
],
'approvals' => [
- 'badge' => '承認',
'time_passed' => '時刻を過ぎています',
'approve' => '承認する',
'schedule' => '予約',
'reject' => '却下',
'revert' => '承認リクエストを取り消す',
'requested' => '承認をリクエストしました',
+ 'toasts' => [
+ 'scheduled' => '投稿を承認して予約しました',
+ 'queued' => '投稿を承認してキューに追加しました',
+ 'publishing' => '投稿を承認しました。公開しています',
+ 'rejected' => '投稿を却下して下書きに戻しました',
+ ],
'errors' => [
'not_pending' => 'この投稿はすでに承認待ちではありません。',
'time_passed' => '希望時刻を過ぎています。新しい時刻を選択してください。',
diff --git a/lang/ja/sidebar.php b/lang/ja/sidebar.php
index a9231e6e8..f69f5a1eb 100644
--- a/lang/ja/sidebar.php
+++ b/lang/ja/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'ワークスペースを選択',
'create_workspace' => 'ワークスペースを作成',
'new' => '新規',
+ 'unfinished_post' => '完成していない投稿があります',
'create' => '作成',
'new_menu' => [
'post' => '投稿',
diff --git a/lang/ja/signatures.php b/lang/ja/signatures.php
index eb5692084..4a7e932dc 100644
--- a/lang/ja/signatures.php
+++ b/lang/ja/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => '作成日',
],
- 'row_actions' => '署名の操作',
'actions' => [
'edit' => '署名を編集',
- 'delete' => '署名を削除',
+ 'delete' => '削除',
+ 'settings' => '設定',
],
'create' => [
diff --git a/lang/ko/channels.php b/lang/ko/channels.php
index b69ac8738..53e79a241 100644
--- a/lang/ko/channels.php
+++ b/lang/ko/channels.php
@@ -7,6 +7,8 @@ return [
'description' => '이 워크스페이스의 채널을 관리하세요.',
'connect' => '채널 연결',
'settings' => '채널 설정',
+ 'manage' => '채널 관리',
+ 'set_goal' => '게시 목표 설정',
'publish' => '게시',
'insights' => 'Insights',
'new_post' => '이 채널에 새 게시물 작성',
@@ -170,6 +172,25 @@ return [
'cancel' => '취소',
],
+ 'list' => [
+ 'search' => '이름, @사용자 이름 또는 네트워크로 검색',
+ 'networks' => '네트워크',
+ 'networks_search' => '네트워크 검색',
+ 'no_networks' => '네트워크를 찾을 수 없습니다',
+ 'columns' => [
+ 'channel' => '채널',
+ 'timezone' => '시간대',
+ 'posting_times' => '게시 시간',
+ 'this_week' => '이번 주',
+ ],
+ 'posting_times_per_week' => '주 :count회',
+ 'no_posting_times' => '게시 시간 없음',
+ 'no_results' => '검색과 일치하는 채널이 없습니다.',
+ 'connection_lost' => '이 채널의 연결이 끊어졌습니다',
+ 'settings' => '설정',
+ 'more_actions' => '추가 작업',
+ ],
+
'settings_page' => [
'subtitle' => '채널 설정',
'back' => '채널로 돌아가기',
diff --git a/lang/ko/labels.php b/lang/ko/labels.php
index b91af04a2..d53c06547 100644
--- a/lang/ko/labels.php
+++ b/lang/ko/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => '라벨 편집',
'delete' => '라벨 삭제',
'more' => '추가 작업',
+ 'settings' => '설정',
'view_posts' => '게시물 보기',
+ 'view_insights' => 'Insights 보기',
],
'create' => [
diff --git a/lang/ko/posts.php b/lang/ko/posts.php
index cdf398e94..b59a3c9ff 100644
--- a/lang/ko/posts.php
+++ b/lang/ko/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => '목록',
+ 'board' => [
+ 'view' => '보드',
+ 'group_by' => '그룹 기준',
+ 'group_by_value' => '그룹 기준: :group',
+ 'groups' => [
+ 'status' => '상태',
+ 'tag' => '라벨',
+ 'channel' => '채널',
+ ],
+ 'columns' => [
+ 'draft' => '초안',
+ 'approvals' => '승인',
+ 'scheduled' => '예약됨',
+ 'published' => '게시됨',
+ 'failed' => '실패',
+ 'untagged' => '라벨 없음',
+ 'no_channel' => '채널 없음',
+ ],
+ 'empty_column' => '내용 없음',
+ 'no_columns' => [
+ 'title' => '이 필터와 일치하는 항목이 없습니다',
+ 'description' => '모든 열을 보려면 라벨 또는 채널 필터를 지우세요.',
+ ],
+ 'column_aria' => '{1} :name, 게시물 :count개|[0,*] :name, 게시물 :count개',
+ ],
'view_switcher' => '일정 보기',
'all_posts' => '모든 게시물',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => '대기 중',
'draft' => '초안',
- 'pending_approval' => '승인 대기 중',
+ 'pending_approval' => '승인 대기',
'scheduled' => '예약됨',
'publishing' => '게시 중',
'retrying' => '재시도 중',
'published' => '게시됨',
'failed' => '실패',
+ 'pending_review' => 'Google 검토 중',
+ 'deleted_on_network' => '삭제됨',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => '채널 (:count)',
],
'approvals' => [
- 'badge' => '승인',
'time_passed' => '시간이 지났습니다',
'approve' => '승인하기',
'schedule' => '예약',
'reject' => '거절',
'revert' => '승인 요청 취소',
'requested' => '승인을 요청했습니다',
+ 'toasts' => [
+ 'scheduled' => '게시물을 승인하고 예약했습니다',
+ 'queued' => '게시물을 승인하고 대기열에 추가했습니다',
+ 'publishing' => '게시물을 승인했습니다. 지금 게시 중입니다',
+ 'rejected' => '게시물을 거부하고 임시 저장으로 옮겼습니다',
+ ],
'errors' => [
'not_pending' => '이 게시물은 더 이상 승인 대기 중이 아닙니다.',
'time_passed' => '요청한 시간이 지났습니다. 새 시간을 선택하세요.',
diff --git a/lang/ko/sidebar.php b/lang/ko/sidebar.php
index e26b0b1c1..4ffa23214 100644
--- a/lang/ko/sidebar.php
+++ b/lang/ko/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => '워크스페이스 선택',
'create_workspace' => '워크스페이스 만들기',
'new' => '새로 만들기',
+ 'unfinished_post' => '완료하지 않은 게시물이 있습니다',
'create' => '만들기',
'new_menu' => [
'post' => '게시물',
diff --git a/lang/ko/signatures.php b/lang/ko/signatures.php
index 532ee4417..c6b8e3748 100644
--- a/lang/ko/signatures.php
+++ b/lang/ko/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => '생성일',
],
- 'row_actions' => '서명 작업',
'actions' => [
'edit' => '서명 편집',
- 'delete' => '서명 삭제',
+ 'delete' => '삭제',
+ 'settings' => '설정',
],
'create' => [
diff --git a/lang/nl/channels.php b/lang/nl/channels.php
index 97bcdbebe..68fc9cd03 100644
--- a/lang/nl/channels.php
+++ b/lang/nl/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Beheer de kanalen van deze workspace.',
'connect' => 'Kanaal koppelen',
'settings' => 'Kanaalinstellingen',
+ 'manage' => 'Kanalen beheren',
+ 'set_goal' => 'Publicatiedoel instellen',
'publish' => 'Publiceren',
'insights' => 'Insights',
'new_post' => 'Nieuw bericht in dit kanaal',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Annuleren',
],
+ 'list' => [
+ 'search' => 'Zoeken op naam, @gebruikersnaam of netwerk',
+ 'networks' => 'Netwerken',
+ 'networks_search' => 'Netwerken zoeken',
+ 'no_networks' => 'Geen netwerken gevonden',
+ 'columns' => [
+ 'channel' => 'Kanaal',
+ 'timezone' => 'Tijdzone',
+ 'posting_times' => 'Tijden',
+ 'this_week' => 'Deze week',
+ ],
+ 'posting_times_per_week' => ':count per week',
+ 'no_posting_times' => 'Geen tijden',
+ 'no_results' => 'Geen kanalen gevonden voor je zoekopdracht.',
+ 'connection_lost' => 'Dit kanaal heeft de verbinding verloren',
+ 'settings' => 'Instellingen',
+ 'more_actions' => 'Meer acties',
+ ],
+
'settings_page' => [
'subtitle' => 'Kanaalinstellingen',
'back' => 'Terug naar kanalen',
diff --git a/lang/nl/labels.php b/lang/nl/labels.php
index 8771cbefd..91f266472 100644
--- a/lang/nl/labels.php
+++ b/lang/nl/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Label bewerken',
'delete' => 'Label verwijderen',
'more' => 'Meer acties',
+ 'settings' => 'Instellingen',
'view_posts' => 'Berichten bekijken',
+ 'view_insights' => 'Insights bekijken',
],
'create' => [
diff --git a/lang/nl/posts.php b/lang/nl/posts.php
index c50326ce3..af457e94f 100644
--- a/lang/nl/posts.php
+++ b/lang/nl/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Lijst',
+ 'board' => [
+ 'view' => 'Bord',
+ 'group_by' => 'Groeperen op',
+ 'group_by_value' => 'Groeperen op: :group',
+ 'groups' => [
+ 'status' => 'Status',
+ 'tag' => 'Label',
+ 'channel' => 'Kanaal',
+ ],
+ 'columns' => [
+ 'draft' => 'Concept',
+ 'approvals' => 'Goedkeuringen',
+ 'scheduled' => 'Gepland',
+ 'published' => 'Gepubliceerd',
+ 'failed' => 'Mislukt',
+ 'untagged' => 'Zonder label',
+ 'no_channel' => 'Geen kanaal',
+ ],
+ 'empty_column' => 'Niets hier',
+ 'no_columns' => [
+ 'title' => 'Niets komt overeen met deze filters',
+ 'description' => 'Wis het label- of kanaalfilter om alle kolommen te zien.',
+ ],
+ 'column_aria' => '{1} :name, :count post|[0,*] :name, :count posts',
+ ],
'view_switcher' => 'Planningweergave',
'all_posts' => 'Alle posts',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'In afwachting',
'draft' => 'Concept',
- 'pending_approval' => 'Wacht op goedkeuring',
+ 'pending_approval' => 'In afwachting',
'scheduled' => 'Gepland',
'publishing' => 'Publiceren',
'retrying' => 'Opnieuw proberen',
'published' => 'Gepubliceerd',
'failed' => 'Mislukt',
+ 'pending_review' => 'In beoordeling bij Google',
+ 'deleted_on_network' => 'Verwijderd',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Kanalen (:count)',
],
'approvals' => [
- 'badge' => 'Goedkeuring',
'time_passed' => 'Tijdstip verstreken',
'approve' => 'Goedkeuren',
'schedule' => 'Inplannen',
'reject' => 'Afwijzen',
'revert' => 'Goedkeuringsverzoek intrekken',
'requested' => 'Goedkeuring aangevraagd',
+ 'toasts' => [
+ 'scheduled' => 'Post goedgekeurd en ingepland',
+ 'queued' => 'Post goedgekeurd en aan de wachtrij toegevoegd',
+ 'publishing' => 'Post goedgekeurd, wordt nu gepubliceerd',
+ 'rejected' => 'Post afgewezen en naar concepten verplaatst',
+ ],
'errors' => [
'not_pending' => 'Dit bericht wacht niet meer op goedkeuring.',
'time_passed' => 'Het gevraagde tijdstip is voorbij. Kies een nieuw tijdstip.',
diff --git a/lang/nl/sidebar.php b/lang/nl/sidebar.php
index 692a9b309..54c5f63e2 100644
--- a/lang/nl/sidebar.php
+++ b/lang/nl/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Workspace selecteren',
'create_workspace' => 'Workspace aanmaken',
'new' => 'Nieuw',
+ 'unfinished_post' => 'Je hebt een bericht dat je nog niet hebt afgemaakt',
'create' => 'Maken',
'new_menu' => [
'post' => 'Bericht',
diff --git a/lang/nl/signatures.php b/lang/nl/signatures.php
index 11c95b0d3..b8ee9f74c 100644
--- a/lang/nl/signatures.php
+++ b/lang/nl/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Aangemaakt',
],
- 'row_actions' => 'Acties voor handtekening',
'actions' => [
'edit' => 'Handtekening bewerken',
- 'delete' => 'Handtekening verwijderen',
+ 'delete' => 'Verwijderen',
+ 'settings' => 'Instellingen',
],
'create' => [
diff --git a/lang/pl/channels.php b/lang/pl/channels.php
index 684a3cceb..a0ac164b8 100644
--- a/lang/pl/channels.php
+++ b/lang/pl/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Zarządzaj kanałami tego workspace\'u.',
'connect' => 'Połącz kanał',
'settings' => 'Ustawienia kanału',
+ 'manage' => 'Zarządzaj kanałami',
+ 'set_goal' => 'Ustaw cel publikacji',
'publish' => 'Publikuj',
'insights' => 'Insights',
'new_post' => 'Nowy post w tym kanale',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Anuluj',
],
+ 'list' => [
+ 'search' => 'Szukaj po nazwie, @nazwie użytkownika lub sieci',
+ 'networks' => 'Sieci',
+ 'networks_search' => 'Szukaj sieci',
+ 'no_networks' => 'Nie znaleziono sieci',
+ 'columns' => [
+ 'channel' => 'Kanał',
+ 'timezone' => 'Strefa czasowa',
+ 'posting_times' => 'Godziny',
+ 'this_week' => 'Ten tydzień',
+ ],
+ 'posting_times_per_week' => ':count na tydzień',
+ 'no_posting_times' => 'Brak godzin',
+ 'no_results' => 'Żaden kanał nie pasuje do wyszukiwania.',
+ 'connection_lost' => 'Ten kanał utracił połączenie',
+ 'settings' => 'Ustawienia',
+ 'more_actions' => 'Więcej działań',
+ ],
+
'settings_page' => [
'subtitle' => 'Ustawienia kanału',
'back' => 'Wróć do kanałów',
diff --git a/lang/pl/labels.php b/lang/pl/labels.php
index 7bf57b909..aaa3eef3d 100644
--- a/lang/pl/labels.php
+++ b/lang/pl/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Edytuj etykietę',
'delete' => 'Usuń etykietę',
'more' => 'Więcej działań',
+ 'settings' => 'Ustawienia',
'view_posts' => 'Zobacz posty',
+ 'view_insights' => 'Zobacz insights',
],
'create' => [
diff --git a/lang/pl/posts.php b/lang/pl/posts.php
index 2cd6e7601..239e66f13 100644
--- a/lang/pl/posts.php
+++ b/lang/pl/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Lista',
+ 'board' => [
+ 'view' => 'Tablica',
+ 'group_by' => 'Grupuj według',
+ 'group_by_value' => 'Grupuj według: :group',
+ 'groups' => [
+ 'status' => 'Status',
+ 'tag' => 'Etykieta',
+ 'channel' => 'Kanał',
+ ],
+ 'columns' => [
+ 'draft' => 'Szkic',
+ 'approvals' => 'Zatwierdzenia',
+ 'scheduled' => 'Zaplanowany',
+ 'published' => 'Opublikowany',
+ 'failed' => 'Nieudany',
+ 'untagged' => 'Bez etykiety',
+ 'no_channel' => 'Brak kanału',
+ ],
+ 'empty_column' => 'Nic tu nie ma',
+ 'no_columns' => [
+ 'title' => 'Nic nie pasuje do tych filtrów',
+ 'description' => 'Wyczyść filtr etykiet lub kanałów, aby zobaczyć wszystkie kolumny.',
+ ],
+ 'column_aria' => '{1} :name, liczba postów: :count|[0,*] :name, liczba postów: :count',
+ ],
'view_switcher' => 'Widok harmonogramu',
'all_posts' => 'Wszystkie posty',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Oczekuje',
'draft' => 'Szkic',
- 'pending_approval' => 'Oczekuje na zatwierdzenie',
+ 'pending_approval' => 'Oczekuje',
'scheduled' => 'Zaplanowany',
'publishing' => 'Publikowanie',
'retrying' => 'Ponawianie',
'published' => 'Opublikowany',
'failed' => 'Nieudany',
+ 'pending_review' => 'W weryfikacji przez Google',
+ 'deleted_on_network' => 'Usunięto',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Kanały (:count)',
],
'approvals' => [
- 'badge' => 'Zatwierdzenie',
'time_passed' => 'Czas minął',
'approve' => 'Zatwierdź',
'schedule' => 'Zaplanuj',
'reject' => 'Odrzuć',
'revert' => 'Wycofaj prośbę o zatwierdzenie',
'requested' => 'Wysłano prośbę o zatwierdzenie',
+ 'toasts' => [
+ 'scheduled' => 'Post zatwierdzony i zaplanowany',
+ 'queued' => 'Post zatwierdzony i dodany do kolejki',
+ 'publishing' => 'Post zatwierdzony, trwa publikacja',
+ 'rejected' => 'Post odrzucony i przeniesiony do szkiców',
+ ],
'errors' => [
'not_pending' => 'Ten post nie czeka już na zatwierdzenie.',
'time_passed' => 'Wybrany czas minął. Wybierz nowy czas.',
diff --git a/lang/pl/sidebar.php b/lang/pl/sidebar.php
index d887cdfb4..eb3b9607a 100644
--- a/lang/pl/sidebar.php
+++ b/lang/pl/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Wybierz przestrzeń roboczą',
'create_workspace' => 'Nowa przestrzeń',
'new' => 'Nowy',
+ 'unfinished_post' => 'Masz niedokończony post',
'create' => 'Twórz',
'new_menu' => [
'post' => 'Post',
diff --git a/lang/pl/signatures.php b/lang/pl/signatures.php
index 9adc86b21..69c3413c0 100644
--- a/lang/pl/signatures.php
+++ b/lang/pl/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Utworzono',
],
- 'row_actions' => 'Akcje podpisu',
'actions' => [
'edit' => 'Edytuj sygnaturę',
- 'delete' => 'Usuń sygnaturę',
+ 'delete' => 'Usuń',
+ 'settings' => 'Ustawienia',
],
'create' => [
diff --git a/lang/pt-BR/channels.php b/lang/pt-BR/channels.php
index c626785ce..edfec9383 100644
--- a/lang/pt-BR/channels.php
+++ b/lang/pt-BR/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Gerencie os canais deste workspace.',
'connect' => 'Conectar canal',
'settings' => 'Configurações do canal',
+ 'manage' => 'Gerenciar canais',
+ 'set_goal' => 'Definir meta de postagem',
'publish' => 'Publicar',
'insights' => 'Insights',
'new_post' => 'Novo post neste canal',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Cancelar',
],
+ 'list' => [
+ 'search' => 'Buscar por nome, @usuário ou rede',
+ 'networks' => 'Redes',
+ 'networks_search' => 'Buscar redes',
+ 'no_networks' => 'Nenhuma rede encontrada',
+ 'columns' => [
+ 'channel' => 'Canal',
+ 'timezone' => 'Fuso horário',
+ 'posting_times' => 'Horários',
+ 'this_week' => 'Esta semana',
+ ],
+ 'posting_times_per_week' => ':count por semana',
+ 'no_posting_times' => 'Sem horários',
+ 'no_results' => 'Nenhum canal corresponde à sua busca.',
+ 'connection_lost' => 'Este canal perdeu a conexão',
+ 'settings' => 'Configurações',
+ 'more_actions' => 'Mais ações',
+ ],
+
'settings_page' => [
'subtitle' => 'Configurações do canal',
'back' => 'Voltar para os canais',
diff --git a/lang/pt-BR/labels.php b/lang/pt-BR/labels.php
index 2ea306beb..2c33b5563 100644
--- a/lang/pt-BR/labels.php
+++ b/lang/pt-BR/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Editar etiqueta',
'delete' => 'Excluir etiqueta',
'more' => 'Mais ações',
+ 'settings' => 'Configurações',
'view_posts' => 'Ver posts',
+ 'view_insights' => 'Ver insights',
],
'create' => [
diff --git a/lang/pt-BR/posts.php b/lang/pt-BR/posts.php
index cf31415b5..e45c5f7bb 100644
--- a/lang/pt-BR/posts.php
+++ b/lang/pt-BR/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Lista',
+ 'board' => [
+ 'view' => 'Quadro',
+ 'group_by' => 'Agrupar por',
+ 'group_by_value' => 'Agrupar por: :group',
+ 'groups' => [
+ 'status' => 'Status',
+ 'tag' => 'Etiqueta',
+ 'channel' => 'Canal',
+ ],
+ 'columns' => [
+ 'draft' => 'Rascunho',
+ 'approvals' => 'Aprovações',
+ 'scheduled' => 'Agendado',
+ 'published' => 'Publicado',
+ 'failed' => 'Falhou',
+ 'untagged' => 'Sem etiqueta',
+ 'no_channel' => 'Sem canal',
+ ],
+ 'empty_column' => 'Nada por aqui',
+ 'no_columns' => [
+ 'title' => 'Nada corresponde a esses filtros',
+ 'description' => 'Limpe o filtro de etiqueta ou de canal para ver todas as colunas.',
+ ],
+ 'column_aria' => '{1} :name, :count post|[0,*] :name, :count posts',
+ ],
'view_switcher' => 'Visualização do agendamento',
'all_posts' => 'Todos os Posts',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Pendente',
'draft' => 'Rascunho',
- 'pending_approval' => 'Aguardando aprovação',
+ 'pending_approval' => 'Pendente',
'scheduled' => 'Agendado',
'publishing' => 'Publicando',
'retrying' => 'Tentando novamente',
'published' => 'Publicado',
'failed' => 'Falhou',
+ 'pending_review' => 'Em revisão pelo Google',
+ 'deleted_on_network' => 'Excluído',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Canais (:count)',
],
'approvals' => [
- 'badge' => 'Aprovação',
'time_passed' => 'O horário já passou',
'approve' => 'Aprovar',
'schedule' => 'Agendar',
'reject' => 'Rejeitar',
'revert' => 'Desfazer pedido de aprovação',
'requested' => 'Aprovação solicitada',
+ 'toasts' => [
+ 'scheduled' => 'Post aprovado e agendado',
+ 'queued' => 'Post aprovado e adicionado à fila',
+ 'publishing' => 'Post aprovado e publicando agora',
+ 'rejected' => 'Post rejeitado e movido para rascunhos',
+ ],
'errors' => [
'not_pending' => 'Este post não está mais aguardando aprovação.',
'time_passed' => 'O horário pedido já passou. Escolha um novo horário.',
diff --git a/lang/pt-BR/sidebar.php b/lang/pt-BR/sidebar.php
index dc4143d69..d17a72453 100644
--- a/lang/pt-BR/sidebar.php
+++ b/lang/pt-BR/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Selecionar workspace',
'create_workspace' => 'Criar workspace',
'new' => 'Novo',
+ 'unfinished_post' => 'Você tem um post que não terminou',
'create' => 'Criar',
'new_menu' => [
'post' => 'Post',
diff --git a/lang/pt-BR/signatures.php b/lang/pt-BR/signatures.php
index 9fb34c560..d4dcbed7e 100644
--- a/lang/pt-BR/signatures.php
+++ b/lang/pt-BR/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Criado em',
],
- 'row_actions' => 'Ações da assinatura',
'actions' => [
'edit' => 'Editar assinatura',
- 'delete' => 'Excluir assinatura',
+ 'delete' => 'Excluir',
+ 'settings' => 'Configurações',
],
'create' => [
diff --git a/lang/ru/channels.php b/lang/ru/channels.php
index 6a0496a7d..fcacc8cc4 100644
--- a/lang/ru/channels.php
+++ b/lang/ru/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Управляйте каналами этого пространства.',
'connect' => 'Подключить канал',
'settings' => 'Настройки канала',
+ 'manage' => 'Управление каналами',
+ 'set_goal' => 'Задать цель публикаций',
'publish' => 'Опубликовать',
'insights' => 'Insights',
'new_post' => 'Новая публикация в этом канале',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Отмена',
],
+ 'list' => [
+ 'search' => 'Поиск по имени, @имени пользователя или сети',
+ 'networks' => 'Сети',
+ 'networks_search' => 'Поиск сетей',
+ 'no_networks' => 'Сети не найдены',
+ 'columns' => [
+ 'channel' => 'Канал',
+ 'timezone' => 'Часовой пояс',
+ 'posting_times' => 'Время',
+ 'this_week' => 'Эта неделя',
+ ],
+ 'posting_times_per_week' => ':count в неделю',
+ 'no_posting_times' => 'Нет времени',
+ 'no_results' => 'Нет каналов по вашему запросу.',
+ 'connection_lost' => 'Канал потерял подключение',
+ 'settings' => 'Настройки',
+ 'more_actions' => 'Другие действия',
+ ],
+
'settings_page' => [
'subtitle' => 'Настройки канала',
'back' => 'Назад к каналам',
diff --git a/lang/ru/labels.php b/lang/ru/labels.php
index 3f4bfc7e7..9ad40c143 100644
--- a/lang/ru/labels.php
+++ b/lang/ru/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Изменить метку',
'delete' => 'Удалить метку',
'more' => 'Другие действия',
+ 'settings' => 'Настройки',
'view_posts' => 'Посмотреть посты',
+ 'view_insights' => 'Посмотреть Insights',
],
'create' => [
diff --git a/lang/ru/posts.php b/lang/ru/posts.php
index 89ac3bff9..16efb1631 100644
--- a/lang/ru/posts.php
+++ b/lang/ru/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Список',
+ 'board' => [
+ 'view' => 'Доска',
+ 'group_by' => 'Группировать по',
+ 'group_by_value' => 'Группировать по: :group',
+ 'groups' => [
+ 'status' => 'Статус',
+ 'tag' => 'Метка',
+ 'channel' => 'Канал',
+ ],
+ 'columns' => [
+ 'draft' => 'Черновик',
+ 'approvals' => 'Одобрение',
+ 'scheduled' => 'Запланирован',
+ 'published' => 'Опубликован',
+ 'failed' => 'Ошибка',
+ 'untagged' => 'Без метки',
+ 'no_channel' => 'Нет канала',
+ ],
+ 'empty_column' => 'Здесь пусто',
+ 'no_columns' => [
+ 'title' => 'Ничего не соответствует этим фильтрам',
+ 'description' => 'Сбросьте фильтр по меткам или каналам, чтобы увидеть все колонки.',
+ ],
+ 'column_aria' => '{1} :name, постов: :count|[0,*] :name, постов: :count',
+ ],
'view_switcher' => 'Вид расписания',
'all_posts' => 'Все посты',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'В ожидании',
'draft' => 'Черновик',
- 'pending_approval' => 'Ожидает одобрения',
+ 'pending_approval' => 'Ожидает',
'scheduled' => 'Запланирован',
'publishing' => 'Публикуется',
'retrying' => 'Повторная попытка',
'published' => 'Опубликован',
'failed' => 'Ошибка',
+ 'pending_review' => 'На проверке в Google',
+ 'deleted_on_network' => 'Удалён',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Каналы (:count)',
],
'approvals' => [
- 'badge' => 'Одобрение',
'time_passed' => 'Время прошло',
'approve' => 'Одобрить',
'schedule' => 'Запланировать',
'reject' => 'Отклонить',
'revert' => 'Отозвать запрос на одобрение',
'requested' => 'Запрос на одобрение отправлен',
+ 'toasts' => [
+ 'scheduled' => 'Пост одобрен и запланирован',
+ 'queued' => 'Пост одобрен и добавлен в очередь',
+ 'publishing' => 'Пост одобрен и публикуется',
+ 'rejected' => 'Пост отклонён и перемещён в черновики',
+ ],
'errors' => [
'not_pending' => 'Эта публикация больше не ожидает одобрения.',
'time_passed' => 'Запрошенное время прошло. Выберите новое время.',
diff --git a/lang/ru/sidebar.php b/lang/ru/sidebar.php
index 7a6a620d5..22e8ac774 100644
--- a/lang/ru/sidebar.php
+++ b/lang/ru/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Выберите рабочее пространство',
'create_workspace' => 'Новое пространство',
'new' => 'Создать',
+ 'unfinished_post' => 'У вас есть незавершённый пост',
'create' => 'Создание',
'new_menu' => [
'post' => 'Пост',
diff --git a/lang/ru/signatures.php b/lang/ru/signatures.php
index 05356dcca..b1e2dbc24 100644
--- a/lang/ru/signatures.php
+++ b/lang/ru/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Создана',
],
- 'row_actions' => 'Действия с подписью',
'actions' => [
'edit' => 'Изменить подпись',
- 'delete' => 'Удалить подпись',
+ 'delete' => 'Удалить',
+ 'settings' => 'Настройки',
],
'create' => [
diff --git a/lang/tr/channels.php b/lang/tr/channels.php
index 5e2f95e2e..91b97b194 100644
--- a/lang/tr/channels.php
+++ b/lang/tr/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Bu çalışma alanının kanallarını yönetin.',
'connect' => 'Kanal bağla',
'settings' => 'Kanal ayarları',
+ 'manage' => 'Kanalları yönet',
+ 'set_goal' => 'Paylaşım hedefi belirle',
'publish' => 'Yayınla',
'insights' => 'Insights',
'new_post' => 'Bu kanalda yeni gönderi',
@@ -170,6 +172,25 @@ return [
'cancel' => 'İptal',
],
+ 'list' => [
+ 'search' => 'Ada, @kullanıcı adına veya ağa göre ara',
+ 'networks' => 'Ağlar',
+ 'networks_search' => 'Ağ ara',
+ 'no_networks' => 'Ağ bulunamadı',
+ 'columns' => [
+ 'channel' => 'Kanal',
+ 'timezone' => 'Saat dilimi',
+ 'posting_times' => 'Saatler',
+ 'this_week' => 'Bu hafta',
+ ],
+ 'posting_times_per_week' => 'Haftada :count',
+ 'no_posting_times' => 'Saat yok',
+ 'no_results' => 'Aramanızla eşleşen kanal yok.',
+ 'connection_lost' => 'Bu kanalın bağlantısı koptu',
+ 'settings' => 'Ayarlar',
+ 'more_actions' => 'Diğer işlemler',
+ ],
+
'settings_page' => [
'subtitle' => 'Kanal ayarları',
'back' => 'Kanallara dön',
diff --git a/lang/tr/labels.php b/lang/tr/labels.php
index 1ffe97e2b..dec9fa974 100644
--- a/lang/tr/labels.php
+++ b/lang/tr/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Etiketi düzenle',
'delete' => 'Etiketi sil',
'more' => 'Diğer işlemler',
+ 'settings' => 'Ayarlar',
'view_posts' => 'Gönderileri görüntüle',
+ 'view_insights' => 'Insights\'ı görüntüle',
],
'create' => [
diff --git a/lang/tr/posts.php b/lang/tr/posts.php
index 358c4e732..687223129 100644
--- a/lang/tr/posts.php
+++ b/lang/tr/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Liste',
+ 'board' => [
+ 'view' => 'Pano',
+ 'group_by' => 'Gruplandır',
+ 'group_by_value' => 'Gruplandır: :group',
+ 'groups' => [
+ 'status' => 'Durum',
+ 'tag' => 'Etiket',
+ 'channel' => 'Kanal',
+ ],
+ 'columns' => [
+ 'draft' => 'Taslak',
+ 'approvals' => 'Onaylar',
+ 'scheduled' => 'Planlandı',
+ 'published' => 'Yayınlandı',
+ 'failed' => 'Başarısız',
+ 'untagged' => 'Etiketsiz',
+ 'no_channel' => 'Kanal yok',
+ ],
+ 'empty_column' => 'Burada hiçbir şey yok',
+ 'no_columns' => [
+ 'title' => 'Bu filtrelerle eşleşen bir şey yok',
+ 'description' => 'Tüm sütunları görmek için etiket veya kanal filtresini temizle.',
+ ],
+ 'column_aria' => '{1} :name, :count gönderi|[0,*] :name, :count gönderi',
+ ],
'view_switcher' => 'Takvim görünümü',
'all_posts' => 'Tüm Gönderiler',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Beklemede',
'draft' => 'Taslak',
- 'pending_approval' => 'Onay bekliyor',
+ 'pending_approval' => 'Bekliyor',
'scheduled' => 'Zamanlandı',
'publishing' => 'Yayınlanıyor',
'retrying' => 'Yeniden deneniyor',
'published' => 'Yayınlandı',
'failed' => 'Başarısız',
+ 'pending_review' => 'Google incelemesinde',
+ 'deleted_on_network' => 'Silindi',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Kanallar (:count)',
],
'approvals' => [
- 'badge' => 'Onay',
'time_passed' => 'Saat geçti',
'approve' => 'Onayla',
'schedule' => 'Zamanla',
'reject' => 'Reddet',
'revert' => 'Onay isteğini geri al',
'requested' => 'Onay istendi',
+ 'toasts' => [
+ 'scheduled' => 'Gönderi onaylandı ve planlandı',
+ 'queued' => 'Gönderi onaylandı ve kuyruğa eklendi',
+ 'publishing' => 'Gönderi onaylandı, şimdi yayınlanıyor',
+ 'rejected' => 'Gönderi reddedildi ve taslaklara taşındı',
+ ],
'errors' => [
'not_pending' => 'Bu gönderi artık onay beklemiyor.',
'time_passed' => 'İstenen saat geçti. Yeni bir saat seçin.',
diff --git a/lang/tr/sidebar.php b/lang/tr/sidebar.php
index 55b09d806..9970b330a 100644
--- a/lang/tr/sidebar.php
+++ b/lang/tr/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Çalışma alanı seç',
'create_workspace' => 'Çalışma alanı oluştur',
'new' => 'Yeni',
+ 'unfinished_post' => 'Bitirmediğin bir gönderin var',
'create' => 'Oluştur',
'new_menu' => [
'post' => 'Gönderi',
diff --git a/lang/tr/signatures.php b/lang/tr/signatures.php
index b2260aef7..16358392f 100644
--- a/lang/tr/signatures.php
+++ b/lang/tr/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Oluşturuldu',
],
- 'row_actions' => 'İmza işlemleri',
'actions' => [
'edit' => 'İmzayı düzenle',
- 'delete' => 'İmzayı sil',
+ 'delete' => 'Sil',
+ 'settings' => 'Ayarlar',
],
'create' => [
diff --git a/lang/uk/channels.php b/lang/uk/channels.php
index bfeb9bbd7..f21478617 100644
--- a/lang/uk/channels.php
+++ b/lang/uk/channels.php
@@ -7,6 +7,8 @@ return [
'description' => 'Керуйте каналами цього простору.',
'connect' => 'Підключити канал',
'settings' => 'Налаштування каналу',
+ 'manage' => 'Керування каналами',
+ 'set_goal' => 'Задати ціль публікацій',
'publish' => 'Опублікувати',
'insights' => 'Insights',
'new_post' => 'Новий допис у цьому каналі',
@@ -170,6 +172,25 @@ return [
'cancel' => 'Скасувати',
],
+ 'list' => [
+ 'search' => 'Пошук за назвою, @іменем користувача або мережею',
+ 'networks' => 'Мережі',
+ 'networks_search' => 'Пошук мереж',
+ 'no_networks' => 'Мережі не знайдено',
+ 'columns' => [
+ 'channel' => 'Канал',
+ 'timezone' => 'Часовий пояс',
+ 'posting_times' => 'Час',
+ 'this_week' => 'Цей тиждень',
+ ],
+ 'posting_times_per_week' => ':count на тиждень',
+ 'no_posting_times' => 'Немає часу',
+ 'no_results' => 'Немає каналів за вашим запитом.',
+ 'connection_lost' => 'Канал втратив підключення',
+ 'settings' => 'Налаштування',
+ 'more_actions' => 'Інші дії',
+ ],
+
'settings_page' => [
'subtitle' => 'Налаштування каналу',
'back' => 'Назад до каналів',
diff --git a/lang/uk/labels.php b/lang/uk/labels.php
index 16fd63130..d285cbd46 100644
--- a/lang/uk/labels.php
+++ b/lang/uk/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => 'Редагувати мітку',
'delete' => 'Видалити мітку',
'more' => 'Інші дії',
+ 'settings' => 'Налаштування',
'view_posts' => 'Переглянути дописи',
+ 'view_insights' => 'Переглянути Insights',
],
'create' => [
diff --git a/lang/uk/posts.php b/lang/uk/posts.php
index aa1d9eaf4..31c501906 100644
--- a/lang/uk/posts.php
+++ b/lang/uk/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => 'Список',
+ 'board' => [
+ 'view' => 'Дошка',
+ 'group_by' => 'Групувати за',
+ 'group_by_value' => 'Групувати за: :group',
+ 'groups' => [
+ 'status' => 'Статус',
+ 'tag' => 'Мітка',
+ 'channel' => 'Канал',
+ ],
+ 'columns' => [
+ 'draft' => 'Чернетка',
+ 'approvals' => 'Схвалення',
+ 'scheduled' => 'Заплановано',
+ 'published' => 'Опубліковано',
+ 'failed' => 'Помилка',
+ 'untagged' => 'Без мітки',
+ 'no_channel' => 'Немає каналу',
+ ],
+ 'empty_column' => 'Тут порожньо',
+ 'no_columns' => [
+ 'title' => 'Нічого не відповідає цим фільтрам',
+ 'description' => 'Скиньте фільтр за мітками або каналами, щоб побачити всі колонки.',
+ ],
+ 'column_aria' => '{1} :name, постів: :count|[0,*] :name, постів: :count',
+ ],
'view_switcher' => 'Перегляд розкладу',
'all_posts' => 'Усі пости',
'composer' => [
@@ -616,12 +641,14 @@ return [
'status' => [
'pending' => 'Очікує',
'draft' => 'Чернетка',
- 'pending_approval' => 'Очікує схвалення',
+ 'pending_approval' => 'Очікує',
'scheduled' => 'Заплановано',
'publishing' => 'Публікується',
'retrying' => 'Повторна спроба',
'published' => 'Опубліковано',
'failed' => 'Помилка',
+ 'pending_review' => 'На перевірці в Google',
+ 'deleted_on_network' => 'Видалено',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => 'Канали (:count)',
],
'approvals' => [
- 'badge' => 'Схвалення',
'time_passed' => 'Час минув',
'approve' => 'Схвалити',
'schedule' => 'Запланувати',
'reject' => 'Відхилити',
'revert' => 'Відкликати запит на схвалення',
'requested' => 'Запит на схвалення надіслано',
+ 'toasts' => [
+ 'scheduled' => 'Пост схвалено й заплановано',
+ 'queued' => 'Пост схвалено й додано до черги',
+ 'publishing' => 'Пост схвалено, триває публікація',
+ 'rejected' => 'Пост відхилено й переміщено до чернеток',
+ ],
'errors' => [
'not_pending' => 'Ця публікація більше не очікує схвалення.',
'time_passed' => 'Запитаний час минув. Виберіть новий час.',
diff --git a/lang/uk/sidebar.php b/lang/uk/sidebar.php
index 79c85c0d9..fbe316edd 100644
--- a/lang/uk/sidebar.php
+++ b/lang/uk/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => 'Виберіть робочий простір',
'create_workspace' => 'Новий простір',
'new' => 'Створити',
+ 'unfinished_post' => 'У вас є незавершений допис',
'create' => 'Створення',
'new_menu' => [
'post' => 'Допис',
diff --git a/lang/uk/signatures.php b/lang/uk/signatures.php
index c8aaeea74..9e7df88f3 100644
--- a/lang/uk/signatures.php
+++ b/lang/uk/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => 'Створено',
],
- 'row_actions' => 'Дії з підписом',
'actions' => [
'edit' => 'Редагувати підпис',
- 'delete' => 'Видалити підпис',
+ 'delete' => 'Видалити',
+ 'settings' => 'Налаштування',
],
'create' => [
diff --git a/lang/zh/channels.php b/lang/zh/channels.php
index 81670132b..c5a917182 100644
--- a/lang/zh/channels.php
+++ b/lang/zh/channels.php
@@ -7,6 +7,8 @@ return [
'description' => '管理此工作区的频道。',
'connect' => '连接频道',
'settings' => '频道设置',
+ 'manage' => '管理频道',
+ 'set_goal' => '设置发布目标',
'publish' => '发布',
'insights' => 'Insights',
'new_post' => '在此频道发布新帖子',
@@ -170,6 +172,25 @@ return [
'cancel' => '取消',
],
+ 'list' => [
+ 'search' => '按名称、@用户名或平台搜索',
+ 'networks' => '网络',
+ 'networks_search' => '搜索网络',
+ 'no_networks' => '未找到网络',
+ 'columns' => [
+ 'channel' => '频道',
+ 'timezone' => '时区',
+ 'posting_times' => '发布时间',
+ 'this_week' => '本周',
+ ],
+ 'posting_times_per_week' => '每周 :count 次',
+ 'no_posting_times' => '没有发布时间',
+ 'no_results' => '没有符合搜索的频道。',
+ 'connection_lost' => '此频道已断开连接',
+ 'settings' => '设置',
+ 'more_actions' => '更多操作',
+ ],
+
'settings_page' => [
'subtitle' => '频道设置',
'back' => '返回频道',
diff --git a/lang/zh/labels.php b/lang/zh/labels.php
index 6ce49f026..d29308678 100644
--- a/lang/zh/labels.php
+++ b/lang/zh/labels.php
@@ -17,10 +17,11 @@ return [
],
'actions' => [
- 'edit' => '编辑标签',
'delete' => '删除标签',
'more' => '更多操作',
+ 'settings' => '设置',
'view_posts' => '查看帖子',
+ 'view_insights' => '查看 Insights',
],
'create' => [
diff --git a/lang/zh/posts.php b/lang/zh/posts.php
index 22d72e9cc..01f31e968 100644
--- a/lang/zh/posts.php
+++ b/lang/zh/posts.php
@@ -4,6 +4,31 @@ declare(strict_types=1);
return [
'list_view' => '列表',
+ 'board' => [
+ 'view' => '看板',
+ 'group_by' => '分组依据',
+ 'group_by_value' => '分组依据::group',
+ 'groups' => [
+ 'status' => '状态',
+ 'tag' => '标签',
+ 'channel' => '频道',
+ ],
+ 'columns' => [
+ 'draft' => '草稿',
+ 'approvals' => '审批',
+ 'scheduled' => '已排期',
+ 'published' => '已发布',
+ 'failed' => '已失败',
+ 'untagged' => '无标签',
+ 'no_channel' => '无频道',
+ ],
+ 'empty_column' => '这里空空如也',
+ 'no_columns' => [
+ 'title' => '没有符合这些筛选条件的内容',
+ 'description' => '清除标签或频道筛选即可查看所有列。',
+ ],
+ 'column_aria' => '{1} :name,:count 篇帖子|[0,*] :name,:count 篇帖子',
+ ],
'view_switcher' => '日程视图',
'all_posts' => '所有帖子',
'composer' => [
@@ -622,6 +647,8 @@ return [
'retrying' => '重试中',
'published' => '已发布',
'failed' => '已失败',
+ 'pending_review' => 'Google 审核中',
+ 'deleted_on_network' => '已删除',
],
'descriptions' => [
@@ -1102,13 +1129,18 @@ return [
'channels' => '频道 (:count)',
],
'approvals' => [
- 'badge' => '审批',
'time_passed' => '时间已过',
'approve' => '批准',
'schedule' => '排期',
'reject' => '拒绝',
'revert' => '撤回审批请求',
'requested' => '已提交审批请求',
+ 'toasts' => [
+ 'scheduled' => '帖子已批准并已排期',
+ 'queued' => '帖子已批准并已加入队列',
+ 'publishing' => '帖子已批准,正在发布',
+ 'rejected' => '帖子已拒绝并移回草稿',
+ ],
'errors' => [
'not_pending' => '该帖子已不再等待审批。',
'time_passed' => '请求的时间已过,请选择新的时间。',
diff --git a/lang/zh/sidebar.php b/lang/zh/sidebar.php
index 7f5b55d96..a7e695c31 100644
--- a/lang/zh/sidebar.php
+++ b/lang/zh/sidebar.php
@@ -7,6 +7,7 @@ return [
'select_workspace' => '选择工作区',
'create_workspace' => '创建工作区',
'new' => '新建',
+ 'unfinished_post' => '你有一篇未完成的帖子',
'create' => '创建',
'new_menu' => [
'post' => '帖子',
diff --git a/lang/zh/signatures.php b/lang/zh/signatures.php
index 650335c7b..6db6e0ca3 100644
--- a/lang/zh/signatures.php
+++ b/lang/zh/signatures.php
@@ -18,10 +18,10 @@ return [
'created_at' => '创建时间',
],
- 'row_actions' => '签名操作',
'actions' => [
'edit' => '编辑签名',
- 'delete' => '删除签名',
+ 'delete' => '删除',
+ 'settings' => '设置',
],
'create' => [
diff --git a/resources/css/app.css b/resources/css/app.css
index e8e887cb1..3c4992aae 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -370,6 +370,18 @@
transition-timing-function: var(--motion-easing-control-feedback);
}
+/* The columns of the channels settings list (channel, time zone, posting times, this week,
+ actions), shared by its header and its rows so they line up. The actions column has a
+ fixed width: a row that offers Reconnect must not shift the columns of the others. */
+@utility channel-list-columns {
+ grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr) 13rem;
+}
+
+/* A row of a filter or group menu: tall enough to tap in a bottom sheet, menu sized from sm up. */
+@utility menu-row {
+ @apply flex h-11 w-full items-center gap-2 rounded-md px-2 text-start text-base text-foreground transition-control hover:bg-accent focus-visible:bg-accent focus-visible:outline-none sm:h-9 sm:text-sm;
+}
+
@layer components {
/* The filled part runs from --range-from to --range-to (set by rangeFill()). */
.editor-range {
diff --git a/resources/js/components/AppSidebar.vue b/resources/js/components/AppSidebar.vue
index 26b3b7f84..281fbb6a4 100644
--- a/resources/js/components/AppSidebar.vue
+++ b/resources/js/components/AppSidebar.vue
@@ -35,8 +35,15 @@ import {
SidebarHeader,
useSidebar,
} from '@/components/ui/sidebar';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
+import { useHasUnfinishedPost } from '@/composables/useComposerAutosave';
import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
import { openPostComposer } from '@/composables/useGlobalPostComposer';
+import { usePublishView } from '@/composables/usePublishView';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import { insights } from '@/routes/app';
import { index as ideasIndex, create as createIdea } from '@/routes/app/create/ideas';
@@ -55,6 +62,8 @@ const {
canManageAccounts,
canManageTeam,
} = useWorkspaceAbilities();
+const { publishUrl } = usePublishView();
+const hasUnfinishedPost = useHasUnfinishedPost();
const { open: openConnectDialog } = useConnectChannelDialog();
const inviteMemberDialogOpen = ref(false);
@@ -85,7 +94,8 @@ const mainNavItems = computed<NavItem[]>(() => [
: []),
{
title: trans('sidebar.groups.posts'),
- href: postsIndex.url(),
+ href: publishUrl.value,
+ activePattern: postsIndex.url(),
icon: IconCalendarEvent,
count: scheduledPostsCount.value,
countTestId: 'sidebar-publish-count',
@@ -131,105 +141,131 @@ const mainNavItems = computed<NavItem[]>(() => [
v-if="currentWorkspace && canCreatePost"
class="px-4 pt-4 pb-3 group-data-[collapsible=icon]:px-2.5"
>
- <DropdownMenu>
- <DropdownMenuTrigger as-child>
- <Button
- class="h-9 w-full justify-center gap-1.5 rounded-lg bg-primary-strong font-medium text-primary-strong-foreground hover:bg-primary-text-hover data-[state=open]:bg-primary-text-hover dark:hover:bg-primary dark:data-[state=open]:bg-primary group-data-[collapsible=icon]:size-8 group-data-[collapsible=icon]:px-0"
- :aria-label="$t('sidebar.new')"
- data-testid="sidebar-new"
- >
- <IconPlus
- class="hidden size-4 group-data-[collapsible=icon]:block"
- />
- <span class="group-data-[collapsible=icon]:hidden">{{
- $t('sidebar.new')
- }}</span>
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- class="w-72 p-1.5"
- align="start"
- :side="
- isMobile || sidebarState === 'expanded'
- ? 'bottom'
- : 'right'
- "
- :side-offset="4"
- data-testid="sidebar-new-menu"
- >
- <DropdownMenuItem
- class="gap-3 p-2"
- data-testid="sidebar-new-post"
- @select="openPostComposer()"
- >
- <span
- class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-text-hover dark:bg-primary-strong dark:text-primary-strong-foreground"
- data-testid="sidebar-new-post-icon"
- >
- <IconFileText
- class="size-5 text-primary-text-hover dark:text-primary-strong-foreground"
- />
- </span>
- <span class="grid gap-0.5">
- <span class="text-sm font-semibold">{{
- $t('sidebar.new_menu.post')
- }}</span>
- <span
- class="text-xs font-normal text-muted-foreground"
- >{{
- $t('sidebar.new_menu.post_description')
- }}</span
+ <Tooltip :disabled="!hasUnfinishedPost">
+ <TooltipTrigger as-child>
+ <span class="flex w-full">
+ <DropdownMenu>
+ <DropdownMenuTrigger as-child>
+ <Button
+ class="relative h-9 w-full justify-center gap-1.5 rounded-lg bg-primary-strong font-medium text-primary-strong-foreground hover:bg-primary-text-hover data-[state=open]:bg-primary-text-hover dark:hover:bg-primary dark:data-[state=open]:bg-primary group-data-[collapsible=icon]:size-8 group-data-[collapsible=icon]:px-0"
+ :aria-label="$t('sidebar.new')"
+ data-testid="sidebar-new"
+ >
+ <IconPlus
+ class="hidden size-4 group-data-[collapsible=icon]:block"
+ />
+ <span class="group-data-[collapsible=icon]:hidden">{{
+ $t('sidebar.new')
+ }}</span>
+ <span
+ v-if="hasUnfinishedPost"
+ class="absolute -top-0.5 -right-0.5 size-2.5 rounded-full bg-warning ring-2 ring-sidebar"
+ data-testid="sidebar-new-unfinished"
+ />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ class="w-72 p-1.5"
+ align="start"
+ :side="
+ isMobile || sidebarState === 'expanded'
+ ? 'bottom'
+ : 'right'
+ "
+ :side-offset="4"
+ data-testid="sidebar-new-menu"
>
- </span>
- </DropdownMenuItem>
- <DropdownMenuItem
- class="gap-3 p-2"
- data-testid="sidebar-new-idea"
- @select="router.visit(createIdea.url())"
- >
- <span
- class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary-subtle text-primary-strong dark:text-primary-text"
- data-testid="sidebar-new-idea-icon"
- >
- <IconBulb
- class="size-5 text-primary-strong dark:text-primary-text"
- />
- </span>
- <span class="grid gap-0.5">
- <span class="text-sm font-semibold">{{
- $t('sidebar.new_menu.idea')
- }}</span>
- <span
- class="text-xs font-normal text-muted-foreground"
- >{{
- $t('sidebar.new_menu.idea_description')
- }}</span
- >
- </span>
- </DropdownMenuItem>
- <template v-if="canManageAccounts || canManageTeam">
- <DropdownMenuSeparator />
- <DropdownMenuItem
- v-if="canManageAccounts"
- data-testid="sidebar-new-channel"
- @select="openConnectDialog()"
- >
- <IconLayoutGrid
- class="size-4 text-muted-foreground"
- />
- {{ $t('sidebar.new_menu.channel') }}
- </DropdownMenuItem>
- <DropdownMenuItem
- v-if="canManageTeam"
- data-testid="sidebar-new-member"
- @select="openInviteMemberDialog"
- >
- <IconUsers class="size-4 text-muted-foreground" />
- {{ $t('sidebar.new_menu.member') }}
- </DropdownMenuItem>
- </template>
- </DropdownMenuContent>
- </DropdownMenu>
+ <DropdownMenuItem
+ class="gap-3 p-2"
+ data-testid="sidebar-new-post"
+ @select="openPostComposer()"
+ >
+ <span
+ class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary text-primary-text-hover dark:bg-primary-strong dark:text-primary-strong-foreground"
+ data-testid="sidebar-new-post-icon"
+ >
+ <IconFileText
+ class="size-5 text-primary-text-hover dark:text-primary-strong-foreground"
+ />
+ </span>
+ <span class="grid gap-0.5">
+ <span class="text-sm font-semibold">{{
+ $t('sidebar.new_menu.post')
+ }}</span>
+ <span
+ class="text-xs font-normal text-muted-foreground"
+ >{{
+ $t('sidebar.new_menu.post_description')
+ }}</span
+ >
+ </span>
+ <span
+ v-if="hasUnfinishedPost"
+ class="ms-auto size-2 shrink-0 rounded-full bg-warning"
+ data-testid="sidebar-new-post-unfinished"
+ >
+ <span class="sr-only">{{
+ $t('sidebar.unfinished_post')
+ }}</span>
+ </span>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ class="gap-3 p-2"
+ data-testid="sidebar-new-idea"
+ @select="router.visit(createIdea.url())"
+ >
+ <span
+ class="flex size-10 shrink-0 items-center justify-center rounded-lg bg-primary-subtle text-primary-strong dark:text-primary-text"
+ data-testid="sidebar-new-idea-icon"
+ >
+ <IconBulb
+ class="size-5 text-primary-strong dark:text-primary-text"
+ />
+ </span>
+ <span class="grid gap-0.5">
+ <span class="text-sm font-semibold">{{
+ $t('sidebar.new_menu.idea')
+ }}</span>
+ <span
+ class="text-xs font-normal text-muted-foreground"
+ >{{
+ $t('sidebar.new_menu.idea_description')
+ }}</span
+ >
+ </span>
+ </DropdownMenuItem>
+ <template v-if="canManageAccounts || canManageTeam">
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ v-if="canManageAccounts"
+ data-testid="sidebar-new-channel"
+ @select="openConnectDialog()"
+ >
+ <IconLayoutGrid
+ class="size-4 text-muted-foreground"
+ />
+ {{ $t('sidebar.new_menu.channel') }}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ v-if="canManageTeam"
+ data-testid="sidebar-new-member"
+ @select="openInviteMemberDialog"
+ >
+ <IconUsers class="size-4 text-muted-foreground" />
+ {{ $t('sidebar.new_menu.member') }}
+ </DropdownMenuItem>
+ </template>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent
+ side="top"
+ data-testid="sidebar-new-unfinished-tooltip"
+ >
+ {{ $t('sidebar.unfinished_post') }}
+ </TooltipContent>
+ </Tooltip>
</div>
<NavMain v-if="currentWorkspace" :items="mainNavItems" />
diff --git a/resources/js/components/ConfirmDeleteModal.vue b/resources/js/components/ConfirmDeleteModal.vue
index 09650a5b7..39a7b9b00 100644
--- a/resources/js/components/ConfirmDeleteModal.vue
+++ b/resources/js/components/ConfirmDeleteModal.vue
@@ -63,6 +63,7 @@ const confirmInput = ref('');
const confirmText = ref('');
const payload = ref<Record<string, unknown>>({});
const request = ref<(() => Promise<void>) | null>(null);
+const visit = ref<{ only?: string[]; reset?: string[] }>({});
const keywordCopied = ref(false);
let keywordCopiedTimeout: ReturnType<typeof setTimeout> | null = null;
@@ -121,6 +122,7 @@ const remove = () => {
}
const options = {
+ ...visit.value,
preserveState: true,
preserveScroll: true,
onSuccess: () => {
@@ -151,8 +153,11 @@ const open = (data: {
confirmText?: string;
data?: Record<string, unknown>;
request?: () => Promise<void>;
+ /** What the visit reloads, for a page that keeps its other props (a partial reload). */
+ visit?: { only?: string[]; reset?: string[] };
}) => {
url.value = data.url;
+ visit.value = data.visit ?? {};
payload.value = data.data ?? {};
request.value = data.request ?? null;
confirmText.value = data.confirmText ?? '';
diff --git a/resources/js/components/HeaderTitle.vue b/resources/js/components/HeaderTitle.vue
index cfab0d5e1..d5f05359f 100644
--- a/resources/js/components/HeaderTitle.vue
+++ b/resources/js/components/HeaderTitle.vue
@@ -1,11 +1,22 @@
<script setup lang="ts">
-import type { Component } from 'vue';
+import { computed, type Component } from 'vue';
-defineProps<{
+import { filled } from '@/lib/helpers';
+
+const props = defineProps<{
title?: string;
total?: number | null;
icon?: Component;
}>();
+
+/** The count shows after the title once there is something to count. */
+const hasTotal = computed((): boolean => {
+ if (!filled(props.total)) {
+ return false;
+ }
+
+ return props.total > 0;
+});
</script>
<template>
@@ -28,8 +39,9 @@ defineProps<{
>
{{ title }}
<span
- v-if="total != null && total > 0"
+ v-if="hasTotal"
class="text-muted-foreground"
+ data-testid="header-title-total"
>
({{ total }})
</span>
diff --git a/resources/js/components/NavChannels.vue b/resources/js/components/NavChannels.vue
index afff707d8..fae3f594f 100644
--- a/resources/js/components/NavChannels.vue
+++ b/resources/js/components/NavChannels.vue
@@ -44,8 +44,9 @@ import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
import { openPostComposer } from '@/composables/useGlobalPostComposer';
import { useNetworkConnect } from '@/composables/useNetworkConnect';
import { getPlatformLabel } from '@/composables/usePlatformLogo';
+import { usePublishView } from '@/composables/usePublishView';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
-import { insights, publish } from '@/routes/app/channels';
+import { insights } from '@/routes/app/channels';
import { channels as channelsSettings } from '@/routes/app/workspace';
import { channelName, type SidebarChannel } from '@/types/channel';
import type { AvailablePlatform } from '@/types/social-account';
@@ -123,6 +124,8 @@ const suggestedPlatforms = computed(() => {
return SUGGESTED_PLATFORMS.filter((platform) => connectable.has(platform));
});
+const { channelPublishUrl, isChannelPublishPage } = usePublishView();
+
const isCurrentChannel = (channel: SidebarChannel): boolean =>
page.url.startsWith(`/channels/${channel.id}/`);
@@ -207,7 +210,7 @@ const reconnect = (channel: SidebarChannel): void => {
>
<Link
:href="channelsSettings.url()"
- :aria-label="$t('channels.settings')"
+ :aria-label="$t('channels.manage')"
data-testid="sidebar-channels-settings"
>
<IconSettings />
@@ -218,7 +221,7 @@ const reconnect = (channel: SidebarChannel): void => {
side="top"
data-testid="sidebar-channels-settings-tooltip"
>
- {{ $t('channels.settings') }}
+ {{ $t('channels.manage') }}
</TooltipContent>
</Tooltip>
<Tooltip v-if="canManageAccounts">
@@ -380,10 +383,10 @@ const reconnect = (channel: SidebarChannel): void => {
<SidebarMenuButton
as-child
:is-active="isCurrentChannel(channel)"
- class="h-9 gap-2 py-1 ps-2 max-md:pe-16 group-hover/channel:pe-16 group-has-focus-visible/channel:pe-16 data-[active=true]:bg-transparent data-[active=true]:hover:bg-sidebar-accent [&:has(~[data-sidebar=group-action]:hover)]:bg-sidebar-accent group-data-[collapsible=icon]:overflow-visible group-data-[collapsible=icon]:p-0.5! group-data-[collapsible=icon]:data-[active=true]:bg-sidebar-accent"
+ class="h-9 gap-2 py-1 ps-2 pe-8 max-md:pe-16 group-hover/channel:pe-16 group-has-focus-visible/channel:pe-16 data-[active=true]:bg-transparent data-[active=true]:hover:bg-sidebar-accent [&:has(~[data-sidebar=group-action]:hover)]:bg-sidebar-accent group-data-[collapsible=icon]:overflow-visible group-data-[collapsible=icon]:p-0.5! group-data-[collapsible=icon]:data-[active=true]:bg-sidebar-accent"
>
<Link
- :href="publish.url(channel.id)"
+ :href="channelPublishUrl(channel.id)"
:data-testid="`sidebar-channel-${channel.id}`"
>
<ChannelAvatar
@@ -397,7 +400,11 @@ const reconnect = (channel: SidebarChannel): void => {
:status="canManageAccounts ? null : channel.status"
:account-id="channel.id"
/>
- <span class="truncate text-sm group-data-[collapsible=icon]:hidden">{{ channelName(channel) }}</span>
+ <span
+ class="truncate text-sm group-data-[collapsible=icon]:hidden"
+ :data-testid="`sidebar-channel-name-${channel.id}`"
+ >{{ channelName(channel) }}</span
+ >
</Link>
</SidebarMenuButton>
</HoverCardTrigger>
@@ -421,7 +428,7 @@ const reconnect = (channel: SidebarChannel): void => {
{{ $t('channels.connection_lost_hint') }}
</p>
<Link
- :href="publish.url(channel.id)"
+ :href="channelPublishUrl(channel.id)"
:class="channelCardItemClass"
:data-testid="`sidebar-channel-${channel.id}-card-publish`"
>
@@ -505,10 +512,10 @@ const reconnect = (channel: SidebarChannel): void => {
<SidebarMenuSubItem>
<SidebarMenuSubButton
as-child
- :is-active="urlIsActive(publish.url(channel.id))"
+ :is-active="isChannelPublishPage(channel.id)"
>
<Link
- :href="publish.url(channel.id)"
+ :href="channelPublishUrl(channel.id)"
:data-testid="`sidebar-channel-${channel.id}-publish`"
>
<IconCalendarEvent />
diff --git a/resources/js/components/NetworkFilter.vue b/resources/js/components/NetworkFilter.vue
new file mode 100644
index 000000000..3c3edb8a3
--- /dev/null
+++ b/resources/js/components/NetworkFilter.vue
@@ -0,0 +1,67 @@
+<script setup lang="ts">
+import { IconWorld } from '@tabler/icons-vue';
+import { computed } from 'vue';
+
+import MultiSelectFilter from '@/components/MultiSelectFilter.vue';
+import PlatformBrandIcon from '@/components/PlatformBrandIcon.vue';
+import { getPlatformLabel } from '@/composables/usePlatformLogo';
+
+/**
+ * Filters a list by social network (Instagram, LinkedIn…), with the same
+ * trigger and options as the channels filter, each network shown by its logo.
+ */
+const props = withDefaults(
+ defineProps<{
+ /** The networks to offer, each once, in the order they should show. */
+ networks: string[];
+ testId?: string;
+ /** Opens as a bottom sheet on phones instead of a popover. */
+ sheetBelowSm?: boolean;
+ }>(),
+ { testId: 'network', sheetBelowSm: false },
+);
+
+const selectedNetworks = defineModel<string[]>({ required: true });
+
+const options = computed(() =>
+ props.networks.map((network) => ({
+ id: network,
+ label: getPlatformLabel(network),
+ })),
+);
+</script>
+
+<template>
+ <MultiSelectFilter
+ v-model="selectedNetworks"
+ :options="options"
+ :label="$t('channels.list.networks')"
+ :search-placeholder="$t('channels.list.networks_search')"
+ :empty-message="$t('channels.list.no_networks')"
+ :select-all-label="$t('posts.composer.select_all')"
+ :deselect-all-label="$t('posts.composer.deselect_all')"
+ :test-id="testId"
+ content-class="w-80"
+ icon-only-on-mobile
+ :sheet-below-sm="sheetBelowSm"
+ >
+ <template #icon>
+ <IconWorld class="size-4" />
+ </template>
+ <template #option="{ option }">
+ <span class="flex min-w-0 items-center gap-3">
+ <span
+ class="flex size-8 shrink-0 items-center justify-center rounded-lg border border-border bg-card"
+ aria-hidden="true"
+ >
+ <PlatformBrandIcon
+ :platform="option.id"
+ colored
+ class="size-4.5"
+ />
+ </span>
+ <span class="min-w-0 truncate">{{ option.label }}</span>
+ </span>
+ </template>
+ </MultiSelectFilter>
+</template>
diff --git a/resources/js/components/channels/ChannelListItem.vue b/resources/js/components/channels/ChannelListItem.vue
index eaaec6b33..1f29971c2 100644
--- a/resources/js/components/channels/ChannelListItem.vue
+++ b/resources/js/components/channels/ChannelListItem.vue
@@ -12,6 +12,7 @@ import {
import { computed } from 'vue';
import ChannelAvatar from '@/components/ChannelAvatar.vue';
+import GoalProgress from '@/components/publish/GoalProgress.vue';
import { Button } from '@/components/ui/button';
import {
DropdownMenu,
@@ -20,22 +21,28 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
import { getPlatformLabel } from '@/composables/usePlatformLogo';
+import { blank, filled } from '@/lib/helpers';
import { settings as settingsRoute } from '@/routes/app/channels';
+import { channelName } from '@/types/channel';
import {
accountTypeKey,
isConnectionLost,
+ type ChannelListRow,
type ConnectedAccount,
} from '@/types/social-account';
const props = withDefaults(
defineProps<{
- channel: ConnectedAccount;
- showSettings?: boolean;
+ channel: ChannelListRow;
canLinkFacebook?: boolean;
}>(),
{
- showSettings: true,
canLinkFacebook: false,
},
);
@@ -46,128 +53,268 @@ const emit = defineEmits<{
disconnect: [channel: ConnectedAccount];
}>();
+const name = computed(() => channelName(props.channel));
+
const lost = computed(() => isConnectionLost(props.channel));
-const typeKey = computed(() => accountTypeKey(props.channel));
+const timezone = computed(() => props.channel.timezone_option);
+
+/** UTC needs no offset next to it: "UTC GMT" says nothing more. */
+const showsOffset = computed((): boolean => {
+ if (timezone.value.label === 'UTC') {
+ return false;
+ }
+
+ return true;
+});
+
+/** Whether the channel has posting times, so the queue can fill them. */
+const hasPostingTimes = computed((): boolean => {
+ if (props.channel.posting_times_per_week > 0) {
+ return true;
+ }
+
+ return false;
+});
+
+type Translate = (key: string) => string;
+
+/**
+ * The account type when the network has several ("LinkedIn Page"), else the network's name.
+ * It takes the template's `$t`, so the type follows the loaded language.
+ */
+const networkName = (translate: Translate): string => {
+ const typeKey = accountTypeKey(props.channel);
+
+ if (filled(typeKey)) {
+ return translate(typeKey);
+ }
+
+ return getPlatformLabel(props.channel.platform);
+};
+
+/** The network and the username under the name: "Instagram · @trypost.it"; the network alone for an account without one (a Facebook Page). */
+const networkLine = (translate: Translate): string => {
+ const network = networkName(translate);
+
+ if (blank(props.channel.username)) {
+ return network;
+ }
+
+ return `${network} · @${props.channel.username}`;
+};
+
+const reconnect = (): void => {
+ emit('reconnect', props.channel);
+};
+
+const linkFacebook = (): void => {
+ emit('linkFacebook', props.channel);
+};
+
+const disconnect = (): void => {
+ emit('disconnect', props.channel);
+};
</script>
<template>
<div
- class="flex items-center gap-3 rounded-xl border border-border bg-card p-4"
+ class="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3 md:channel-list-columns"
:data-testid="`channel-row-${channel.id}`"
>
- <ChannelAvatar
- :status="channel.status"
- :account-id="channel.id"
- :platform="channel.platform"
- :src="channel.avatar_url"
- :verified="channel.verified_badge"
- :name="channel.display_name || channel.username"
- :size="40"
- ring="card"
- />
-
- <div class="min-w-0 flex-1">
+ <div class="flex min-w-0 items-center gap-3">
+ <ChannelAvatar
+ :status="channel.status"
+ :account-id="channel.id"
+ :platform="channel.platform"
+ :src="channel.avatar_url"
+ :verified="channel.verified_badge"
+ :name="name"
+ :size="32"
+ ring="card"
+ />
+ <div class="min-w-0">
+ <p
+ class="truncate text-sm leading-tight font-emphasis text-foreground"
+ :data-testid="`channel-name-${channel.id}`"
+ >
+ {{ name }}
+ </p>
+ <p
+ v-if="lost"
+ class="flex min-w-0 items-start gap-1 text-sm text-destructive"
+ :data-testid="`channel-connection-lost-${channel.id}`"
+ >
+ <IconAlertCircle class="mt-[3px] size-3.5 shrink-0" />
+ <span>{{ $t('channels.list.connection_lost') }}</span>
+ </p>
+ <p
+ v-else
+ class="truncate text-sm text-muted-foreground"
+ :title="networkLine($t)"
+ :data-testid="`channel-network-${channel.id}`"
+ >
+ {{ networkLine($t) }}
+ </p>
+ </div>
+ </div>
+
+ <div
+ class="col-span-2 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-sm max-md:order-3 max-md:ps-11 md:contents"
+ >
<p
- class="truncate text-sm leading-tight font-emphasis text-foreground"
- :data-testid="`channel-name-${channel.id}`"
+ class="min-w-0 truncate text-foreground"
+ :title="timezone.value"
+ :data-testid="`channel-timezone-${channel.id}`"
>
- {{ channel.display_name || channel.username }}
+ {{ timezone.label }}
+ <span v-if="showsOffset" class="text-muted-foreground">{{
+ timezone.offset
+ }}</span>
</p>
<p
- v-if="lost"
- class="flex min-w-0 items-center gap-1.5 text-sm text-destructive"
- :data-testid="`channel-connection-lost-${channel.id}`"
+ v-if="hasPostingTimes"
+ class="min-w-0 truncate text-foreground"
+ :data-testid="`channel-posting-times-${channel.id}`"
>
- <IconAlertCircle class="size-4 shrink-0" />
- <span class="truncate">{{ $t('channels.connection_lost_hint') }}</span>
- </p>
- <p v-else class="truncate text-sm text-muted-foreground">
{{
- typeKey
- ? $t(typeKey)
- : getPlatformLabel(channel.platform)
+ $t('channels.list.posting_times_per_week', {
+ count: String(channel.posting_times_per_week),
+ })
}}
</p>
+ <p
+ v-else
+ class="min-w-0 truncate text-muted-foreground"
+ :data-testid="`channel-posting-times-${channel.id}`"
+ >
+ {{ $t('channels.list.no_posting_times') }}
+ </p>
+ <div class="flex min-w-0 text-muted-foreground">
+ <GoalProgress
+ v-if="filled(channel.posting_goal)"
+ :channel-id="channel.id"
+ :sent="channel.sent_this_week"
+ :scheduled="channel.scheduled_this_week"
+ :goal="channel.posting_goal"
+ :test-id="`channel-goal-${channel.id}`"
+ :interactive="false"
+ />
+ <Link
+ v-else
+ :href="settingsRoute.url(channel.id)"
+ class="truncate rounded-md transition-control hover:text-foreground"
+ :data-testid="`channel-goal-set-${channel.id}`"
+ >
+ {{ $t('channels.set_goal') }}
+ </Link>
+ </div>
+ </div>
+
+ <div class="flex shrink-0 items-center justify-end gap-1 max-md:order-2">
+ <Button
+ v-if="lost"
+ variant="destructive"
+ size="sm"
+ class="max-md:hidden"
+ :data-testid="`channel-reconnect-${channel.id}`"
+ @click="reconnect"
+ >
+ <IconRefresh class="size-4" />
+ {{ $t('channels.reconnect') }}
+ </Button>
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <Button as-child variant="ghost" size="icon">
+ <Link
+ :href="settingsRoute.url(channel.id)"
+ :aria-label="$t('channels.settings')"
+ :data-testid="`channel-settings-${channel.id}`"
+ >
+ <IconSettings class="size-4" />
+ </Link>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`channel-settings-tooltip-${channel.id}`"
+ >
+ {{ $t('channels.list.settings') }}
+ </TooltipContent>
+ </Tooltip>
+
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <span class="inline-flex">
+ <DropdownMenu>
+ <DropdownMenuTrigger as-child>
+ <Button
+ variant="ghost"
+ size="icon"
+ class="data-[state=open]:bg-accent"
+ :aria-label="$t('channels.actions')"
+ :data-testid="`channel-menu-${channel.id}`"
+ >
+ <IconDotsVertical class="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem v-if="channel.profile_url" as-child>
+ <a
+ :href="channel.profile_url"
+ target="_blank"
+ rel="noopener"
+ :data-testid="`channel-menu-profile-${channel.id}`"
+ >
+ <IconExternalLink class="size-4" />
+ {{ $t('channels.view_profile') }}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ v-if="canLinkFacebook"
+ :data-testid="`channel-menu-link-facebook-${channel.id}`"
+ @click="linkFacebook"
+ >
+ <IconBrandFacebook class="size-4" />
+ {{ $t('channels.link_facebook_page') }}
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ :data-testid="`channel-menu-reconnect-${channel.id}`"
+ @click="reconnect"
+ >
+ <IconRefresh class="size-4" />
+ {{ $t('channels.refresh_connection') }}
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ :data-testid="`channel-disconnect-${channel.id}`"
+ @click="disconnect"
+ >
+ <IconTrash class="size-4" />
+ {{ $t('channels.disconnect') }}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`channel-menu-tooltip-${channel.id}`"
+ >
+ {{ $t('channels.list.more_actions') }}
+ </TooltipContent>
+ </Tooltip>
</div>
<Button
v-if="lost"
+ variant="destructive"
size="sm"
- class="shrink-0"
- :data-testid="`channel-reconnect-${channel.id}`"
- @click="emit('reconnect', channel)"
+ class="col-span-2 order-4 md:hidden"
+ :data-testid="`channel-reconnect-phone-${channel.id}`"
+ @click="reconnect"
>
<IconRefresh class="size-4" />
{{ $t('channels.reconnect') }}
</Button>
-
- <div class="flex shrink-0 items-center">
- <Button
- v-if="showSettings"
- as-child
- variant="ghost"
- size="icon"
- >
- <Link
- :href="settingsRoute.url(channel.id)"
- :aria-label="$t('channels.settings')"
- :data-testid="`channel-settings-${channel.id}`"
- >
- <IconSettings class="size-4" />
- </Link>
- </Button>
-
- <DropdownMenu>
- <DropdownMenuTrigger as-child>
- <Button
- variant="ghost"
- size="icon"
- class="data-[state=open]:bg-accent"
- :aria-label="$t('channels.actions')"
- :data-testid="`channel-menu-${channel.id}`"
- >
- <IconDotsVertical class="size-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end">
- <DropdownMenuItem v-if="channel.profile_url" as-child>
- <a
- :href="channel.profile_url"
- target="_blank"
- rel="noopener"
- :data-testid="`channel-menu-profile-${channel.id}`"
- >
- <IconExternalLink class="size-4" />
- {{ $t('channels.view_profile') }}
- </a>
- </DropdownMenuItem>
- <DropdownMenuItem
- v-if="canLinkFacebook"
- :data-testid="`channel-menu-link-facebook-${channel.id}`"
- @click="emit('linkFacebook', channel)"
- >
- <IconBrandFacebook class="size-4" />
- {{ $t('channels.link_facebook_page') }}
- </DropdownMenuItem>
- <DropdownMenuItem
- :data-testid="`channel-menu-reconnect-${channel.id}`"
- @click="emit('reconnect', channel)"
- >
- <IconRefresh class="size-4" />
- {{ $t('channels.refresh_connection') }}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- variant="destructive"
- :data-testid="`channel-disconnect-${channel.id}`"
- @click="emit('disconnect', channel)"
- >
- <IconTrash class="size-4" />
- {{ $t('channels.disconnect') }}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </div>
</div>
</template>
diff --git a/resources/js/components/command-palette/CommandPaletteContent.vue b/resources/js/components/command-palette/CommandPaletteContent.vue
index 8c25373a2..2106cc6b8 100644
--- a/resources/js/components/command-palette/CommandPaletteContent.vue
+++ b/resources/js/components/command-palette/CommandPaletteContent.vue
@@ -31,15 +31,15 @@ import { orderChannels } from '@/composables/useChannelOrder';
import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
import { openPostComposer } from '@/composables/useGlobalPostComposer';
import { getPlatformLabel } from '@/composables/usePlatformLogo';
+import { usePublishView } from '@/composables/usePublishView';
import { useSettingsNavigation } from '@/composables/useSettingsNavigation';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import { toUrl } from '@/lib/utils';
import { insights as insightsIndex } from '@/routes/app';
-import { insights, publish } from '@/routes/app/channels';
+import { insights } from '@/routes/app/channels';
import { index as feedsIndex } from '@/routes/app/create/feeds';
import { create as createIdea, index as ideasIndex } from '@/routes/app/create/ideas';
import { index as templatesIndex } from '@/routes/app/create/templates';
-import { index as postsIndex } from '@/routes/app/posts';
import { index as repurposes } from '@/routes/app/repurposes';
import { channelName, type SidebarChannel } from '@/types/channel';
import type {
@@ -139,6 +139,8 @@ const createPath = (tab: string): CommandPaletteTitle => ({
path: [{ key: 'sidebar.create' }, { key: `create.tabs.${tab}` }],
});
+const { publishUrl, channelPublishUrl } = usePublishView();
+
const navigation = computed<CommandPaletteEntry[]>(() => {
const entries: CommandPaletteEntry[] = hasWorkspace.value
? [
@@ -147,7 +149,7 @@ const navigation = computed<CommandPaletteEntry[]>(() => {
group: 'navigation',
title: { key: 'sidebar.groups.posts' },
icon: IconCalendarEvent,
- run: visit(postsIndex.url()),
+ run: visit(publishUrl.value),
},
...(canCreatePost.value
? [
@@ -217,7 +219,7 @@ const channelEntries = computed<CommandPaletteEntry[]>(() =>
subtitle: { text: getPlatformLabel(channel.platform) },
channel,
count: channel.scheduled_posts_count,
- run: visit(publish.url(channel.id)),
+ run: visit(channelPublishUrl(channel.id)),
})),
);
diff --git a/resources/js/components/create/ideas/IdeaCard.vue b/resources/js/components/create/ideas/IdeaCard.vue
index d45f4779f..b53625c5e 100644
--- a/resources/js/components/create/ideas/IdeaCard.vue
+++ b/resources/js/components/create/ideas/IdeaCard.vue
@@ -118,6 +118,7 @@ const onClick = (): void => {
v-for="label in cardLabels"
:key="label.id"
:label="label"
+ :data-testid="`idea-card-label-${card.id}-${label.id}`"
/>
</div>
diff --git a/resources/js/components/create/ideas/IdeaEditorDialog.vue b/resources/js/components/create/ideas/IdeaEditorDialog.vue
index 71afad8e5..87d7a5ae8 100644
--- a/resources/js/components/create/ideas/IdeaEditorDialog.vue
+++ b/resources/js/components/create/ideas/IdeaEditorDialog.vue
@@ -13,6 +13,7 @@ import {
import { computed, nextTick, ref, watch } from 'vue';
import WritingAssistantPanel from '@/components/ai/WritingAssistantPanel.vue';
+import LabelChips from '@/components/labels/LabelChips.vue';
import LabelFilter from '@/components/labels/LabelFilter.vue';
import MediaTray from '@/components/media/MediaTray.vue';
import UnsplashDialog from '@/components/media/UnsplashDialog.vue';
@@ -40,6 +41,7 @@ import {
useMediaImport,
} from '@/composables/useMediaImport';
import { mediaUploadLimits, useMediaUpload } from '@/composables/useMediaUpload';
+import { filled } from '@/lib/helpers';
import { editorTabsFor, rulesFor } from '@/lib/mediaEditor';
import { isGooglePickerOpen } from '@/lib/mediaSources/googleDrive';
import { acceptAttribute } from '@/lib/mediaType';
@@ -206,6 +208,8 @@ const selectedLabels = computed(() =>
),
);
+const hasSelectedLabels = computed(() => filled(selectedLabels.value));
+
const addLabel = (label: IdeaLabel): void => {
if (!availableLabels.value.some(({ id }) => id === label.id)) {
availableLabels.value = [...availableLabels.value, label];
@@ -500,37 +504,14 @@ const iconButtonClass =
data-testid="idea-editor-labels"
>
<IconTag class="size-4 shrink-0" />
- <span v-if="!selectedLabels.length">{{
+ <span v-if="!hasSelectedLabels">{{
$t('create.ideas.editor.labels')
}}</span>
- <span
+ <LabelChips
v-else
- class="flex min-w-0 items-center gap-1.5 overflow-hidden"
- >
- <span
- v-for="label in selectedLabels.slice(
- 0,
- 2,
- )"
- :key="label.id"
- class="flex min-w-0 items-center gap-1"
- >
- <span
- class="size-2 shrink-0 rounded-full"
- :style="{
- backgroundColor: label.color,
- }"
- />
- <span class="truncate">{{
- label.name
- }}</span>
- </span>
- <span
- v-if="selectedLabels.length > 2"
- class="shrink-0 text-muted-foreground"
- >+{{ selectedLabels.length - 2 }}</span
- >
- </span>
+ :labels="selectedLabels"
+ test-id="idea-editor-labels-chip"
+ />
<IconChevronDown
class="size-4 shrink-0 text-muted-foreground"
/>
diff --git a/resources/js/components/labels/LabelBadge.vue b/resources/js/components/labels/LabelBadge.vue
index 7680ccdca..9d9e5c8e4 100644
--- a/resources/js/components/labels/LabelBadge.vue
+++ b/resources/js/components/labels/LabelBadge.vue
@@ -1,24 +1,25 @@
<script setup lang="ts">
-interface Label {
- id: string;
- name: string;
- color: string;
-}
+import { computed } from 'vue';
-defineProps<{
- label: Label;
+import { labelTextColor } from '@/lib/labelColor';
+import type { PostCardLabel } from '@/types/publish';
+
+const props = defineProps<{
+ label: PostCardLabel;
}>();
+
+/** The label's own color as the background, with the text color that reads on it. */
+const colors = computed(() => ({
+ backgroundColor: props.label.color,
+ color: labelTextColor(props.label.color),
+}));
</script>
<template>
<span
- class="inline-flex h-6 max-w-full min-w-0 items-center gap-1.5 rounded-md border border-border-strong bg-card px-2 text-xs font-medium text-foreground"
+ class="inline-flex h-6 max-w-full min-w-0 items-center rounded-full px-2.5 text-xs font-medium text-foreground"
+ :style="colors"
>
- <span
- class="size-2 shrink-0 rounded-full"
- :style="{ backgroundColor: label.color }"
- aria-hidden="true"
- />
<span class="truncate">{{ label.name }}</span>
</span>
</template>
diff --git a/resources/js/components/labels/LabelChips.vue b/resources/js/components/labels/LabelChips.vue
new file mode 100644
index 000000000..84fa69927
--- /dev/null
+++ b/resources/js/components/labels/LabelChips.vue
@@ -0,0 +1,40 @@
+<script setup lang="ts">
+import { computed } from 'vue';
+
+import LabelBadge from '@/components/labels/LabelBadge.vue';
+import type { PostCardLabel } from '@/types/publish';
+
+const props = withDefaults(
+ defineProps<{
+ labels: PostCardLabel[];
+ /** How many chips show before the rest is counted as "+N". */
+ max?: number;
+ /** Prefix of each chip's test id (`<testId>-<label id>`) and of the count (`<testId>-more`). */
+ testId: string;
+ }>(),
+ { max: 2 },
+);
+
+const shown = computed(() => props.labels.slice(0, props.max));
+
+const hiddenCount = computed(() => props.labels.length - shown.value.length);
+
+const hasHidden = computed(() => hiddenCount.value > 0);
+</script>
+
+<template>
+ <span class="flex min-w-0 items-center gap-1.5 overflow-hidden">
+ <LabelBadge
+ v-for="label in shown"
+ :key="label.id"
+ :label="label"
+ :data-testid="`${testId}-${label.id}`"
+ />
+ <span
+ v-if="hasHidden"
+ class="shrink-0 text-muted-foreground"
+ :data-testid="`${testId}-more`"
+ >+{{ hiddenCount }}</span
+ >
+ </span>
+</template>
diff --git a/resources/js/components/labels/LabelFilter.vue b/resources/js/components/labels/LabelFilter.vue
index 0a848b674..632edb828 100644
--- a/resources/js/components/labels/LabelFilter.vue
+++ b/resources/js/components/labels/LabelFilter.vue
@@ -4,10 +4,12 @@ import { IconPlus, IconSettings, IconTag, IconX } from '@tabler/icons-vue';
import { computed, ref } from 'vue';
import FilterEmptyState from '@/components/FilterEmptyState.vue';
+import LabelBadge from '@/components/labels/LabelBadge.vue';
import LabelForm from '@/components/labels/LabelForm.vue';
import MultiSelectFilter from '@/components/MultiSelectFilter.vue';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
+import { filled } from '@/lib/helpers';
import { matchesSearch } from '@/lib/search';
import {
index as labelsIndex,
@@ -83,6 +85,22 @@ const saveLabel = (): void => {
});
};
+/**
+ * The footer (clear, settings) shows while there are labels, and also while a
+ * selection is left that none of them can undo: a deleted label still in the URL.
+ */
+const showsFooter = computed((): boolean => {
+ if (filled(props.labels)) {
+ return true;
+ }
+
+ if (untagged.value) {
+ return true;
+ }
+
+ return filled(selectedIds.value);
+});
+
const clear = (): void => {
selectedIds.value = [];
untagged.value = false;
@@ -194,16 +212,10 @@ const clear = (): void => {
</div>
</template>
<template #option="{ option }">
- <span
- class="flex min-w-0 items-center gap-2.5 text-sm leading-5 text-foreground"
- >
- <span
- class="size-2.5 shrink-0 rounded-full"
- :style="{ backgroundColor: labelFor(option.id).color }"
- aria-hidden="true"
- />
- <span class="truncate">{{ labelFor(option.id).name }}</span>
- </span>
+ <LabelBadge
+ :label="labelFor(option.id)"
+ :data-testid="`${testId}-chip-${option.id}`"
+ />
</template>
<template v-if="labels.length === 0" #empty>
<FilterEmptyState
@@ -222,7 +234,7 @@ const clear = (): void => {
</Button>
</FilterEmptyState>
</template>
- <template v-if="labels.length > 0" #footer>
+ <template v-if="showsFooter" #footer>
<div
class="-mx-3 mt-2 flex items-center justify-between border-t border-border px-3 pt-2"
>
diff --git a/resources/js/components/posts/ScheduleViewSwitch.vue b/resources/js/components/posts/ScheduleViewSwitch.vue
index c434059d8..156d0012e 100644
--- a/resources/js/components/posts/ScheduleViewSwitch.vue
+++ b/resources/js/components/posts/ScheduleViewSwitch.vue
@@ -1,58 +1,175 @@
<script setup lang="ts">
import { Link } from '@inertiajs/vue3';
-import { IconCalendar, IconLayoutGrid, IconList } from '@tabler/icons-vue';
-import { computed } from 'vue';
+import {
+ IconCalendar,
+ IconCheck,
+ IconChevronDown,
+ IconLayoutGrid,
+ IconLayoutKanban,
+ IconList,
+} from '@tabler/icons-vue';
+import { type Component, computed } from 'vue';
+import { Button } from '@/components/ui/button';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip';
+import { useBelowBreakpoint } from '@/composables/useBreakpoint';
+import { usePublishView } from '@/composables/usePublishView';
+import { filled } from '@/lib/helpers';
import { calendar } from '@/routes/app';
-import { index as postsIndex } from '@/routes/app/posts';
+import { board, index as postsIndex } from '@/routes/app/posts';
+import { PUBLISH_VIEWS, type PublishView } from '@/types/publish';
const props = defineProps<{
- activeView: 'grid' | 'list' | 'calendar';
+ activeView: 'grid' | 'list' | 'calendar' | 'board';
listHref?: string;
calendarHref?: string;
gridHref?: string;
+ boardHref?: string;
}>();
-const views = computed(() => [
- ...(props.gridHref
- ? [
- {
- key: 'grid',
- label: 'channels.grid.title',
- icon: IconLayoutGrid,
- href: props.gridHref,
- note:
- props.activeView === 'grid'
- ? 'channels.grid.info'
- : null,
- },
- ]
- : []),
- {
- key: 'list',
- label: 'posts.list_view',
- icon: IconList,
- href: props.listHref ?? postsIndex.url(),
- note: null,
- },
- {
- key: 'calendar',
- label: 'calendar.title',
- icon: IconCalendar,
- href: props.calendarHref ?? calendar.url({ view: 'week' }),
- note: null,
- },
-]);
+const { rememberPublishView } = usePublishView();
+
+/** On a phone the views are one menu: four icons and the New post button do not fit next to the page's title. */
+const belowSm = useBelowBreakpoint('sm');
+
+/** Picking a view here is the only thing that changes the remembered Publish view; the Instagram grid is not one. */
+const pickView = (key: string): void => {
+ if (PUBLISH_VIEWS.includes(key as PublishView)) {
+ rememberPublishView(key as PublishView);
+ }
+};
+
+interface ScheduleView {
+ key: string;
+ label: string;
+ icon: Component;
+ href: string;
+ note: string | null;
+}
+
+/** The Instagram grid explains itself while it is the open view. */
+const gridNote = (): string | null => {
+ if (props.activeView !== 'grid') {
+ return null;
+ }
+
+ return 'channels.grid.info';
+};
+
+/** The views of the page; the Instagram grid comes first on a channel that has one. */
+const views = computed((): ScheduleView[] => {
+ const publishViews: ScheduleView[] = [
+ {
+ key: 'list',
+ label: 'posts.list_view',
+ icon: IconList,
+ href: props.listHref ?? postsIndex.url(),
+ note: null,
+ },
+ {
+ key: 'calendar',
+ label: 'calendar.title',
+ icon: IconCalendar,
+ href: props.calendarHref ?? calendar.url({ view: 'week' }),
+ note: null,
+ },
+ {
+ key: 'board',
+ label: 'posts.board.view',
+ icon: IconLayoutKanban,
+ href: props.boardHref ?? board.url(),
+ note: null,
+ },
+ ];
+
+ if (!filled(props.gridHref)) {
+ return publishViews;
+ }
+
+ return [
+ {
+ key: 'grid',
+ label: 'channels.grid.title',
+ icon: IconLayoutGrid,
+ href: props.gridHref,
+ note: gridNote(),
+ },
+ ...publishViews,
+ ];
+});
+
+/** The view the page shows, which the phone menu's button carries. */
+const activeViewItem = computed(() => {
+ const active = views.value.find((view) => view.key === props.activeView);
+
+ if (filled(active)) {
+ return active;
+ }
+
+ return views.value[0];
+});
+
+/** The open view's link is the current page for screen readers. */
+const ariaCurrent = (key: string): 'page' | undefined => {
+ if (props.activeView !== key) {
+ return undefined;
+ }
+
+ return 'page';
+};
+
+const isActive = (key: string): boolean => props.activeView === key;
+
+const viewLinkClass = (key: string): string => {
+ if (isActive(key)) {
+ return 'bg-primary-selected text-primary-text';
+ }
+
+ return 'text-foreground hover:bg-accent';
+};
</script>
<template>
- <TooltipProvider :delay-duration="0">
+ <DropdownMenu v-if="belowSm">
+ <DropdownMenuTrigger as-child>
+ <Button
+ variant="outline"
+ size="sm"
+ class="h-8 gap-1 px-2 data-[state=open]:bg-accent"
+ :aria-label="$t('posts.view_switcher')"
+ data-testid="schedule-view-trigger"
+ >
+ <component :is="activeViewItem.icon" class="size-4" />
+ <IconChevronDown class="size-4 text-muted-foreground" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" data-testid="schedule-view-menu">
+ <DropdownMenuItem v-for="view in views" :key="view.key" as-child>
+ <Link
+ :href="view.href"
+ :aria-current="ariaCurrent(view.key)"
+ :data-testid="`schedule-view-${view.key}`"
+ @click="pickView(view.key)"
+ >
+ <component :is="view.icon" class="size-4" />
+ {{ $t(view.label) }}
+ <IconCheck v-if="isActive(view.key)" class="ms-auto size-4" />
+ </Link>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ <TooltipProvider v-else :delay-duration="0">
<nav
class="inline-flex h-8 items-center gap-1 rounded-lg border border-border-strong bg-card p-[3px]"
:aria-label="$t('posts.view_switcher')"
@@ -65,16 +182,11 @@ const views = computed(() => [
<TooltipTrigger as-child>
<Link
:href="view.href"
- :aria-current="
- activeView === view.key ? 'page' : undefined
- "
+ :aria-current="ariaCurrent(view.key)"
:data-testid="`schedule-view-${view.key}`"
+ @click="pickView(view.key)"
class="inline-flex h-6 items-center justify-center gap-1 rounded-md border border-transparent px-2 text-sm font-medium transition-control"
- :class="
- activeView === view.key
- ? 'bg-primary-selected text-primary-text'
- : 'text-foreground hover:bg-accent'
- "
+ :class="viewLinkClass(view.key)"
>
<component :is="view.icon" class="size-4" />
<span class="hidden sm:inline">{{
diff --git a/resources/js/components/posts/composer/PostComposerDialog.vue b/resources/js/components/posts/composer/PostComposerDialog.vue
index bb4b63d06..c458cdf4f 100644
--- a/resources/js/components/posts/composer/PostComposerDialog.vue
+++ b/resources/js/components/posts/composer/PostComposerDialog.vue
@@ -48,6 +48,7 @@ import BottomSheet from '@/components/BottomSheet.vue';
import CharacterCounter from '@/components/CharacterCounter.vue';
import EmptyState from '@/components/EmptyState.vue';
import FilterEmptyState from '@/components/FilterEmptyState.vue';
+import LabelChips from '@/components/labels/LabelChips.vue';
import LabelFilter from '@/components/labels/LabelFilter.vue';
import MediaTray from '@/components/media/MediaTray.vue';
import UnsplashDialog from '@/components/media/UnsplashDialog.vue';
@@ -1023,6 +1024,8 @@ const selectedLabels = computed(() =>
composition.labelIds.value.includes(label.id),
),
);
+
+const hasSelectedLabels = computed(() => filled(selectedLabels.value));
const addLabel = (label: {
id: string;
name: string;
@@ -2353,47 +2356,24 @@ const onDialogOpenChange = (value: boolean): void => {
data-testid="composer-tags-trigger"
>
<IconTag
- v-if="!selectedLabels.length"
- class="size-4"
+ class="size-4 shrink-0"
+ data-testid="composer-tags-icon"
/>
<span
- v-if="!selectedLabels.length"
+ v-if="!hasSelectedLabels"
class="max-sm:sr-only"
>{{
$t('posts.edit.labels')
}}</span>
- <span
+ <LabelChips
v-else
- class="flex min-w-0 items-center gap-1.5 overflow-hidden"
- >
- <span
- v-for="label in selectedLabels.slice(
- 0,
- 2,
- )"
- :key="label.id"
- class="flex min-w-0 items-center gap-1"
- >
- <span
- class="size-2 shrink-0 rounded-full"
- :style="{
- backgroundColor: label.color,
- }"
- />
- <span class="truncate">{{
- label.name
- }}</span>
- </span>
- <span
- v-if="selectedLabels.length > 2"
- class="shrink-0 text-muted-foreground"
- >+{{ selectedLabels.length - 2 }}</span
- >
- </span>
+ :labels="selectedLabels"
+ test-id="composer-tags-chip"
+ />
<IconChevronDown
class="size-4 shrink-0 text-muted-foreground"
:class="{
- 'max-sm:hidden': !selectedLabels.length,
+ 'max-sm:hidden': !hasSelectedLabels,
}"
/>
</Button>
diff --git a/resources/js/components/publish/ApprovePostButton.vue b/resources/js/components/publish/ApprovePostButton.vue
index f7925ed71..5a410686c 100644
--- a/resources/js/components/publish/ApprovePostButton.vue
+++ b/resources/js/components/publish/ApprovePostButton.vue
@@ -1,7 +1,9 @@
<script setup lang="ts">
import { router } from '@inertiajs/vue3';
import { IconCheck, IconSend } from '@tabler/icons-vue';
+import { trans } from 'laravel-vue-i18n';
import { computed, ref } from 'vue';
+import { toast } from 'vue-sonner';
import { approve } from '@/actions/App/Http/Controllers/App/PostApprovalController';
import ComposerSchedulePicker from '@/components/posts/composer/ComposerSchedulePicker.vue';
@@ -11,20 +13,30 @@ import {
PopoverContent,
PopoverTrigger,
} from '@/components/ui/popover';
-import { toastFirstError } from '@/composables/usePostCardActions';
+import {
+ POST_CARD_APPROVAL_RELOAD,
+ toastFirstError,
+ usePostCardReload,
+} from '@/composables/usePostCardActions';
import date from '@/date';
-import dayjs from '@/dayjs';
+import { filled } from '@/lib/helpers';
import { userTimezone } from '@/preferences';
import { ScheduleMode } from '@/types/post';
import type { PostCard } from '@/types/publish';
+type ApprovalPayload = { scheduled_at?: string; publish_now?: true };
+
const props = defineProps<{
post: PostCard;
testKey: string;
}>();
+const reload = usePostCardReload(POST_CARD_APPROVAL_RELOAD);
+
const pickerOpen = ref(false);
+const approving = ref(false);
+
const closePicker = (): void => {
pickerOpen.value = false;
};
@@ -37,37 +49,68 @@ const postTimezone = computed(
() => props.post.social_account?.timezone ?? userTimezone.value,
);
-const needsTime = computed(
- () =>
- !isQueued.value &&
- (!props.post.scheduled_at ||
- dayjs(props.post.scheduled_at).isBefore(dayjs())),
-);
+/** A custom-time post without a time still to come asks for one before it is approved. */
+const needsTime = computed((): boolean => {
+ if (isQueued.value) {
+ return false;
+ }
+
+ const scheduledAt = props.post.scheduled_at;
-const labelKey = computed(() => {
- if (needsTime.value) {
- return 'posts.approvals.approve';
+ if (!filled(scheduledAt)) {
+ return true;
}
- return isQueued.value
- ? 'posts.publish.actions.add_to_queue'
- : 'posts.approvals.schedule';
+ return date.hasPassed(scheduledAt);
});
-const send = (payload: { scheduled_at?: string; publish_now?: true }): void => {
+/** Approving a post as it was asked for: into the queue, or at its time. */
+const asRequested = computed(() => {
+ if (isQueued.value) {
+ return {
+ labelKey: 'posts.publish.actions.add_to_queue',
+ toastKey: 'posts.approvals.toasts.queued',
+ };
+ }
+
+ return {
+ labelKey: 'posts.approvals.schedule',
+ toastKey: 'posts.approvals.toasts.scheduled',
+ };
+});
+
+/** Sends the approval and toasts what it did, named after the button the approver clicked. */
+const send = (payload: ApprovalPayload, toastKey: string): void => {
router.put(approve.url(props.post.id), payload, {
- only: ['posts', 'counts', 'queue', 'hasData'],
- reset: ['posts'],
+ ...reload(),
preserveScroll: true,
+ onStart: () => {
+ approving.value = true;
+ },
+ onFinish: () => {
+ approving.value = false;
+ },
onSuccess: () => {
- pickerOpen.value = false;
+ closePicker();
+ toast.success(trans(toastKey), { testId: 'post-approval-toast' });
},
onError: toastFirstError,
});
};
-const confirmTime = (value: string): void => {
- send({ scheduled_at: date.wallClockToUtc(value, postTimezone.value) });
+const approveAsRequested = (): void => {
+ send({}, asRequested.value.toastKey);
+};
+
+const approveAt = (value: string): void => {
+ send(
+ { scheduled_at: date.wallClockToUtc(value, postTimezone.value) },
+ 'posts.approvals.toasts.scheduled',
+ );
+};
+
+const publishNow = (): void => {
+ send({ publish_now: true }, 'posts.approvals.toasts.publishing');
};
</script>
@@ -76,11 +119,11 @@ const confirmTime = (value: string): void => {
<PopoverTrigger as-child>
<Button
variant="outline"
- class="text-success-text"
+ :loading="approving"
:data-testid="`post-approve-${testKey}`"
>
- <IconCheck class="size-4" />
- {{ $t(labelKey) }}
+ <IconCheck class="-mx-0.5 size-4 text-success-text" stroke-width="2.25" />
+ {{ $t('posts.approvals.approve') }}
</Button>
</PopoverTrigger>
<PopoverContent
@@ -93,14 +136,15 @@ const confirmTime = (value: string): void => {
model-value=""
:timezone="postTimezone"
@back="closePicker"
- @confirm="confirmTime"
+ @confirm="approveAt"
/>
<div class="border-t border-border-strong p-3">
<Button
variant="outline"
class="w-full"
+ :loading="approving"
:data-testid="`post-approve-publish-now-${testKey}`"
- @click="send({ publish_now: true })"
+ @click="publishNow"
>
<IconSend class="size-4" />
{{ $t('posts.publish.actions.publish_now') }}
@@ -111,11 +155,11 @@ const confirmTime = (value: string): void => {
<Button
v-else
variant="outline"
- class="text-success-text"
+ :loading="approving"
:data-testid="`post-approve-${testKey}`"
- @click="send({})"
+ @click="approveAsRequested"
>
- <IconCheck class="size-4" />
- {{ $t(labelKey) }}
+ <IconCheck class="-mx-0.5 size-4 text-success-text" stroke-width="2.25" />
+ {{ $t(asRequested.labelKey) }}
</Button>
</template>
diff --git a/resources/js/components/publish/CalendarPostChip.vue b/resources/js/components/publish/CalendarPostChip.vue
index 626467708..fd638055f 100644
--- a/resources/js/components/publish/CalendarPostChip.vue
+++ b/resources/js/components/publish/CalendarPostChip.vue
@@ -11,24 +11,27 @@ import {
IconSend,
IconTrashX,
} from '@tabler/icons-vue';
-import { computed, nextTick, ref, type Component } from 'vue';
+import { computed, type Component } from 'vue';
import PlatformBrandIcon from '@/components/PlatformBrandIcon.vue';
-import PostTimelineCard from '@/components/publish/PostTimelineCard.vue';
+import PostDetailsDialog from '@/components/publish/PostDetailsDialog.vue';
+import PostRecurrenceDialog from '@/components/publish/PostRecurrenceDialog.vue';
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from '@/components/ui/tooltip';
import { useCalendarDragContext } from '@/composables/calendar/useCalendarDrag';
-import { getPlatformLabel } from '@/composables/usePlatformLogo';
+import { usePostCardMenuActions } from '@/composables/publish/usePostCardMenuActions';
+import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import date from '@/date';
-import { isImage, isVideo } from '@/lib/mediaType';
+import { isImage } from '@/lib/mediaType';
+import { postChannelLabel, postThumbnail } from '@/lib/postCard';
import { isDeletedOnNetwork } from '@/lib/postNetwork';
import { htmlToPlainText } from '@/lib/utils';
import { videoFrameUrl } from '@/lib/videoFrame';
import { PostStatus, ScheduleMode } from '@/types/post';
-import type { CalendarPost, PublishTab } from '@/types/publish';
+import type { CalendarPost } from '@/types/publish';
defineOptions({ inheritAttrs: false });
@@ -42,44 +45,28 @@ const { draggingPostId, vCalendarPost } = useCalendarDragContext();
const isDragging = computed(() => draggingPostId.value === props.post.id);
-const card = ref<InstanceType<typeof PostTimelineCard> | null>(null);
-const cardMounted = ref(false);
+const { canCreatePost } = useWorkspaceAbilities();
/**
- * A click opens the post's details. The card that holds the details dialog
- * mounts on the first click only, so a busy calendar doesn't mount one per chip.
+ * A click opens the post's details. The details dialog (and the recurrence
+ * dialog its menu opens) mounts on the first click only, so a busy calendar
+ * doesn't mount them per chip.
*/
-const openDetails = async (): Promise<void> => {
- cardMounted.value = true;
- await nextTick();
- card.value?.openDetails();
-};
-
-const SENT_STATUSES: readonly string[] = [
- PostStatus.Published,
- PostStatus.Failed,
-];
-
-const tab = computed((): PublishTab => {
- if (SENT_STATUSES.includes(props.post.status)) {
- return 'sent';
- }
-
- if (props.post.status === PostStatus.Draft) {
- return 'drafts';
- }
-
- return props.post.status === PostStatus.PendingApproval
- ? 'approvals'
- : 'queue';
+const {
+ dialogsMounted,
+ detailsOpen,
+ recurrenceOpen,
+ recurrenceTarget,
+ recurrenceTimezone,
+ openDetails,
+ edit,
+ runPostAction,
+} = usePostCardMenuActions(() => props.post, {
+ timezone: () => props.timezone,
+ lazy: true,
});
-const channels = computed(() =>
- props.post.platform
- ? (props.post.social_account?.display_label ??
- getPlatformLabel(props.post.platform))
- : '',
-);
+const channels = computed(() => postChannelLabel(props.post));
const time = computed(() =>
date.formatTimeInTimezone(props.post.calendar_at, props.timezone),
@@ -87,12 +74,7 @@ const time = computed(() =>
const text = computed(() => htmlToPlainText(props.post.content ?? ''));
-const thumbnail = computed(
- () =>
- (props.post.media ?? []).find(
- (item) => isImage(item) || isVideo(item),
- ) ?? null,
-);
+const thumbnail = computed(() => postThumbnail(props.post));
type StatusKey =
| 'draft'
@@ -237,14 +219,21 @@ const chipClass = computed(() => [
</template>
</span>
</button>
- <div v-if="cardMounted" hidden>
- <PostTimelineCard
- ref="card"
+ <template v-if="canCreatePost && dialogsMounted">
+ <PostDetailsDialog
+ v-model:open="detailsOpen"
:post="post"
- :tab="tab"
- :display-timezone="timezone"
- :movable="false"
+ :test-key="post.id"
+ :timezone="timezone"
+ @select="runPostAction"
+ @edit="edit"
+ />
+ <PostRecurrenceDialog
+ v-model:open="recurrenceOpen"
+ :post="recurrenceTarget"
+ :test-key="post.id"
+ :timezone="recurrenceTimezone"
/>
- </div>
+ </template>
</div>
</template>
diff --git a/resources/js/components/publish/GoalProgress.vue b/resources/js/components/publish/GoalProgress.vue
index 41f436e5a..3746fcae4 100644
--- a/resources/js/components/publish/GoalProgress.vue
+++ b/resources/js/components/publish/GoalProgress.vue
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { Link } from '@inertiajs/vue3';
import { IconPencil } from '@tabler/icons-vue';
+import { createReusableTemplate } from '@vueuse/core';
import { computed } from 'vue';
import { Button } from '@/components/ui/button';
@@ -11,12 +12,20 @@ import {
} from '@/components/ui/popover';
import { settings } from '@/routes/app/channels';
-const props = defineProps<{
- channelId: string;
- sent: number;
- scheduled: number;
- goal: number;
-}>();
+const props = withDefaults(
+ defineProps<{
+ channelId: string;
+ sent: number;
+ scheduled: number;
+ goal: number;
+ testId?: string;
+ /** Off where another control already opens the channel settings (the channels list): the progress shows, without its popover. */
+ interactive?: boolean;
+ }>(),
+ { testId: 'publish-goal', interactive: true },
+);
+
+const [DefineSummary, ReuseSummary] = createReusableTemplate();
const percent = computed(() =>
Math.min(100, Math.round((props.sent / Math.max(props.goal, 1)) * 100)),
@@ -28,18 +37,13 @@ const toDo = computed(() =>
</script>
<template>
- <Popover>
- <PopoverTrigger as-child>
- <button
- type="button"
- class="flex max-w-full min-w-0 items-center gap-1 rounded-md text-sm text-muted-foreground transition-control hover:text-foreground data-[state=open]:text-foreground"
- data-testid="publish-goal-progress"
- >
+ <span class="contents">
+ <DefineSummary>
<svg
viewBox="0 0 14 14"
class="size-3.5 shrink-0 -rotate-90"
aria-hidden="true"
- data-testid="publish-goal-pie"
+ :data-testid="`${testId}-pie`"
:data-percent="percent"
>
<circle
@@ -62,70 +66,88 @@ const toDo = computed(() =>
class="stroke-success"
/>
</svg>
- <span class="truncate">{{
- $t('posts.publish.goal', {
- sent: String(sent),
- goal: String(goal),
- })
- }}</span>
- </button>
- </PopoverTrigger>
- <PopoverContent
- align="start"
- class="w-auto min-w-64 p-0"
- data-testid="publish-goal-popover"
+ <span class="truncate">{{
+ $t('posts.publish.goal', {
+ sent: String(sent),
+ goal: String(goal),
+ })
+ }}</span>
+ </DefineSummary>
+
+ <span
+ v-if="!interactive"
+ class="flex max-w-full min-w-0 items-center gap-1 text-sm text-muted-foreground"
+ :data-testid="`${testId}-progress`"
>
- <div class="flex items-start justify-between gap-4 px-4 py-3">
- <div class="min-w-0">
- <p class="text-xs text-muted-foreground">
- {{ $t('posts.publish.goal_popover.title') }}
- </p>
- <p class="text-sm font-emphasis text-foreground">
- {{
- $tChoice(
- 'posts.publish.goal_popover.per_week',
- goal,
- { count: String(goal) },
- )
- }}
- </p>
- </div>
- <Button
- as-child
- variant="ghost"
- size="icon-sm"
- class="shrink-0"
+ <ReuseSummary />
+ </span>
+ <Popover v-else>
+ <PopoverTrigger as-child>
+ <button
+ type="button"
+ class="flex max-w-full min-w-0 items-center gap-1 rounded-md text-sm text-muted-foreground transition-control hover:text-foreground data-[state=open]:text-foreground"
+ :data-testid="`${testId}-progress`"
>
- <Link
- :href="settings.url(channelId)"
- :aria-label="$t('posts.publish.goal_popover.edit')"
- data-testid="publish-goal-edit"
- >
- <IconPencil class="size-4" />
- </Link>
- </Button>
- </div>
- <div
- class="flex items-center gap-2 border-t border-border px-4 py-3 text-sm whitespace-nowrap text-muted-foreground"
- data-testid="publish-goal-summary"
+ <ReuseSummary />
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ align="start"
+ class="w-auto min-w-64 p-0"
+ :data-testid="`${testId}-popover`"
>
- <span
- ><span class="font-emphasis text-foreground">{{ sent }}</span>
- {{ $t('posts.publish.goal_popover.sent') }}</span
- >
- <span aria-hidden="true">·</span>
- <span
- ><span class="font-emphasis text-foreground">{{
- scheduled
- }}</span>
- {{ $t('posts.publish.goal_popover.scheduled') }}</span
- >
- <span aria-hidden="true">·</span>
- <span
- ><span class="font-emphasis text-foreground">{{ toDo }}</span>
- {{ $t('posts.publish.goal_popover.to_do') }}</span
+ <div class="flex items-start justify-between gap-4 px-4 py-3">
+ <div class="min-w-0">
+ <p class="text-xs text-muted-foreground">
+ {{ $t('posts.publish.goal_popover.title') }}
+ </p>
+ <p class="text-sm font-emphasis text-foreground">
+ {{
+ $tChoice(
+ 'posts.publish.goal_popover.per_week',
+ goal,
+ { count: String(goal) },
+ )
+ }}
+ </p>
+ </div>
+ <Button
+ as-child
+ variant="ghost"
+ size="icon-sm"
+ class="shrink-0"
+ >
+ <Link
+ :href="settings.url(channelId)"
+ :aria-label="$t('posts.publish.goal_popover.edit')"
+ :data-testid="`${testId}-edit`"
+ >
+ <IconPencil class="size-4" />
+ </Link>
+ </Button>
+ </div>
+ <div
+ class="flex items-center gap-2 border-t border-border px-4 py-3 text-sm whitespace-nowrap text-muted-foreground"
+ :data-testid="`${testId}-summary`"
>
- </div>
- </PopoverContent>
- </Popover>
+ <span
+ ><span class="font-emphasis text-foreground">{{ sent }}</span>
+ {{ $t('posts.publish.goal_popover.sent') }}</span
+ >
+ <span aria-hidden="true">·</span>
+ <span
+ ><span class="font-emphasis text-foreground">{{
+ scheduled
+ }}</span>
+ {{ $t('posts.publish.goal_popover.scheduled') }}</span
+ >
+ <span aria-hidden="true">·</span>
+ <span
+ ><span class="font-emphasis text-foreground">{{ toDo }}</span>
+ {{ $t('posts.publish.goal_popover.to_do') }}</span
+ >
+ </div>
+ </PopoverContent>
+ </Popover>
+ </span>
</template>
diff --git a/resources/js/components/publish/PostApprovalActions.vue b/resources/js/components/publish/PostApprovalActions.vue
new file mode 100644
index 000000000..d4d7b9a2a
--- /dev/null
+++ b/resources/js/components/publish/PostApprovalActions.vue
@@ -0,0 +1,104 @@
+<script setup lang="ts">
+import { router } from '@inertiajs/vue3';
+import { IconX } from '@tabler/icons-vue';
+import { trans } from 'laravel-vue-i18n';
+import { ref } from 'vue';
+import { toast } from 'vue-sonner';
+
+import { reject as rejectPostRoute } from '@/actions/App/Http/Controllers/App/PostApprovalController';
+import ApprovePostButton from '@/components/publish/ApprovePostButton.vue';
+import { Button } from '@/components/ui/button';
+import {
+ POST_CARD_APPROVAL_RELOAD,
+ schedulePostCard,
+ toastFirstError,
+ usePostCardReload,
+} from '@/composables/usePostCardActions';
+import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import type { PostCard } from '@/types/publish';
+
+/**
+ * What a post pending approval offers on its card: approve and reject for an
+ * approver, take the request back for the member who asked.
+ */
+const props = defineProps<{
+ post: PostCard;
+ testKey: string;
+}>();
+
+const { canApprove } = useWorkspaceAbilities();
+
+const approvalReload = usePostCardReload(POST_CARD_APPROVAL_RELOAD);
+
+const rejecting = ref(false);
+
+const reverting = ref(false);
+
+const rejectPost = (): void => {
+ router.put(
+ rejectPostRoute.url(props.post.id),
+ {},
+ {
+ ...approvalReload(),
+ preserveScroll: true,
+ onStart: () => {
+ rejecting.value = true;
+ },
+ onFinish: () => {
+ rejecting.value = false;
+ },
+ onSuccess: () => {
+ toast.success(trans('posts.approvals.toasts.rejected'), {
+ testId: 'post-approval-toast',
+ });
+ },
+ onError: toastFirstError,
+ },
+ );
+};
+
+const revertRequest = (): void => {
+ schedulePostCard(props.post.id, 'draft', {
+ ...approvalReload(),
+ onStart: () => {
+ reverting.value = true;
+ },
+ onFinish: () => {
+ reverting.value = false;
+ },
+ });
+};
+</script>
+
+<template>
+ <div class="contents">
+ <template v-if="canApprove">
+ <ApprovePostButton :post="post" :test-key="testKey" />
+ <Button
+ variant="outline"
+ :loading="rejecting"
+ :data-testid="`post-reject-${testKey}`"
+ @click="rejectPost"
+ >
+ <IconX
+ class="-mx-0.5 size-4 text-destructive-text"
+ stroke-width="2.25"
+ />
+ {{ $t('posts.approvals.reject') }}
+ </Button>
+ </template>
+ <Button
+ v-else
+ variant="outline"
+ :loading="reverting"
+ :data-testid="`post-revert-${testKey}`"
+ @click="revertRequest"
+ >
+ <IconX
+ class="-mx-0.5 size-4 text-muted-foreground"
+ stroke-width="2.25"
+ />
+ {{ $t('posts.approvals.revert') }}
+ </Button>
+ </div>
+</template>
diff --git a/resources/js/components/publish/PostCardLabels.vue b/resources/js/components/publish/PostCardLabels.vue
index ab161b78c..a3c9a78de 100644
--- a/resources/js/components/publish/PostCardLabels.vue
+++ b/resources/js/components/publish/PostCardLabels.vue
@@ -5,8 +5,10 @@ import { computed, inject, ref, watch } from 'vue';
import LabelBadge from '@/components/labels/LabelBadge.vue';
import LabelFilter from '@/components/labels/LabelFilter.vue';
import {
+ POST_CARD_LABELS_RELOAD,
postCardLabelsKey,
syncPostCardLabels,
+ usePostCardReload,
} from '@/composables/usePostCardActions';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import type { PostCardLabel } from '@/types/publish';
@@ -25,6 +27,8 @@ const workspaceLabels = inject(
computed(() => []),
);
+const reload = usePostCardReload(POST_CARD_LABELS_RELOAD);
+
const toIds = (labels: PostCardLabel[]): string[] =>
labels.map((label) => label.id);
@@ -59,9 +63,14 @@ const update = (ids: string[]): void => {
const previous = selectedIds.value;
selectedIds.value = ids;
- syncPostCardLabels(props.postId, ids, () => {
- selectedIds.value = previous;
- });
+ syncPostCardLabels(
+ props.postId,
+ ids,
+ () => {
+ selectedIds.value = previous;
+ },
+ reload(),
+ );
};
</script>
diff --git a/resources/js/components/publish/PostCardMenu.vue b/resources/js/components/publish/PostCardMenu.vue
index e8b4fecee..e8b7edde2 100644
--- a/resources/js/components/publish/PostCardMenu.vue
+++ b/resources/js/components/publish/PostCardMenu.vue
@@ -25,6 +25,7 @@ import {
} from '@/components/ui/dropdown-menu';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import { filled } from '@/lib/helpers';
import { postPermalink } from '@/lib/postNetwork';
import { isRecurring } from '@/lib/recurrence';
import { PostStatus } from '@/types/post';
@@ -39,6 +40,7 @@ const props = withDefaults(
canMoveDown?: boolean;
movable?: boolean;
details?: boolean;
+ triggerTestId?: string | null;
}>(),
{
canMoveToTop: false,
@@ -46,6 +48,7 @@ const props = withDefaults(
canMoveDown: false,
movable: true,
details: true,
+ triggerTestId: null,
},
);
@@ -53,6 +56,15 @@ const emit = defineEmits<{ select: [action: PostCardMenuAction] }>();
const { canPublishDirectly } = useWorkspaceAbilities();
+/** The menu button's test id: the one its card names (the board's), else the list's. */
+const menuTriggerTestId = computed((): string => {
+ if (filled(props.triggerTestId)) {
+ return props.triggerTestId;
+ }
+
+ return `post-card-menu-${props.testKey}`;
+});
+
const isScheduled = computed(
() => props.post.status === PostStatus.Scheduled,
);
@@ -79,7 +91,7 @@ const isMovable = computed(
size="icon"
class="data-[state=open]:bg-accent"
:aria-label="$t('posts.publish.actions.more')"
- :data-testid="`post-card-menu-${testKey}`"
+ :data-testid="menuTriggerTestId"
>
<IconDotsVertical class="size-4" />
</Button>
diff --git a/resources/js/components/publish/PostDeletedOnNetworkBadge.vue b/resources/js/components/publish/PostDeletedOnNetworkBadge.vue
deleted file mode 100644
index dd5a23555..000000000
--- a/resources/js/components/publish/PostDeletedOnNetworkBadge.vue
+++ /dev/null
@@ -1,13 +0,0 @@
-<script setup lang="ts">
-import { Badge } from '@/components/ui/badge';
-import { getDeletedOnNetworkStatusConfig } from '@/composables/usePostStatus';
-
-const status = getDeletedOnNetworkStatusConfig();
-</script>
-
-<template>
- <Badge :variant="status.variant" class="h-6 gap-1 px-2 [&>svg]:size-4">
- <component :is="status.icon" />
- {{ status.label }}
- </Badge>
-</template>
diff --git a/resources/js/components/publish/PostDeletedOnNetworkPopover.vue b/resources/js/components/publish/PostDeletedOnNetworkPopover.vue
index 383c769ce..6d6109a6c 100644
--- a/resources/js/components/publish/PostDeletedOnNetworkPopover.vue
+++ b/resources/js/components/publish/PostDeletedOnNetworkPopover.vue
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed } from 'vue';
-import PostDeletedOnNetworkBadge from '@/components/publish/PostDeletedOnNetworkBadge.vue';
+import PostStatusBadge from '@/components/publish/PostStatusBadge.vue';
import {
Popover,
PopoverContent,
@@ -32,7 +32,10 @@ const network = computed(() =>
"
:data-testid="`post-deleted-on-network-${testKey}`"
>
- <PostDeletedOnNetworkBadge class="cursor-pointer" />
+ <PostStatusBadge
+ status="deleted_on_network"
+ class="cursor-pointer"
+ />
</button>
</PopoverTrigger>
<PopoverContent
diff --git a/resources/js/components/publish/PostDetailsDialog.vue b/resources/js/components/publish/PostDetailsDialog.vue
index 6fa4d9c36..6196e6f51 100644
--- a/resources/js/components/publish/PostDetailsDialog.vue
+++ b/resources/js/components/publish/PostDetailsDialog.vue
@@ -16,12 +16,11 @@ import PlatformBrandIcon from '@/components/PlatformBrandIcon.vue';
import ThreadView from '@/components/posts/ThreadView.vue';
import PostCardLabels from '@/components/publish/PostCardLabels.vue';
import PostCardMenu from '@/components/publish/PostCardMenu.vue';
-import PostDeletedOnNetworkBadge from '@/components/publish/PostDeletedOnNetworkBadge.vue';
import PostDetailsMedia from '@/components/publish/PostDetailsMedia.vue';
import PostMetricsBand from '@/components/publish/PostMetricsBand.vue';
import PostPollResults from '@/components/publish/PostPollResults.vue';
import PostPollResultsList from '@/components/publish/PostPollResultsList.vue';
-import { Badge } from '@/components/ui/badge';
+import PostStatusBadge from '@/components/publish/PostStatusBadge.vue';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -38,10 +37,11 @@ import {
} from '@/composables/usePlatformLogo';
import {
schedulePostCard,
+ usePageReload,
} from '@/composables/usePostCardActions';
import {
- getPostCardStatusConfig,
getPostStatusConfig,
+ postDisplayStatus,
} from '@/composables/usePostStatus';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import date from '@/date';
@@ -54,7 +54,7 @@ import { isRecurring } from '@/lib/recurrence';
import { postPollResults } from '@/lib/xPoll';
import type { MediaItem } from '@/types/media';
import { Platform } from '@/types/platform';
-import { PostOrigin, PostStatus, PublishStatus } from '@/types/post';
+import { PostOrigin, PostStatus } from '@/types/post';
import type { PostCard, PostCardMenuAction } from '@/types/publish';
const props = defineProps<{
@@ -127,30 +127,25 @@ const current = computed<PostCard>(() =>
props.post),
);
-const isInGoogleReview = computed(
- () =>
- current.value.status === PostStatus.Publishing &&
- current.value.publish_status === PublishStatus.PendingReview,
-);
-
-const currentStatusConfig = computed(() =>
- getPostStatusConfig(
- isInGoogleReview.value
- ? PublishStatus.PendingReview
- : current.value.status,
- ),
-);
+const currentStatus = computed(() => postDisplayStatus(current.value));
/** Each sibling's status in the rail; a post the network deleted reads as deleted. */
const railStatuses = computed(() =>
Object.fromEntries(
siblings.value.map((sibling) => [
sibling.id,
- getPostCardStatusConfig(sibling),
+ getPostStatusConfig(postDisplayStatus(sibling)),
]),
),
);
+const pageReload = usePageReload();
+
+/** Publishing from the details reloads what the page asks for (the board's columns), like the card's menu. */
+const publishCurrentNow = (): void => {
+ schedulePostCard(current.value.id, 'publish_now', pageReload());
+};
+
const currentKey = computed(() =>
current.value.id === props.post.id ? props.testKey : current.value.id,
);
@@ -325,7 +320,7 @@ const siblingMoment = (sibling: PostCard): string | null => {
:is="railStatuses[sibling.id].icon"
:class="railStatuses[sibling.id].iconClass"
class="size-3.5 shrink-0"
- :aria-label="railStatuses[sibling.id].label"
+ :aria-label="$t(railStatuses[sibling.id].labelKey)"
:data-testid="`post-details-rail-status-icon-${sibling.id}`"
/>
{{
@@ -356,26 +351,16 @@ const siblingMoment = (sibling: PostCard): string | null => {
class="flex flex-wrap items-center gap-2"
as="div"
>
- <PostDeletedOnNetworkBadge
+ <PostStatusBadge
v-if="isDeletedOnNetwork(current)"
+ status="deleted_on_network"
:data-testid="`post-details-deleted-on-network-${testKey}`"
/>
- <Badge
+ <PostStatusBadge
v-else
- :variant="currentStatusConfig.variant"
- class="h-6 gap-1 px-2 [&>svg]:size-4"
+ :status="currentStatus"
:data-testid="`post-details-status-${testKey}`"
- >
- <component
- :is="currentStatusConfig.icon"
- :class="currentStatusConfig.iconClass"
- />
- {{
- isInGoogleReview
- ? $t('posts.publish.in_google_review')
- : $t(`posts.status.${current.status}`)
- }}
- </Badge>
+ />
<span
class="text-sm text-muted-foreground"
:data-testid="`post-details-time-${testKey}`"
@@ -585,7 +570,7 @@ const siblingMoment = (sibling: PostCard): string | null => {
"
variant="outline"
:data-testid="`post-details-publish-now-${currentKey}`"
- @click="schedulePostCard(current.id, 'publish_now')"
+ @click="publishCurrentNow"
>
<IconSend class="size-4" />
{{ $t('posts.publish.actions.publish_now') }}
diff --git a/resources/js/components/publish/PostFailurePopover.vue b/resources/js/components/publish/PostFailurePopover.vue
index efee4118b..3d4f6da30 100644
--- a/resources/js/components/publish/PostFailurePopover.vue
+++ b/resources/js/components/publish/PostFailurePopover.vue
@@ -2,14 +2,13 @@
import { computed } from 'vue';
import PlatformBrandIcon from '@/components/PlatformBrandIcon.vue';
-import { Badge } from '@/components/ui/badge';
+import PostStatusBadge from '@/components/publish/PostStatusBadge.vue';
import {
Popover,
PopoverContent,
PopoverTrigger,
} from '@/components/ui/popover';
import { getPlatformLabel } from '@/composables/usePlatformLogo';
-import { getPostStatusConfig } from '@/composables/usePostStatus';
import date from '@/date';
import { PublishStatus } from '@/types/post';
import type { PostCard } from '@/types/publish';
@@ -33,7 +32,6 @@ const CATEGORIES = [
'job_failed',
];
-const status = computed(() => getPostStatusConfig(props.post.status));
const failure = computed(() => {
const post = props.post;
@@ -70,13 +68,7 @@ const failure = computed(() => {
:aria-label="$t('posts.publish.failure.title')"
:data-testid="`post-status-${testKey}`"
>
- <Badge
- :variant="status.variant"
- class="h-6 cursor-pointer gap-1 px-2 [&>svg]:size-4"
- >
- <component :is="status.icon" />
- {{ $t(`posts.status.${post.status}`) }}
- </Badge>
+ <PostStatusBadge :status="post.status" class="cursor-pointer" />
</button>
</PopoverTrigger>
<PopoverContent
diff --git a/resources/js/components/publish/PostStatusBadge.vue b/resources/js/components/publish/PostStatusBadge.vue
new file mode 100644
index 000000000..cfe8e7e43
--- /dev/null
+++ b/resources/js/components/publish/PostStatusBadge.vue
@@ -0,0 +1,43 @@
+<script setup lang="ts">
+import { computed } from 'vue';
+
+import { Badge } from '@/components/ui/badge';
+import {
+ getPostStatusConfig,
+ type PostDisplayStatus,
+} from '@/composables/usePostStatus';
+
+/**
+ * A post's status as a badge: its color, icon and short label come from
+ * `usePostStatus`. `compact` is the smaller badge of a dense card (the board);
+ * the label is the same at both sizes.
+ */
+const props = withDefaults(
+ defineProps<{
+ status: PostDisplayStatus;
+ compact?: boolean;
+ }>(),
+ { compact: false },
+);
+
+const config = computed(() => getPostStatusConfig(props.status));
+
+const sizeClass = computed((): string => {
+ if (props.compact) {
+ return 'h-5 gap-1 px-1.5 [&>svg]:size-3.5';
+ }
+
+ return 'h-6 gap-1 px-2 [&>svg]:size-4';
+});
+</script>
+
+<template>
+ <Badge :variant="config.variant" :class="sizeClass">
+ <component
+ :is="config.icon"
+ :class="config.iconClass"
+ aria-hidden="true"
+ />
+ {{ $t(config.labelKey) }}
+ </Badge>
+</template>
diff --git a/resources/js/components/publish/PostTimelineCard.vue b/resources/js/components/publish/PostTimelineCard.vue
index bdfeb97a6..b5622838a 100644
--- a/resources/js/components/publish/PostTimelineCard.vue
+++ b/resources/js/components/publish/PostTimelineCard.vue
@@ -4,7 +4,6 @@ import {
IconArrowsMaximize,
IconCircleDashedPlus,
IconCirclePlay,
- IconEdit,
IconExternalLink,
IconGhost2,
IconMessageCircle,
@@ -18,19 +17,16 @@ import {
IconPlayerPlayFilled,
IconRepeat,
IconSend,
- IconX,
} from '@tabler/icons-vue';
-import { type Component, computed, inject, ref, watch } from 'vue';
+import { type Component, computed, ref, watch } from 'vue';
-import { reject as rejectPostRoute } from '@/actions/App/Http/Controllers/App/PostApprovalController';
-import { edit as editPostRoute } from '@/actions/App/Http/Controllers/App/PostController';
import ChannelAvatar from '@/components/ChannelAvatar.vue';
import MediaLightbox from '@/components/media/MediaLightbox.vue';
import PlatformBrandIcon from '@/components/PlatformBrandIcon.vue';
import PostNotesPanel from '@/components/posts/editor/PostNotesPanel.vue';
import PostScheduleModeBadge from '@/components/posts/PostScheduleModeBadge.vue';
import AddToQueueButton from '@/components/publish/AddToQueueButton.vue';
-import ApprovePostButton from '@/components/publish/ApprovePostButton.vue';
+import PostApprovalActions from '@/components/publish/PostApprovalActions.vue';
import PostCardLabels from '@/components/publish/PostCardLabels.vue';
import PostCardMenu from '@/components/publish/PostCardMenu.vue';
import PostCardThread from '@/components/publish/PostCardThread.vue';
@@ -41,6 +37,7 @@ import PostMetricsBand from '@/components/publish/PostMetricsBand.vue';
import PostPollResultsList from '@/components/publish/PostPollResultsList.vue';
import PostRecurrenceDialog from '@/components/publish/PostRecurrenceDialog.vue';
import PostRecurrenceSummary from '@/components/publish/PostRecurrenceSummary.vue';
+import PostStatusBadge from '@/components/publish/PostStatusBadge.vue';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import {
@@ -54,26 +51,18 @@ import {
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip';
+import { usePostCardMenuActions } from '@/composables/publish/usePostCardMenuActions';
import { useDisplayTimezone } from '@/composables/useDisplayTimezone';
import {
getContentTypeBadgeKey,
getPlatformLabel,
} from '@/composables/usePlatformLogo';
-import {
- deletePostCardKey,
- copyPostCardLink,
- duplicatePostCard,
- editPostCardUrlKey,
- schedulePostCard,
- sharePostCardLink,
- toastFirstError,
-} from '@/composables/usePostCardActions';
-import { getPostStatusConfig } from '@/composables/usePostStatus';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import date from '@/date';
import dayjs from '@/dayjs';
import { blank, filled } from '@/lib/helpers';
import { isImage, isVideo } from '@/lib/mediaType';
+import { postAttemptAt, postNoTimeKey } from '@/lib/postCard';
import { isDeletedOnNetwork, postPermalink } from '@/lib/postNetwork';
import { postThreadOf } from '@/lib/postThread';
import { compactPublicationMetrics } from '@/lib/publicationMetrics';
@@ -124,12 +113,7 @@ const emit = defineEmits<{
const MAX_THUMBNAILS = 4;
const page = usePage();
-const { canApprove, canCreatePost, canPublishDirectly } =
- useWorkspaceAbilities();
-const deletePost = inject(deletePostCardKey, () => {});
-const editUrl = inject(editPostCardUrlKey, (post: PostCard) =>
- editPostRoute.url(post.id),
-);
+const { canCreatePost, canPublishDirectly } = useWorkspaceAbilities();
const { timezone, formatTime } = useDisplayTimezone(props.displayTimezone, []);
watch(
@@ -151,9 +135,6 @@ const highlightNoteId = computed(() =>
const platform = computed(() => props.post.platform ?? null);
const account = computed(() => props.post.social_account ?? null);
-const recurrenceTimezone = computed(
- () => account.value?.timezone ?? timezone.value,
-);
const isPublishing = computed(
() => props.post.status === PostStatus.Publishing,
@@ -165,16 +146,30 @@ const isInGoogleReview = computed(
props.post.publish_status === PublishStatus.PendingReview,
);
+/** How the post was timed: on Sent for every post (one imported from the network counts as custom), elsewhere only while it waits to go out. */
const scheduleMode = computed(() => {
- if (props.post.origin === PostOrigin.Network) {
- return props.tab === 'sent' ? ScheduleMode.Custom : null;
+ const imported = props.post.origin === PostOrigin.Network;
+
+ if (props.tab === 'sent' && imported) {
+ return ScheduleMode.Custom;
+ }
+
+ if (props.tab === 'sent') {
+ return props.post.schedule_mode;
}
- return props.tab === 'sent' ||
+ if (imported) {
+ return null;
+ }
+
+ if (
props.post.status === PostStatus.Scheduled ||
props.post.status === PostStatus.PendingApproval
- ? props.post.schedule_mode
- : null;
+ ) {
+ return props.post.schedule_mode;
+ }
+
+ return null;
});
const showNotes = computed(() => !isPublishing.value);
@@ -215,11 +210,7 @@ const setNoteCount = (count: number): void => {
const time = computed(() => {
if (props.tab === 'sent') {
- return (
- props.post.published_at ??
- props.post.scheduled_at ??
- props.post.created_at
- );
+ return postAttemptAt(props.post);
}
return isPublishing.value
@@ -237,16 +228,7 @@ const isPending = computed(
() => props.post.status === PostStatus.PendingApproval,
);
-/** What a post without a time shows: the queue slot its approval request asks for, else "No time". */
-const noTimeKey = computed((): string => {
- const slot = props.post.approval_queue_position;
-
- if (isPending.value && slot) {
- return `posts.publish.pending_slot.${slot}`;
- }
-
- return 'posts.publish.no_time';
-});
+const noTimeKey = computed(() => postNoTimeKey(props.post));
const isEditable = computed(
() =>
@@ -352,43 +334,28 @@ const showStatus = computed(
const hasFailure = computed(() => props.post.status === PostStatus.Failed);
-const APPROVAL_RELOAD = {
- only: ['posts', 'counts', 'queue', 'hasData'],
- reset: ['posts'],
-};
-
-const rejectPost = (): void => {
- router.put(
- rejectPostRoute.url(props.post.id),
- {},
- { ...APPROVAL_RELOAD, preserveScroll: true, onError: toastFirstError },
- );
-};
-
-const revertRequest = (): void => {
- schedulePostCard(props.post.id, 'draft', APPROVAL_RELOAD);
-};
-
const recurrence = computed(() =>
props.post.status === PostStatus.Scheduled && props.post.scheduled_at
? recurrenceRuleOf(props.post)
: null,
);
-const detailsOpen = ref(openPostDetailsId.value === props.post.id);
-
-const openDetails = (): void => {
- detailsOpen.value = true;
-};
-
-const recurrenceOpen = ref(false);
+const {
+ detailsOpen,
+ recurrenceOpen,
+ recurrenceTarget,
+ recurrenceTimezone,
+ openDetails,
+ edit,
+ publishNow,
+ runPostAction,
+ runMenuAction,
+} = usePostCardMenuActions(() => props.post, {
+ timezone: () => timezone.value,
+ detailsOpen: openPostDetailsId.value === props.post.id,
+});
watch(detailsOpen, (open) => emit('details', open));
-const recurrencePost = ref<PostCard>(props.post);
-
-const edit = (post: PostCard = props.post): void => {
- router.visit(editUrl(post));
-};
const open = (): void => {
if (isEditable.value) {
@@ -400,36 +367,6 @@ const open = (): void => {
openDetails();
};
-const runPostAction = (action: PostCardMenuAction, post: PostCard): void => {
- switch (action) {
- case 'publish_now':
- schedulePostCard(post.id, 'publish_now');
- break;
- case 'duplicate':
- duplicatePostCard(post);
- break;
- case 'recurrence':
- recurrencePost.value = post;
- recurrenceOpen.value = true;
- break;
- case 'move_drafts':
- schedulePostCard(post.id, 'draft');
- break;
- case 'details':
- detailsOpen.value = true;
- break;
- case 'share_link':
- sharePostCardLink(post);
- break;
- case 'copy_link':
- copyPostCardLink(post);
- break;
- case 'delete':
- deletePost(post);
- break;
- }
-};
-
const onMenuSelect = (action: PostCardMenuAction): void => {
switch (action) {
case 'move_top':
@@ -442,11 +379,10 @@ const onMenuSelect = (action: PostCardMenuAction): void => {
emit('move', 'down');
break;
default:
- runPostAction(action, props.post);
+ runMenuAction(action);
}
};
-defineExpose({ openDetails });
</script>
<template>
@@ -487,15 +423,11 @@ defineExpose({ openDetails });
{{ $t(noTimeKey) }}
</span>
</span>
- <Badge
+ <PostStatusBadge
v-if="showsApprovalBadge"
- variant="warning"
- class="h-6 gap-1 px-2 [&>svg]:size-4"
+ status="pending_approval"
:data-testid="`post-approval-badge-${post.id}`"
- >
- <IconEdit />
- {{ $t('posts.approvals.badge') }}
- </Badge>
+ />
<span
v-if="timePassed"
class="text-xs text-destructive-text"
@@ -529,18 +461,11 @@ defineExpose({ openDetails });
:attempted-at="time"
:timezone="timezone"
/>
- <Badge
+ <PostStatusBadge
v-else-if="showStatus && !isPublishing"
- :variant="getPostStatusConfig(post.status).variant"
- class="h-6 gap-1 px-2 [&>svg]:size-4"
+ :status="post.status"
:data-testid="`post-status-${post.id}`"
- >
- <component
- :is="getPostStatusConfig(post.status).icon"
- :class="getPostStatusConfig(post.status).iconClass"
- />
- {{ $t(`posts.status.${post.status}`) }}
- </Badge>
+ />
</div>
<Collapsible :open="notesOpen" as-child @update:open="setNotesOpen">
@@ -867,27 +792,11 @@ defineExpose({ openDetails });
}}
</TooltipContent>
</Tooltip>
- <template v-if="isPending && canApprove">
- <ApprovePostButton :post="post" :test-key="post.id" />
- <Button
- variant="outline"
- class="text-destructive-text"
- :data-testid="`post-reject-${post.id}`"
- @click="rejectPost"
- >
- <IconX class="size-4" />
- {{ $t('posts.approvals.reject') }}
- </Button>
- </template>
- <Button
- v-else-if="isPending"
- variant="outline"
- :data-testid="`post-revert-${post.id}`"
- @click="revertRequest"
- >
- <IconX class="size-4" />
- {{ $t('posts.approvals.revert') }}
- </Button>
+ <PostApprovalActions
+ v-if="isPending"
+ :post="post"
+ :test-key="post.id"
+ />
<AddToQueueButton
v-if="canCreatePost && tab === 'drafts' && account"
:post="post"
@@ -923,7 +832,7 @@ defineExpose({ openDetails });
v-if="canPublishDirectly && post.status === PostStatus.Scheduled"
variant="outline"
:data-testid="`post-publish-now-${post.id}`"
- @click="schedulePostCard(post.id, 'publish_now')"
+ @click="publishNow"
>
<IconSend class="size-4" />
{{ $t('posts.publish.actions.publish_now') }}
@@ -966,9 +875,7 @@ defineExpose({ openDetails });
<PostRecurrenceDialog
v-if="canCreatePost"
v-model:open="recurrenceOpen"
- :post="
- recurrencePost.id === post.id ? post : recurrencePost
- "
+ :post="recurrenceTarget"
:test-key="post.id"
:timezone="recurrenceTimezone"
/>
diff --git a/resources/js/components/publish/PublicationDetailsDialog.vue b/resources/js/components/publish/PublicationDetailsDialog.vue
index d4ea10812..b9b18bb78 100644
--- a/resources/js/components/publish/PublicationDetailsDialog.vue
+++ b/resources/js/components/publish/PublicationDetailsDialog.vue
@@ -4,10 +4,9 @@ import { computed, ref } from 'vue';
import ChannelAvatar from '@/components/ChannelAvatar.vue';
import MediaLightbox from '@/components/media/MediaLightbox.vue';
-import PostDeletedOnNetworkBadge from '@/components/publish/PostDeletedOnNetworkBadge.vue';
import PostDetailsMedia from '@/components/publish/PostDetailsMedia.vue';
import PostMetricsBand from '@/components/publish/PostMetricsBand.vue';
-import { Badge } from '@/components/ui/badge';
+import PostStatusBadge from '@/components/publish/PostStatusBadge.vue';
import { Button } from '@/components/ui/button';
import {
Dialog,
@@ -18,14 +17,12 @@ import {
DialogTitle,
} from '@/components/ui/dialog';
import { getPlatformLabel } from '@/composables/usePlatformLogo';
-import { getPostStatusConfig } from '@/composables/usePostStatus';
import date from '@/date';
import {
PublicationAvailability,
type PublicationAnalyticsDetail,
} from '@/types/analytics';
import type { MediaItem } from '@/types/media';
-import { PostStatus } from '@/types/post';
/**
* The details of a network publication that has no TryPost post: what the
@@ -40,7 +37,6 @@ const open = defineModel<boolean>('open', { required: true });
const publication = computed(() => props.detail.publication);
-const status = getPostStatusConfig(PostStatus.Published);
const isDeletedOnNetwork = computed(
() => publication.value.availability === PublicationAvailability.Deleted,
@@ -87,18 +83,12 @@ const openMediaPreview = (): void => {
class="flex flex-wrap items-center gap-2"
as="div"
>
- <PostDeletedOnNetworkBadge
+ <PostStatusBadge
v-if="isDeletedOnNetwork"
+ status="deleted_on_network"
:data-testid="`publication-details-deleted-on-network-${publication.id}`"
/>
- <Badge
- v-else
- :variant="status.variant"
- class="h-6 gap-1 px-2 [&>svg]:size-4"
- >
- <component :is="status.icon" />
- {{ $t(`posts.status.${PostStatus.Published}`) }}
- </Badge>
+ <PostStatusBadge v-else status="published" />
<span
v-if="publication.provider_published_at"
class="text-sm text-muted-foreground"
diff --git a/resources/js/components/publish/PublishFilterMenu.vue b/resources/js/components/publish/PublishFilterMenu.vue
index 3cd083356..d0bddb1ff 100644
--- a/resources/js/components/publish/PublishFilterMenu.vue
+++ b/resources/js/components/publish/PublishFilterMenu.vue
@@ -49,9 +49,6 @@ const setShowSlots = (value: boolean): void => {
const selectStatus = (value: CalendarStatus): void => {
status.value = value;
};
-
-const rowClass =
- 'flex h-11 w-full items-center gap-2 rounded-md px-2 text-start text-base text-foreground transition-control hover:bg-accent focus-visible:bg-accent focus-visible:outline-none sm:h-9 sm:text-sm';
</script>
<template>
@@ -89,7 +86,7 @@ const rowClass =
:key="option"
type="button"
:aria-pressed="status === option"
- :class="rowClass"
+ class="menu-row"
:data-testid="`calendar-status-${option}`"
@click="selectStatus(option)"
>
@@ -121,7 +118,7 @@ const rowClass =
v-if="showSlots !== null"
type="button"
:aria-pressed="showSlots"
- :class="rowClass"
+ class="menu-row"
:data-testid="`${testId}-toggle-slots`"
@click="setShowSlots(!showSlots)"
>
@@ -131,7 +128,7 @@ const rowClass =
<Link
v-if="manageSlotsHref"
:href="manageSlotsHref"
- :class="rowClass"
+ class="menu-row"
:data-testid="`${testId}-manage-slots`"
>
{{ $t('posts.publish.menu.manage_posting_times') }}
@@ -140,7 +137,7 @@ const rowClass =
<template v-if="$slots['compact-items']">
<div class="my-2 h-px bg-border" />
- <slot name="compact-items" :row-class="rowClass" :close="close" />
+ <slot name="compact-items" :close="close" />
</template>
</template>
</ResponsivePopover>
diff --git a/resources/js/components/publish/PublishHeader.vue b/resources/js/components/publish/PublishHeader.vue
index ba8465cc1..cabf5dcc9 100644
--- a/resources/js/components/publish/PublishHeader.vue
+++ b/resources/js/components/publish/PublishHeader.vue
@@ -6,8 +6,16 @@ import ChannelAvatar from '@/components/ChannelAvatar.vue';
import HeaderTitle from '@/components/HeaderTitle.vue';
import GoalProgress from '@/components/publish/GoalProgress.vue';
import { Button } from '@/components/ui/button';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipProvider,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import { filled } from '@/lib/helpers';
import { settings } from '@/routes/app/channels';
+import { channels as channelsSettings } from '@/routes/app/workspace';
import { channelName } from '@/types/channel';
import type { PublishChannel } from '@/types/publish';
@@ -19,52 +27,90 @@ const { canManageAccounts } = useWorkspaceAbilities();
</script>
<template>
- <div v-if="channel" class="flex min-w-0 items-center gap-4">
- <ChannelAvatar
- :status="channel.status"
- :account-id="channel.id"
- :platform="channel.platform"
- :src="channel.avatar_url"
- :verified="channel.verified_badge"
- :name="channelName(channel)"
- :size="44"
- />
- <div class="min-w-0">
+ <TooltipProvider :delay-duration="0">
+ <div v-if="channel" class="flex min-w-0 items-center gap-4">
+ <ChannelAvatar
+ :status="channel.status"
+ :account-id="channel.id"
+ :platform="channel.platform"
+ :src="channel.avatar_url"
+ :verified="channel.verified_badge"
+ :name="channelName(channel)"
+ :size="44"
+ />
+ <div class="min-w-0">
+ <div class="flex min-w-0 items-center gap-2">
+ <h1
+ class="truncate font-heading text-xl leading-6 font-medium text-foreground"
+ data-testid="header-title"
+ >
+ {{ channelName(channel) }}
+ </h1>
+ <Tooltip v-if="canManageAccounts">
+ <TooltipTrigger as-child>
+ <Button
+ as-child
+ variant="ghost"
+ size="icon-xs"
+ class="shrink-0 text-muted-foreground"
+ >
+ <Link
+ :href="settings.url(channel.id)"
+ :aria-label="$t('channels.settings')"
+ data-testid="publish-channel-settings"
+ >
+ <IconSettings class="size-4" />
+ </Link>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ data-testid="publish-channel-settings-tooltip"
+ >
+ {{ $t('channels.settings') }}
+ </TooltipContent>
+ </Tooltip>
+ </div>
+ <GoalProgress
+ v-if="filled(channel.posting_goal)"
+ :channel-id="channel.id"
+ :sent="channel.sent_this_week"
+ :scheduled="channel.scheduled_this_week"
+ :goal="channel.posting_goal"
+ />
+ </div>
+ </div>
+ <HeaderTitle v-else :icon="IconCalendarEvent">
<div class="flex min-w-0 items-center gap-2">
<h1
- class="truncate font-heading text-xl leading-6 font-medium text-foreground"
+ class="truncate font-heading text-xl leading-tight font-medium text-foreground"
data-testid="header-title"
>
- {{ channelName(channel) }}
+ {{ $t('posts.publish.all_channels') }}
</h1>
- <Button
- v-if="canManageAccounts"
- as-child
- variant="ghost"
- size="icon-xs"
- class="shrink-0 text-muted-foreground"
- >
- <Link
- :href="settings.url(channel.id)"
- :aria-label="$t('channels.settings')"
- data-testid="publish-channel-settings"
+ <Tooltip v-if="canManageAccounts">
+ <TooltipTrigger as-child>
+ <Button
+ as-child
+ variant="ghost"
+ size="icon-xs"
+ class="shrink-0 text-muted-foreground"
+ >
+ <Link
+ :href="channelsSettings.url()"
+ :aria-label="$t('channels.manage')"
+ data-testid="publish-channels-settings"
+ >
+ <IconSettings class="size-4" />
+ </Link>
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ data-testid="publish-channels-settings-tooltip"
>
- <IconSettings class="size-4" />
- </Link>
- </Button>
+ {{ $t('channels.manage') }}
+ </TooltipContent>
+ </Tooltip>
</div>
- <GoalProgress
- v-if="channel.posting_goal !== null"
- :channel-id="channel.id"
- :sent="channel.sent_this_week"
- :scheduled="channel.scheduled_this_week"
- :goal="channel.posting_goal"
- />
- </div>
- </div>
- <HeaderTitle
- v-else
- :title="$t('posts.publish.all_channels')"
- :icon="IconCalendarEvent"
- />
+ </HeaderTitle>
+ </TooltipProvider>
</template>
diff --git a/resources/js/components/publish/PublishTabs.vue b/resources/js/components/publish/PublishTabs.vue
index 5eb9f046a..3a8ee905d 100644
--- a/resources/js/components/publish/PublishTabs.vue
+++ b/resources/js/components/publish/PublishTabs.vue
@@ -4,6 +4,7 @@ import { IconCheck, IconChevronDown } from '@tabler/icons-vue';
import { ref } from 'vue';
import ResponsivePopover from '@/components/ResponsivePopover.vue';
+import { formatNumberCompact } from '@/lib/utils';
import type { PublishCounts, PublishTab } from '@/types/publish';
defineProps<{
@@ -41,7 +42,7 @@ const closeSelect = (): void => {
{{ $t(`posts.publish.tabs.${tab}`) }}
<span
class="inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-secondary px-1.5 text-xs font-medium text-foreground"
- >{{ counts[tab] }}</span
+ >{{ formatNumberCompact(counts[tab]) }}</span
>
<IconChevronDown class="size-4 text-muted-foreground" />
</button>
@@ -62,7 +63,7 @@ const closeSelect = (): void => {
{{ $t(`posts.publish.tabs.${key}`) }}
<span
class="inline-flex h-5 min-w-5 items-center justify-center rounded-full bg-secondary px-1.5 text-xs font-medium text-foreground"
- >{{ counts[key] }}</span
+ >{{ formatNumberCompact(counts[key]) }}</span
>
<IconCheck
v-if="tab === key"
@@ -95,7 +96,7 @@ const closeSelect = (): void => {
<span
class="inline-flex h-4.5 min-w-4.5 items-center justify-center rounded-full bg-secondary px-1 text-xs font-medium text-foreground group-aria-[current=page]:bg-primary-selected group-aria-[current=page]:text-primary-text"
:data-testid="`publish-tab-count-${key}`"
- >{{ counts[key] }}</span
+ >{{ formatNumberCompact(counts[key]) }}</span
>
</Link>
</nav>
diff --git a/resources/js/components/publish/board/BoardColumn.vue b/resources/js/components/publish/board/BoardColumn.vue
new file mode 100644
index 000000000..3375eb601
--- /dev/null
+++ b/resources/js/components/publish/board/BoardColumn.vue
@@ -0,0 +1,163 @@
+<script setup lang="ts">
+import { InfiniteScroll, usePage } from '@inertiajs/vue3';
+import { computed } from 'vue';
+
+import ChannelAvatar from '@/components/ChannelAvatar.vue';
+import LabelBadge from '@/components/labels/LabelBadge.vue';
+import PostBoardCard from '@/components/publish/board/PostBoardCard.vue';
+import { blank, filled } from '@/lib/helpers';
+import { formatNumberCompact } from '@/lib/utils';
+import type { BoardColumnMeta, BoardGroup } from '@/types/board';
+import { channelName } from '@/types/channel';
+import type { ScrollPostCards } from '@/types/publish';
+
+const props = defineProps<{
+ column: BoardColumnMeta;
+ group: BoardGroup;
+ timezone: string;
+}>();
+
+const page = usePage();
+
+const cards = computed(
+ (): ScrollPostCards | undefined =>
+ (page.props.columns as Record<string, ScrollPostCards> | undefined)?.[
+ props.column.key
+ ],
+);
+
+const posts = computed(() => cards.value?.data ?? []);
+
+/** Every post of the column, loaded or not: the paginator's total. */
+const count = computed(() => cards.value?.total ?? 0);
+
+/** The exact count on hover, once the badge shortens it ("1.5K"). */
+const countTitle = computed((): string | undefined => {
+ if (count.value < 1000) {
+ return undefined;
+ }
+
+ return String(count.value);
+});
+
+/** The cards show their status unless the columns already are the statuses. */
+const showsCardStatus = computed(() => props.group !== 'status');
+
+/** A status or Untagged column is named by a lang key. */
+const nameKey = computed((): string => {
+ if (props.column.type === 'status') {
+ return `posts.board.columns.${props.column.key}`;
+ }
+
+ return `posts.board.columns.${props.column.type}`;
+});
+
+/**
+ * The column's name: the tag's or the channel's own name, else its lang key
+ * resolved with the template's `$t`.
+ */
+const columnName = (translate: (key: string) => string): string => {
+ if (filled(props.column.label)) {
+ return props.column.label.name;
+ }
+
+ if (filled(props.column.channel)) {
+ return channelName(props.column.channel);
+ }
+
+ return translate(nameKey.value);
+};
+</script>
+
+<template>
+ <section
+ class="flex h-full w-[85vw] shrink-0 snap-start flex-col rounded-lg bg-muted sm:w-80"
+ :aria-label="
+ $tChoice('posts.board.column_aria', count, {
+ name: columnName($t),
+ count: String(count),
+ })
+ "
+ :data-testid="`board-column-${column.key}`"
+ >
+ <header class="flex h-12 shrink-0 items-center gap-2 ps-3 pe-3 pt-2">
+ <LabelBadge
+ v-if="column.label"
+ :label="column.label"
+ :data-testid="`board-column-label-${column.key}`"
+ />
+ <template v-else-if="column.channel">
+ <ChannelAvatar
+ :platform="column.channel.platform"
+ :src="column.channel.avatar_url"
+ :name="channelName(column.channel)"
+ :status="column.channel.status"
+ :account-id="column.channel.id"
+ :size="20"
+ ring="background"
+ />
+ <h2
+ class="min-w-0 truncate text-sm leading-5 font-emphasis text-foreground"
+ :title="channelName(column.channel)"
+ >
+ {{ channelName(column.channel) }}
+ </h2>
+ </template>
+ <h2
+ v-else
+ class="min-w-0 truncate text-sm leading-5 font-emphasis text-foreground"
+ >
+ {{ columnName($t) }}
+ </h2>
+ <span
+ v-if="cards"
+ class="inline-flex h-4.5 min-w-4.5 shrink-0 items-center justify-center rounded-full bg-secondary px-1 text-xs leading-[18px] font-medium text-muted-foreground"
+ :title="countTitle"
+ :data-testid="`board-column-count-${column.key}`"
+ >{{ formatNumberCompact(count) }}</span
+ >
+ </header>
+
+ <div
+ v-if="!cards"
+ class="flex flex-col gap-2 px-2 pt-1"
+ aria-hidden="true"
+ :data-testid="`board-column-skeleton-${column.key}`"
+ >
+ <div
+ v-for="index in 3"
+ :key="index"
+ class="h-32 animate-pulse rounded-lg bg-secondary"
+ />
+ </div>
+ <div
+ v-else
+ class="min-h-0 flex-1 overflow-y-auto overscroll-y-contain px-2 pt-1 pb-2"
+ :data-testid="`board-column-scroll-${column.key}`"
+ >
+ <InfiniteScroll
+ :data="`columns.${column.key}`"
+ :buffer="200"
+ only-next
+ preserve-url
+ >
+ <div class="flex flex-col gap-2">
+ <PostBoardCard
+ v-for="post in posts"
+ :key="post.id"
+ :post="post"
+ :show-status="showsCardStatus"
+ :timezone="timezone"
+ />
+ <p
+ v-if="blank(posts)"
+ class="px-1 py-2 text-sm text-muted-foreground"
+ :data-testid="`board-column-empty-${column.key}`"
+ >
+ {{ $t('posts.board.empty_column') }}
+ </p>
+ </div>
+ </InfiniteScroll>
+ </div>
+ </section>
+</template>
diff --git a/resources/js/components/publish/board/BoardGroupMenu.vue b/resources/js/components/publish/board/BoardGroupMenu.vue
new file mode 100644
index 000000000..71b1cd247
--- /dev/null
+++ b/resources/js/components/publish/board/BoardGroupMenu.vue
@@ -0,0 +1,139 @@
+<script setup lang="ts">
+import { IconCheck, IconChevronDown, IconLayoutKanban } from '@tabler/icons-vue';
+import { ref } from 'vue';
+
+import BottomSheet from '@/components/BottomSheet.vue';
+import { Button } from '@/components/ui/button';
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuRadioGroup,
+ DropdownMenuRadioItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu';
+import { useBelowBreakpoint } from '@/composables/useBreakpoint';
+import type { BoardGroup } from '@/types/board';
+
+defineProps<{
+ groups: BoardGroup[];
+}>();
+
+const group = defineModel<BoardGroup>({ required: true });
+
+const belowSm = useBelowBreakpoint('sm');
+
+/** The phone trigger's name: "Group by: Label", resolved with the template's `$t`. */
+const triggerLabel = (
+ translate: (key: string, replacements?: Record<string, string>) => string,
+): string =>
+ translate('posts.board.group_by_value', {
+ group: translate(`posts.board.groups.${group.value}`),
+ });
+
+/** Whether an option is the group the board shows. */
+const isSelected = (option: BoardGroup): boolean => option === group.value;
+
+const sheetOpen = ref(false);
+
+const openSheet = (): void => {
+ sheetOpen.value = true;
+};
+
+const select = (value: BoardGroup): void => {
+ sheetOpen.value = false;
+
+ if (value !== group.value) {
+ group.value = value;
+ }
+};
+
+const chooseFromMenu = (value: unknown): void => {
+ select(value as BoardGroup);
+};
+</script>
+
+<template>
+ <div class="contents">
+ <template v-if="belowSm">
+ <Button
+ variant="ghost"
+ class="shrink-0 gap-1.5 px-2"
+ :aria-label="triggerLabel($t)"
+ aria-haspopup="dialog"
+ :aria-expanded="sheetOpen"
+ data-testid="board-group-trigger"
+ @click="openSheet"
+ >
+ <IconLayoutKanban class="size-4 text-muted-foreground" />
+ {{ $t(`posts.board.groups.${group}`) }}
+ <IconChevronDown class="size-4 text-muted-foreground" />
+ </Button>
+ <BottomSheet
+ v-model:open="sheetOpen"
+ :title="$t('posts.board.group_by')"
+ :show-header="false"
+ handle
+ test-id="board-group-sheet"
+ content-class="px-3 pb-6"
+ >
+ <p class="px-2 pt-1 pb-1.5 text-xs text-muted-foreground">
+ {{ $t('posts.board.group_by') }}
+ </p>
+ <button
+ v-for="option in groups"
+ :key="option"
+ type="button"
+ :aria-pressed="isSelected(option)"
+ class="menu-row"
+ :data-testid="`board-group-option-${option}`"
+ @click="select(option)"
+ >
+ {{ $t(`posts.board.groups.${option}`) }}
+ <IconCheck
+ v-if="isSelected(option)"
+ class="ms-auto size-4"
+ />
+ </button>
+ </BottomSheet>
+ </template>
+
+ <DropdownMenu v-else>
+ <DropdownMenuTrigger as-child>
+ <Button
+ variant="ghost"
+ class="shrink-0 gap-1.5 px-2 data-[state=open]:bg-accent"
+ data-testid="board-group-trigger"
+ >
+ <IconLayoutKanban class="size-4 text-muted-foreground" />
+ <span class="text-muted-foreground">{{
+ $t('posts.board.group_by')
+ }}</span>
+ {{ $t(`posts.board.groups.${group}`) }}
+ <IconChevronDown class="size-4 text-muted-foreground" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ align="start"
+ class="w-48"
+ data-testid="board-group-content"
+ >
+ <DropdownMenuRadioGroup
+ :model-value="group"
+ @update:model-value="chooseFromMenu"
+ >
+ <DropdownMenuRadioItem
+ v-for="option in groups"
+ :key="option"
+ :value="option"
+ :data-testid="`board-group-option-${option}`"
+ >
+ <template #indicator-icon>
+ <IconCheck class="size-4" />
+ </template>
+ {{ $t(`posts.board.groups.${option}`) }}
+ </DropdownMenuRadioItem>
+ </DropdownMenuRadioGroup>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+</template>
diff --git a/resources/js/components/publish/board/PostBoardCard.vue b/resources/js/components/publish/board/PostBoardCard.vue
new file mode 100644
index 000000000..5a32de079
--- /dev/null
+++ b/resources/js/components/publish/board/PostBoardCard.vue
@@ -0,0 +1,311 @@
+<script setup lang="ts">
+import { IconPlayerPlayFilled } from '@tabler/icons-vue';
+import { useElementVisibility } from '@vueuse/core';
+import { computed, ref } from 'vue';
+
+import ChannelAvatar from '@/components/ChannelAvatar.vue';
+import PostApprovalActions from '@/components/publish/PostApprovalActions.vue';
+import PostCardLabels from '@/components/publish/PostCardLabels.vue';
+import PostCardMenu from '@/components/publish/PostCardMenu.vue';
+import PostDetailsDialog from '@/components/publish/PostDetailsDialog.vue';
+import PostRecurrenceDialog from '@/components/publish/PostRecurrenceDialog.vue';
+import PostStatusBadge from '@/components/publish/PostStatusBadge.vue';
+import { Badge } from '@/components/ui/badge';
+import { usePostCardMenuActions } from '@/composables/publish/usePostCardMenuActions';
+import { getContentTypeBadgeKey } from '@/composables/usePlatformLogo';
+import { postDisplayStatus } from '@/composables/usePostStatus';
+import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import date from '@/date';
+import { filled, transform } from '@/lib/helpers';
+import { isImage } from '@/lib/mediaType';
+import {
+ postChannelLabel,
+ postNoTimeKey,
+ postShownAt,
+ postThumbnail,
+} from '@/lib/postCard';
+import { htmlToPlainText } from '@/lib/utils';
+import { videoFrameUrl } from '@/lib/videoFrame';
+import { PostStatus } from '@/types/post';
+import type { PostCard } from '@/types/publish';
+
+type Translate = (key: string) => string;
+
+const props = defineProps<{
+ post: PostCard;
+ showStatus: boolean;
+ timezone: string;
+}>();
+
+const { canCreatePost } = useWorkspaceAbilities();
+
+/** The details and recurrence dialogs mount on the first click only, so a full board doesn't mount them per post. */
+const {
+ dialogsMounted,
+ detailsOpen,
+ recurrenceOpen,
+ recurrenceTarget,
+ recurrenceTimezone,
+ openDetails,
+ edit,
+ runPostAction,
+ runMenuAction,
+} = usePostCardMenuActions(() => props.post, {
+ timezone: () => props.timezone,
+ lazy: true,
+});
+
+const account = computed(() => props.post.social_account);
+
+const channelLabel = computed(() => postChannelLabel(props.post));
+
+
+const shownAt = computed(() => postShownAt(props.post));
+
+/** The card's time, like the List: none for a draft or request without one, which shows its no-time label instead. */
+const timeOrNone = (translate: Translate): string => {
+ if (!filled(shownAt.value)) {
+ return translate(postNoTimeKey(props.post));
+ }
+
+ return date.formatMonthDayTimeInTimezone(shownAt.value, props.timezone);
+};
+
+const text = computed(() => htmlToPlainText(props.post.content ?? ''));
+
+const hasText = computed(() => filled(text.value));
+
+const textColor = computed((): string => {
+ if (hasText.value) {
+ return 'text-foreground';
+ }
+
+ return 'text-muted-foreground';
+});
+
+/** The channel the card names, or "No channel". Takes the template's `$t`, like the helpers below. */
+const channelOrNone = (translate: Translate): string => {
+ if (filled(channelLabel.value)) {
+ return channelLabel.value;
+ }
+
+ return translate('posts.board.columns.no_channel');
+};
+
+/** The post's text, or "No content". */
+const textOrNone = (translate: Translate): string => {
+ if (hasText.value) {
+ return text.value;
+ }
+
+ return translate('calendar.no_content');
+};
+
+/** What a screen reader says on the card, as the calendar chip does: channel, time and text. */
+const openLabel = (translate: Translate): string =>
+ [channelOrNone(translate), timeOrNone(translate), textOrNone(translate)].join(
+ ' · ',
+ );
+
+const thumbnail = computed(() => postThumbnail(props.post));
+
+/** Whether the thumbnail is a video, whose frame loads only once the card shows. */
+const hasVideoThumbnail = computed((): boolean => {
+ if (!filled(thumbnail.value)) {
+ return false;
+ }
+
+ return !isImage(thumbnail.value);
+});
+
+const thumbnailFrame = ref<HTMLElement | null>(null);
+
+/**
+ * A video loads its frame once its card first shows, never for the whole board at once; an
+ * image is lazy on its own and is not observed. The 200px margin widens the viewport only:
+ * the column's scroller still clips, so a card scrolled out of its column counts as hidden.
+ */
+const observedFrame = computed((): HTMLElement | null => {
+ if (!hasVideoThumbnail.value) {
+ return null;
+ }
+
+ return thumbnailFrame.value;
+});
+
+const videoLoaded = useElementVisibility(observedFrame, {
+ rootMargin: '200px',
+ once: true,
+});
+
+const contentTypeKey = computed(() =>
+ transform(props.post.platform, (platform) =>
+ getContentTypeBadgeKey(platform, props.post.content_type ?? null),
+ ),
+);
+
+const displayStatus = computed(() => postDisplayStatus(props.post));
+
+const isPending = computed(
+ () => props.post.status === PostStatus.PendingApproval,
+);
+
+
+/** The details and recurrence dialogs mount once one is opened, for a member who can post. */
+const mountsDialogs = computed((): boolean => {
+ if (!canCreatePost.value) {
+ return false;
+ }
+
+ return dialogsMounted.value;
+});
+
+/** A member who can post gets the card's menu, except while the post is publishing. */
+const hasMenu = computed((): boolean => {
+ if (!canCreatePost.value) {
+ return false;
+ }
+
+ return props.post.status !== PostStatus.Publishing;
+});
+</script>
+
+<template>
+ <article
+ class="relative flex flex-col gap-2 rounded-lg border border-border-strong bg-card p-3 transition-control [contain-intrinsic-size:auto_160px] [content-visibility:auto] hover:bg-secondary"
+ :data-testid="`board-card-${post.id}`"
+ >
+ <button
+ type="button"
+ class="absolute inset-0 rounded-lg focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring"
+ :aria-label="openLabel($t)"
+ :data-testid="`board-card-open-${post.id}`"
+ @click="openDetails"
+ />
+
+ <div class="flex min-h-7 items-center gap-2" :class="{ 'pe-8': hasMenu }">
+ <ChannelAvatar
+ v-if="post.platform"
+ :platform="post.platform"
+ :src="account?.avatar_url"
+ :name="channelLabel"
+ :status="account?.status"
+ :account-id="account?.id"
+ :size="24"
+ ring="card"
+ />
+ <p
+ class="min-w-0 truncate text-sm leading-tight font-emphasis text-foreground"
+ >
+ {{ channelOrNone($t) }}
+ </p>
+ </div>
+
+ <div
+ class="flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground"
+ >
+ <time
+ v-if="filled(shownAt)"
+ :datetime="shownAt"
+ :data-testid="`board-card-time-${post.id}`"
+ >{{ timeOrNone($t) }}</time
+ >
+ <span v-else :data-testid="`board-card-no-time-${post.id}`">{{
+ timeOrNone($t)
+ }}</span>
+ <Badge
+ v-if="contentTypeKey"
+ variant="secondary"
+ class="h-5 px-1.5"
+ :data-testid="`board-card-content-type-${post.id}`"
+ >
+ {{ $t(contentTypeKey) }}
+ </Badge>
+ <PostStatusBadge
+ v-if="showStatus"
+ :status="displayStatus"
+ compact
+ :data-testid="`board-card-status-${post.id}`"
+ />
+ </div>
+
+ <p
+ class="line-clamp-6 text-sm break-words whitespace-pre-line"
+ :class="textColor"
+ >
+ {{ textOrNone($t) }}
+ </p>
+
+ <div
+ v-if="thumbnail"
+ ref="thumbnailFrame"
+ class="relative aspect-video overflow-hidden rounded-md border border-border-strong bg-secondary"
+ :data-testid="`board-card-thumbnail-${post.id}`"
+ >
+ <img
+ v-if="!hasVideoThumbnail"
+ :src="thumbnail.url"
+ alt=""
+ loading="lazy"
+ class="size-full object-cover"
+ />
+ <template v-else>
+ <video
+ v-if="videoLoaded"
+ :src="videoFrameUrl(thumbnail)"
+ class="size-full object-cover"
+ muted
+ playsinline
+ preload="metadata"
+ />
+ <IconPlayerPlayFilled
+ aria-hidden="true"
+ class="absolute top-1/2 left-1/2 size-6 -translate-x-1/2 -translate-y-1/2 rounded-full bg-black/60 p-1 text-white"
+ />
+ </template>
+ </div>
+
+ <div class="relative z-10 flex empty:hidden">
+ <PostCardLabels
+ :post-id="post.id"
+ :labels="post.labels"
+ :test-key="`board-${post.id}`"
+ />
+ </div>
+
+ <div
+ v-if="isPending"
+ class="relative z-10 grid grid-cols-2 gap-2 [&>*>*:only-child]:col-span-2"
+ :data-testid="`board-card-approval-${post.id}`"
+ >
+ <PostApprovalActions :post="post" :test-key="`board-${post.id}`" />
+ </div>
+
+ <div v-if="hasMenu" class="absolute top-2 end-2 z-10">
+ <PostCardMenu
+ :post="post"
+ :test-key="`board-${post.id}`"
+ :trigger-test-id="`board-card-menu-${post.id}`"
+ :movable="false"
+ @select="runMenuAction"
+ />
+ </div>
+
+ <template v-if="mountsDialogs">
+ <PostDetailsDialog
+ v-model:open="detailsOpen"
+ :post="post"
+ :test-key="post.id"
+ :timezone="timezone"
+ @select="runPostAction"
+ @edit="edit"
+ />
+ <PostRecurrenceDialog
+ v-model:open="recurrenceOpen"
+ :post="recurrenceTarget"
+ :test-key="post.id"
+ :timezone="recurrenceTimezone"
+ />
+ </template>
+ </article>
+</template>
diff --git a/resources/js/components/settings/SettingsSearch.vue b/resources/js/components/settings/SettingsSearch.vue
index f7c9946ed..16e389b2a 100644
--- a/resources/js/components/settings/SettingsSearch.vue
+++ b/resources/js/components/settings/SettingsSearch.vue
@@ -19,7 +19,7 @@ defineProps<{
v-model="query"
:aria-label="placeholder"
:placeholder="placeholder"
- class="h-10 ps-9"
+ class="h-8 ps-9"
data-testid="header-search-input"
/>
</div>
diff --git a/resources/js/composables/publish/usePostCardMenuActions.ts b/resources/js/composables/publish/usePostCardMenuActions.ts
new file mode 100644
index 000000000..c03c15355
--- /dev/null
+++ b/resources/js/composables/publish/usePostCardMenuActions.ts
@@ -0,0 +1,151 @@
+import { router } from '@inertiajs/vue3';
+import { computed, inject, nextTick, ref } from 'vue';
+
+import { edit as editPostRoute } from '@/actions/App/Http/Controllers/App/PostController';
+import {
+ copyPostCardLink,
+ deletePostCardKey,
+ duplicatePostCard,
+ editPostCardUrlKey,
+ schedulePostCard,
+ sharePostCardLink,
+ usePageReload,
+} from '@/composables/usePostCardActions';
+import { filled } from '@/lib/helpers';
+import type { PostCard, PostCardMenuAction } from '@/types/publish';
+
+/**
+ * What a post card's ⋮ menu and its details dialog do, shared by the List
+ * card, the board card and the calendar chip. The details and recurrence
+ * dialogs the actions open are rendered by the card; with `lazy`, they mount
+ * on first use only (`dialogsMounted`), so a full board or calendar doesn't
+ * mount two dialogs per post.
+ */
+export const usePostCardMenuActions = (
+ post: () => PostCard,
+ options: {
+ /** The zone the recurrence dialog falls back to when the post's channel has none. */
+ timezone: () => string;
+ detailsOpen?: boolean;
+ lazy?: boolean;
+ },
+) => {
+ const deletePost = inject(deletePostCardKey, () => {});
+ const editUrl = inject(editPostCardUrlKey, (target: PostCard) =>
+ editPostRoute.url(target.id),
+ );
+
+ const pageReload = usePageReload();
+
+ const dialogsMounted = ref(!options.lazy);
+ const detailsOpen = ref(options.detailsOpen ?? false);
+ const recurrenceOpen = ref(false);
+ const recurrencePost = ref<PostCard>(post());
+
+ /** The post the recurrence dialog edits: this card's, kept current, or a sibling picked in the details. */
+ const recurrenceTarget = computed((): PostCard => {
+ if (recurrencePost.value.id === post().id) {
+ return post();
+ }
+
+ return recurrencePost.value;
+ });
+
+ /** The recurrence dialog reads times in the edited post's channel zone. */
+ const recurrenceTimezone = computed((): string => {
+ const channelZone = recurrenceTarget.value.social_account?.timezone;
+
+ if (filled(channelZone)) {
+ return channelZone;
+ }
+
+ return options.timezone();
+ });
+
+ /** Runs `open` now when the dialogs are mounted, else once they mount. */
+ const withDialogs = (open: () => void): void => {
+ if (dialogsMounted.value) {
+ open();
+
+ return;
+ }
+
+ dialogsMounted.value = true;
+ void nextTick(open);
+ };
+
+ const openDetails = (): void => {
+ withDialogs(() => {
+ detailsOpen.value = true;
+ });
+ };
+
+ const openRecurrence = (target: PostCard): void => {
+ withDialogs(() => {
+ recurrencePost.value = target;
+ recurrenceOpen.value = true;
+ });
+ };
+
+ const edit = (target: PostCard = post()): void => {
+ router.visit(editUrl(target));
+ };
+
+ const schedule = (
+ target: PostCard,
+ action: 'publish_now' | 'draft',
+ ): void => {
+ schedulePostCard(target.id, action, pageReload());
+ };
+
+ const publishNow = (): void => {
+ schedule(post(), 'publish_now');
+ };
+
+ const runPostAction = (action: PostCardMenuAction, target: PostCard): void => {
+ switch (action) {
+ case 'publish_now':
+ schedule(target, 'publish_now');
+ break;
+ case 'duplicate':
+ duplicatePostCard(target);
+ break;
+ case 'recurrence':
+ openRecurrence(target);
+ break;
+ case 'move_drafts':
+ schedule(target, 'draft');
+ break;
+ case 'details':
+ openDetails();
+ break;
+ case 'share_link':
+ sharePostCardLink(target);
+ break;
+ case 'copy_link':
+ copyPostCardLink(target);
+ break;
+ case 'delete':
+ deletePost(target);
+ break;
+ }
+ };
+
+ /** Runs a menu choice on this card's post. */
+ const runMenuAction = (action: PostCardMenuAction): void => {
+ runPostAction(action, post());
+ };
+
+ return {
+ dialogsMounted,
+ detailsOpen,
+ recurrenceOpen,
+ recurrenceTarget,
+ recurrenceTimezone,
+ openDetails,
+ edit,
+ publishNow,
+ runPostAction,
+ runMenuAction,
+ };
+};
diff --git a/resources/js/composables/publish/usePublishFilters.ts b/resources/js/composables/publish/usePublishFilters.ts
new file mode 100644
index 000000000..e9a202e19
--- /dev/null
+++ b/resources/js/composables/publish/usePublishFilters.ts
@@ -0,0 +1,185 @@
+import { usePage } from '@inertiajs/vue3';
+import { computed, ref, watch } from 'vue';
+
+import { useDisplayTimezone } from '@/composables/useDisplayTimezone';
+import { useOpeningCalendarView } from '@/composables/usePublishView';
+import { provideViewTimezone } from '@/composables/useViewTimezone';
+import { blank, filled } from '@/lib/helpers';
+import { calendar } from '@/routes/app';
+import {
+ board as channelBoard,
+ calendar as channelCalendar,
+ publish,
+} from '@/routes/app/channels';
+import { board, index as postsIndex } from '@/routes/app/posts';
+import type { User } from '@/types';
+import type { TimezoneOption } from '@/types/posting-schedule';
+import type {
+ CalendarView,
+ PublishChannel,
+ PublishScope,
+} from '@/types/publish';
+
+export type PublishQuery = Record<string, string | string[] | undefined>;
+
+interface PublishFilterProps {
+ scope: PublishScope;
+ channel: PublishChannel | null;
+ displayTimezone: string;
+ timezones: TimezoneOption[];
+ filters: {
+ labels: string[];
+ untagged: boolean;
+ channels: string[];
+ };
+}
+
+interface PublishFilterOptions {
+ currentTab?: () => string;
+ reloadProps?: () => string[];
+}
+
+/**
+ * The filters the List, Calendar and Board views of the Publish page share
+ * (labels, untagged, channels on the all-channels page, the display time zone)
+ * and the links between those views, which carry them. Each page adds only its
+ * own query (the List's tab, the Calendar's status and period, the Board's group).
+ */
+export const usePublishFilters = (
+ props: PublishFilterProps,
+ options: PublishFilterOptions = {},
+) => {
+ const page = usePage();
+
+ /** The signed-in user's zone; the page's display zone for a user without one. */
+ const userTimezone = computed((): string => {
+ const own = (page.props.auth.user as User).timezone;
+
+ if (filled(own)) {
+ return own;
+ }
+
+ return props.displayTimezone;
+ });
+
+ const { timezone, setTimezone, dayKey } = useDisplayTimezone(
+ props.displayTimezone,
+ props.timezones.map((option) => option.value),
+ options.currentTab,
+ options.reloadProps,
+ );
+
+ provideViewTimezone(timezone);
+
+ watch(
+ () => props.displayTimezone,
+ (value) => {
+ timezone.value = value;
+ },
+ );
+
+ const selectedLabelIds = ref<string[]>(props.filters.labels ?? []);
+ const selectedUntagged = ref<boolean>(props.filters.untagged ?? false);
+ const selectedChannelIds = ref<string[]>(props.filters.channels ?? []);
+
+ const labelsQuery = (): string[] | undefined => {
+ if (blank(selectedLabelIds.value)) {
+ return undefined;
+ }
+
+ return selectedLabelIds.value;
+ };
+
+ const untaggedQuery = (): string | undefined => {
+ if (!selectedUntagged.value) {
+ return undefined;
+ }
+
+ return '1';
+ };
+
+ /** Channels are a filter of the all-channels page only; a channel page is already one channel. */
+ const channelsQuery = (): string[] | undefined => {
+ if (props.scope !== 'all') {
+ return undefined;
+ }
+
+ if (blank(selectedChannelIds.value)) {
+ return undefined;
+ }
+
+ return selectedChannelIds.value;
+ };
+
+ /** The zone goes in the URL only when it is not the user's own. */
+ const timezoneQuery = (): string | undefined => {
+ if (timezone.value === userTimezone.value) {
+ return undefined;
+ }
+
+ return timezone.value;
+ };
+
+ const filterQuery = (): PublishQuery => ({
+ labels: labelsQuery(),
+ untagged: untaggedQuery(),
+ channels: channelsQuery(),
+ tz: timezoneQuery(),
+ });
+
+ const listUrlFor = (query: PublishQuery = filterQuery()): string => {
+ if (filled(props.channel)) {
+ return publish.url(props.channel.id, { query });
+ }
+
+ return postsIndex.url({ query });
+ };
+
+ const calendarUrlFor = (
+ view: CalendarView,
+ query: PublishQuery = filterQuery(),
+ ): string => {
+ if (filled(props.channel)) {
+ return channelCalendar.url(
+ { account: props.channel.id, view },
+ { query },
+ );
+ }
+
+ return calendar.url({ view }, { query });
+ };
+
+ const boardUrlFor = (query: PublishQuery = filterQuery()): string => {
+ if (filled(props.channel)) {
+ return channelBoard.url(props.channel.id, { query });
+ }
+
+ return board.url({ query });
+ };
+
+ const calendarView = useOpeningCalendarView();
+
+ const listHref = computed((): string => listUrlFor());
+
+ const calendarHref = computed((): string =>
+ calendarUrlFor(calendarView.value),
+ );
+
+ const boardHref = computed((): string => boardUrlFor());
+
+ return {
+ timezone,
+ setTimezone,
+ dayKey,
+ selectedLabelIds,
+ selectedUntagged,
+ selectedChannelIds,
+ filterQuery,
+ listUrlFor,
+ calendarUrlFor,
+ boardUrlFor,
+ listHref,
+ calendarHref,
+ boardHref,
+ };
+};
diff --git a/resources/js/composables/useChannelOrder.ts b/resources/js/composables/useChannelOrder.ts
index b27c28447..d77b5afef 100644
--- a/resources/js/composables/useChannelOrder.ts
+++ b/resources/js/composables/useChannelOrder.ts
@@ -27,6 +27,9 @@ const ITEM_KEY = 'sortableChannel';
const LIST_KEY = 'sortableChannelList';
const CHANNEL_ORDER_PROPS = ['channels', 'connectedChannels'];
+/** The channels settings list pages by scroll: a new order starts it again from the top, never appended. */
+const CHANNEL_ORDER_RESET = ['connectedChannels'];
+
const optimisticOrder = ref<string[] | null>(null);
const saving = ref(false);
let queuedOrder: string[] | null = null;
@@ -73,7 +76,7 @@ const saveChannelOrder = (orderedIds: string[]): void => {
queuedOrder = null;
optimisticOrder.value = null;
toast.error(message, { testId: 'channels-reorder-error-toast' });
- router.reload({ only: CHANNEL_ORDER_PROPS });
+ router.reload({ only: CHANNEL_ORDER_PROPS, reset: CHANNEL_ORDER_RESET });
};
router.put(
@@ -83,6 +86,7 @@ const saveChannelOrder = (orderedIds: string[]): void => {
preserveScroll: true,
preserveState: true,
only: CHANNEL_ORDER_PROPS,
+ reset: CHANNEL_ORDER_RESET,
onError: (errors) =>
rollback(
errors.social_account_ids ??
diff --git a/resources/js/composables/useComposerAutosave.ts b/resources/js/composables/useComposerAutosave.ts
index a34537d14..7c3bd3590 100644
--- a/resources/js/composables/useComposerAutosave.ts
+++ b/resources/js/composables/useComposerAutosave.ts
@@ -13,13 +13,43 @@ import {
updateBrowserStorage,
writeWorkspaceItem,
} from '@/lib/browserStorage';
+import { filled } from '@/lib/helpers';
import { moveLegacyBrowserStorage } from '@/lib/legacyBrowserStorage';
import { classify, MediaType } from '@/lib/mediaType';
import type { SharedData } from '@/types';
+import type { SidebarChannel } from '@/types/channel';
import type { MediaItem, MediaSource, SourceMetaValue } from '@/types/media';
export const AUTOSAVE_DEBOUNCE_MS = 800;
+/**
+ * Bumped each time this tab writes or drops a draft, and when another tab
+ * changes the browser storage, so `useHasUnfinishedPost` reads it again: the
+ * drafts are written through the storage lib, which tells no ref of this tab.
+ */
+const draftChanges = ref(0);
+
+const draftChanged = (): void => {
+ draftChanges.value += 1;
+};
+
+/** Read inside a computed, it makes the computed read the draft again on every change. */
+const trackDraftChanges = (): void => {
+ void draftChanges.value;
+};
+
+let followsOtherTabs = false;
+
+/** Listens once per tab for a draft written or dropped in another tab. */
+const followOtherTabs = (): void => {
+ if (followsOtherTabs) {
+ return;
+ }
+
+ followsOtherTabs = true;
+ window.addEventListener('storage', draftChanged);
+};
+
export interface AutosaveMediaRef {
id: string;
upload_token?: string | null;
@@ -104,6 +134,7 @@ export const clearComposerAutosave = (
}
writeWorkspaceItem(userId, workspaceId, 'composer.autosave', undefined);
+ draftChanged();
};
/** Drops the user's drafts in every workspace, on logout; their other items stay. */
@@ -117,6 +148,7 @@ export const clearAllComposerAutosaves = (userId: string): void => {
]),
),
}));
+ draftChanged();
};
const isSnapshot = (value: unknown): value is AutosaveSnapshot => {
@@ -173,6 +205,7 @@ export const useComposerAutosave = (): {
const write = (snapshot: AutosaveSnapshot): void => {
if (workspaceId) {
writeWorkspaceItem(userId, workspaceId, 'composer.autosave', snapshot);
+ draftChanged();
}
};
@@ -245,3 +278,50 @@ export const useAutosavePreview = (
.find(Boolean) ?? '',
),
});
+
+/**
+ * Whether a saved draft holds what the resume dialog offers back
+ * (`useAutosavePreview`): text, a channel that still exists, or media still
+ * within the upload retention.
+ */
+const isUnfinished = (
+ snapshot: AutosaveSnapshot | null,
+ channelIds: string[],
+): boolean => {
+ if (!filled(snapshot)) {
+ return false;
+ }
+
+ if (filled(snapshot.content.trim())) {
+ return true;
+ }
+
+ if (snapshot.accountIds.some((id) => channelIds.includes(id))) {
+ return true;
+ }
+
+ const retentionHours = mediaUploadLimits().upload_retention_hours;
+
+ return snapshot.media.some((item) => !isExpiredUpload(item, retentionHours));
+};
+
+/**
+ * Whether the current workspace has a new post left unfinished in this
+ * browser, the one the composer offers to resume: the sidebar's New button
+ * marks it. It follows the drafts written and dropped in this tab and others.
+ */
+export const useHasUnfinishedPost = (): ComputedRef<boolean> => {
+ const page = usePage<SharedData>();
+ followOtherTabs();
+
+ return computed((): boolean => {
+ const { auth } = page.props;
+ const channels = (page.props.channels ?? []) as SidebarChannel[];
+ trackDraftChanges();
+
+ return isUnfinished(
+ read(auth.user.id, auth.currentWorkspace?.id),
+ channels.map((channel) => channel.id),
+ );
+ });
+};
diff --git a/resources/js/composables/usePostCardActions.ts b/resources/js/composables/usePostCardActions.ts
index d2f836be4..2f2664252 100644
--- a/resources/js/composables/usePostCardActions.ts
+++ b/resources/js/composables/usePostCardActions.ts
@@ -1,6 +1,6 @@
import { router, usePage } from '@inertiajs/vue3';
import { trans, transChoice } from 'laravel-vue-i18n';
-import type { InjectionKey, Ref } from 'vue';
+import { inject, type InjectionKey, type Ref } from 'vue';
import { toast } from 'vue-sonner';
import { duplicate as duplicatePost } from '@/actions/App/Http/Controllers/App/PostController';
@@ -8,6 +8,7 @@ import { update as updatePostLabels } from '@/actions/App/Http/Controllers/App/P
import { update as updatePostSchedule } from '@/actions/App/Http/Controllers/App/PostScheduleController';
import { openPostComposer } from '@/composables/useGlobalPostComposer';
import { filled } from '@/lib/helpers';
+import { rememberInAppPush } from '@/lib/inAppHistory';
import { postPermalink } from '@/lib/postNetwork';
import { copyToClipboard } from '@/lib/utils';
import type { SidebarChannel } from '@/types/channel';
@@ -26,6 +27,36 @@ export const editPostCardUrlKey: InjectionKey<(post: PostCard) => string> =
export const postCardLabelsKey: InjectionKey<Readonly<Ref<PostCardLabel[]>>> =
Symbol('postCardLabels');
+export interface PostCardReload {
+ only: string[];
+ reset: string[];
+}
+
+/** What a List card's approval action (approve, reject, take back) reloads. */
+export const POST_CARD_APPROVAL_RELOAD: PostCardReload = {
+ only: ['posts', 'counts', 'queue', 'hasData'],
+ reset: ['posts'],
+};
+
+/** What a List card's label change reloads. */
+export const POST_CARD_LABELS_RELOAD: PostCardReload = {
+ only: ['posts', 'queue'],
+ reset: ['posts'],
+};
+
+/** The props a card action reloads, when the page lists its posts under other props than `posts`. */
+export const postCardReloadKey: InjectionKey<() => PostCardReload> =
+ Symbol('postCardReload');
+
+/** The reload a page asks its card actions for (the board's columns); none on the List, which does a full visit. */
+export const usePageReload = (): (() => Partial<PostCardReload>) =>
+ inject(postCardReloadKey, () => ({}));
+
+/** The reload a card action sends: the page's own when it provides one, else the List's. */
+export const usePostCardReload = (
+ fallback: PostCardReload,
+): (() => PostCardReload) => inject(postCardReloadKey, () => fallback);
+
const successMessage = (
action: PostScheduleAction,
requestsApproval: boolean,
@@ -54,6 +85,8 @@ export const schedulePostCard = (
only?: string[];
reset?: string[];
requestsApproval?: boolean;
+ onStart?: () => void;
+ onFinish?: () => void;
} = {},
): void => {
const { requestsApproval = false, ...reload } = options;
@@ -77,7 +110,11 @@ export const schedulePostCard = (
};
export const duplicatePostCard = (post: PostCard): void => {
- router.post(duplicatePost.url(post.id));
+ router.post(
+ duplicatePost.url(post.id),
+ {},
+ { onSuccess: rememberInAppPush },
+ );
};
/** Opens the composer with the sent post's link and every channel of the workspace. */
@@ -113,6 +150,7 @@ export const syncPostCardLabels = (
postId: string,
labelIds: string[],
rollback: () => void,
+ reload: PostCardReload = POST_CARD_LABELS_RELOAD,
): void => {
const fail = (): void => {
rollback();
@@ -127,8 +165,7 @@ export const syncPostCardLabels = (
{
preserveScroll: true,
preserveState: true,
- only: ['posts', 'queue'],
- reset: ['posts'],
+ ...reload,
onError: fail,
onHttpException: () => {
fail();
diff --git a/resources/js/composables/usePostStatus.ts b/resources/js/composables/usePostStatus.ts
index 87262575c..aaaed7245 100644
--- a/resources/js/composables/usePostStatus.ts
+++ b/resources/js/composables/usePostStatus.ts
@@ -1,6 +1,5 @@
import {
IconAlertCircle,
- IconBan,
IconCircleCheck,
IconClock,
IconEdit,
@@ -9,11 +8,22 @@ import {
IconLoader2,
IconTrashX,
} from '@tabler/icons-vue';
-import { trans } from 'laravel-vue-i18n';
import { isDeletedOnNetwork } from '@/lib/postNetwork';
+import { PostStatus, PublishStatus, type PostStatusValue } from '@/types/post';
import type { PostCard } from '@/types/publish';
+/**
+ * The status a post's badge shows: its lifecycle status, or what the network
+ * says about it once that matters more (in Google's review, deleted on the
+ * network). Its label is always `posts.status.<status>`.
+ */
+export type PostDisplayStatus =
+ | PostStatusValue
+ | 'retrying'
+ | 'pending_review'
+ | 'deleted_on_network';
+
type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'destructive-subtle' | 'success' | 'warning' | 'info' | 'outline';
interface StatusConfig {
@@ -21,34 +31,37 @@ interface StatusConfig {
icon: typeof IconFileText;
/** In-flight statuses spin their icon so they never read as stuck. */
iconClass?: string;
- label: string;
+ /** The label's lang key, for templates to resolve with `$t`. */
+ labelKey: string;
}
-const CONFIGS: Record<string, Pick<StatusConfig, 'variant' | 'icon' | 'iconClass'>> = {
+const CONFIGS: Record<PostDisplayStatus, Omit<StatusConfig, 'labelKey'>> = {
draft: { variant: 'info', icon: IconEdit },
- pending_approval: { variant: 'warning', icon: IconEdit },
+ pending_approval: { variant: 'secondary', icon: IconHourglass },
scheduled: { variant: 'default', icon: IconClock },
publishing: { variant: 'warning', icon: IconLoader2, iconClass: 'animate-spin' },
retrying: { variant: 'warning', icon: IconLoader2, iconClass: 'animate-spin' },
published: { variant: 'success', icon: IconCircleCheck },
failed: { variant: 'destructive-subtle', icon: IconAlertCircle },
- rejected: { variant: 'destructive-subtle', icon: IconBan },
pending_review: { variant: 'warning', icon: IconHourglass },
+ deleted_on_network: { variant: 'destructive-subtle', icon: IconTrashX },
};
-export const getPostStatusConfig = (status: string): StatusConfig => {
- const config = CONFIGS[status] ?? CONFIGS.draft;
- return { ...config, label: trans(`posts.status.${status}`) };
-};
-
-export const getDeletedOnNetworkStatusConfig = (): StatusConfig => ({
- variant: 'destructive-subtle',
- icon: IconTrashX,
- label: trans('posts.publish.deleted_on_network.badge'),
+/** How a status's badge looks and which lang key names it. */
+export const getPostStatusConfig = (status: PostDisplayStatus): StatusConfig => ({
+ ...CONFIGS[status],
+ labelKey: `posts.status.${status}`,
});
-/** A post's status, reading as deleted once the network deleted it. */
-export const getPostCardStatusConfig = (post: PostCard): StatusConfig =>
- isDeletedOnNetwork(post)
- ? getDeletedOnNetworkStatusConfig()
- : getPostStatusConfig(post.status);
+/** What a post's badge shows: deleted on the network, in Google's review, else its status. */
+export const postDisplayStatus = (post: PostCard): PostDisplayStatus => {
+ if (isDeletedOnNetwork(post)) {
+ return 'deleted_on_network';
+ }
+
+ if (post.status === PostStatus.Publishing && post.publish_status === PublishStatus.PendingReview) {
+ return 'pending_review';
+ }
+
+ return post.status;
+};
diff --git a/resources/js/composables/usePublishView.ts b/resources/js/composables/usePublishView.ts
new file mode 100644
index 000000000..0fd030506
--- /dev/null
+++ b/resources/js/composables/usePublishView.ts
@@ -0,0 +1,102 @@
+import { computed, type ComputedRef } from 'vue';
+
+import { useActiveUrl } from '@/composables/useActiveUrl';
+import { useBelowBreakpoint } from '@/composables/useBreakpoint';
+import { useUserStorage } from '@/composables/useBrowserStorage';
+import { calendar } from '@/routes/app';
+import {
+ board as channelBoard,
+ calendar as channelCalendar,
+ publish as channelPublish,
+} from '@/routes/app/channels';
+import { board, index as postsIndex } from '@/routes/app/posts';
+import {
+ type CalendarView,
+ PUBLISH_VIEWS,
+ type PublishView,
+} from '@/types/publish';
+
+/** The calendar view a Publish link opens: days on a phone, the week elsewhere. */
+export const useOpeningCalendarView = (): ComputedRef<CalendarView> => {
+ const isPhone = useBelowBreakpoint('md');
+
+ return computed((): CalendarView => {
+ if (isPhone.value) {
+ return 'days';
+ }
+
+ return 'week';
+ });
+};
+
+/**
+ * The Publish view (list, calendar or board) the user last opened, kept in the
+ * browser storage, so the Publish links of the menu and of each channel open it again.
+ */
+export const usePublishView = (): {
+ publishView: ComputedRef<PublishView>;
+ rememberPublishView: (view: PublishView) => void;
+ publishUrl: ComputedRef<string>;
+ channelPublishUrl: (channelId: string) => string;
+ isChannelPublishPage: (channelId: string) => boolean;
+} => {
+ const stored = useUserStorage('publish.view', 'list');
+ const { urlIsActive } = useActiveUrl();
+
+ /** The stored view when it is still one of the views, else the list. */
+ const publishView = computed((): PublishView => {
+ if (PUBLISH_VIEWS.includes(stored.value)) {
+ return stored.value;
+ }
+
+ return 'list';
+ });
+
+ const calendarView = useOpeningCalendarView();
+
+ const rememberPublishView = (view: PublishView): void => {
+ if (stored.value !== view) {
+ stored.value = view;
+ }
+ };
+
+ const publishUrl = computed((): string => {
+ if (publishView.value === 'calendar') {
+ return calendar.url({ view: calendarView.value });
+ }
+
+ if (publishView.value === 'board') {
+ return board.url();
+ }
+
+ return postsIndex.url();
+ });
+
+ const channelPublishUrl = (channelId: string): string => {
+ if (publishView.value === 'calendar') {
+ return channelCalendar.url({ account: channelId, view: calendarView.value });
+ }
+
+ if (publishView.value === 'board') {
+ return channelBoard.url(channelId);
+ }
+
+ return channelPublish.url(channelId);
+ };
+
+ /** Whether the page is one of a channel's Publish views, so its Publish link shows as current on any of them. */
+ const isChannelPublishPage = (channelId: string): boolean =>
+ [
+ channelPublish.url(channelId),
+ channelCalendar.url({ account: channelId }),
+ channelBoard.url(channelId),
+ ].some((url) => urlIsActive(url));
+
+ return {
+ publishView,
+ rememberPublishView,
+ publishUrl,
+ channelPublishUrl,
+ isChannelPublishPage,
+ };
+};
diff --git a/resources/js/layouts/SettingsLayout.vue b/resources/js/layouts/SettingsLayout.vue
index 91d1d1213..cbd54e730 100644
--- a/resources/js/layouts/SettingsLayout.vue
+++ b/resources/js/layouts/SettingsLayout.vue
@@ -1,29 +1,59 @@
<script setup lang="ts">
import { IconExternalLink } from '@tabler/icons-vue';
+import { computed } from 'vue';
+import HeaderTitle from '@/components/HeaderTitle.vue';
import SettingsSidebar from '@/components/settings/SettingsSidebar.vue';
import AppSidebarLayout from '@/layouts/app/AppSidebarLayout.vue';
type Props = {
fullWidth?: boolean;
centered?: boolean;
+ /** A page of columns (the channels list) gets more room than a form. */
+ wide?: boolean;
+ /** How many items the page lists, shown after the title: "Channels (12)". */
+ total?: number | null;
title?: string;
description?: string;
/** Docs page linked as "Learn more" at the end of the description. */
learnMoreUrl?: string;
};
-withDefaults(defineProps<Props>(), {
+const props = withDefaults(defineProps<Props>(), {
fullWidth: false,
centered: false,
+ wide: false,
+ total: null,
title: undefined,
description: undefined,
learnMoreUrl: undefined,
});
+
+/** The page drops the sidebar layout's width cap when it asks for full width, centers its content or is wide. */
+const layoutFullWidth = computed((): boolean => {
+ if (props.fullWidth) {
+ return true;
+ }
+
+ if (props.centered) {
+ return true;
+ }
+
+ return props.wide;
+});
+
+/** A page of columns (the channels list) gets more room than a form. */
+const pageWidth = computed((): string => {
+ if (props.wide) {
+ return 'max-w-[1120px]';
+ }
+
+ return 'max-w-[664px]';
+});
</script>
<template>
- <AppSidebarLayout :full-width="fullWidth || centered">
+ <AppSidebarLayout :full-width="layoutFullWidth">
<template #sidebar>
<SettingsSidebar />
</template>
@@ -46,17 +76,13 @@ withDefaults(defineProps<Props>(), {
<div
v-else-if="title"
- class="mx-auto flex w-full max-w-[664px] flex-col gap-8 px-4 pt-2 pb-16 md:px-8 md:pt-10"
+ class="mx-auto flex w-full flex-col gap-8 px-4 pt-2 pb-16 md:px-8 md:pt-10"
+ :class="pageWidth"
data-testid="settings-page"
>
<header class="flex items-start justify-between gap-3">
<div class="min-w-0">
- <h1
- class="font-heading text-xl leading-tight font-medium text-foreground"
- data-testid="header-title"
- >
- {{ title }}
- </h1>
+ <HeaderTitle :title="title" :total="total" />
<p
v-if="description"
class="mt-1 text-sm text-muted-foreground"
diff --git a/resources/js/lib/inAppHistory.ts b/resources/js/lib/inAppHistory.ts
index 565d41d46..1c6afba61 100644
--- a/resources/js/lib/inAppHistory.ts
+++ b/resources/js/lib/inAppHistory.ts
@@ -1,29 +1,46 @@
+import type { ActiveVisit } from '@inertiajs/core';
import { router } from '@inertiajs/vue3';
+import { blank, filled } from '@/lib/helpers';
+
let pushedUrl: string | null = null;
+/** A completed GET that pushed a whole page: no replace, no prefetch, no partial reload. */
+const pushedAPage = (visit: ActiveVisit): boolean => {
+ if (visit.method !== 'get' || !visit.completed) {
+ return false;
+ }
+
+ if (visit.replace || visit.prefetch) {
+ return false;
+ }
+
+ return blank(visit.only) && blank(visit.except);
+};
+
/**
* Remembers the URL of the last page the app pushed onto the browser history
- * with a full visit (a link or `router.visit`: no replace, no partial reload,
- * no prefetch). Back and forward make no visit, and a reload starts empty.
+ * with a full visit (a link or `router.visit`). Back and forward make no visit,
+ * and a reload starts empty.
*/
export const trackInAppPushes = (): void => {
router.on('finish', (event) => {
- const visit = event.detail.visit;
-
- if (
- visit.method === 'get' &&
- visit.completed &&
- !visit.replace &&
- !visit.prefetch &&
- visit.only.length === 0 &&
- visit.except.length === 0
- ) {
+ if (pushedAPage(event.detail.visit)) {
pushedUrl = window.location.href;
}
});
};
+/**
+ * Marks the current history entry as pushed by the app, for a visit that is
+ * not a plain GET but still pushed a page on top of the one it was sent from:
+ * duplicating a post sends a POST that lands on the copy's composer, so closing
+ * that composer goes back to the List, Calendar or Board it was duplicated from.
+ */
+export const rememberInAppPush = (): void => {
+ pushedUrl = window.location.href;
+};
+
/**
* Whether the app pushed the current history entry, so the entry behind it is
* another page of the app the user can be sent back to. A partial reload may
@@ -31,19 +48,19 @@ export const trackInAppPushes = (): void => {
* still counts while its path and every parameter it was pushed with match.
*/
export const cameFromAppPage = (): boolean => {
- if (pushedUrl === null) {
+ if (!filled(pushedUrl)) {
return false;
}
const pushed = new URL(pushedUrl);
const current = new URL(window.location.href);
- return (
- pushed.origin === current.origin &&
- pushed.pathname === current.pathname &&
- [...pushed.searchParams].every(
- ([key, value]) => current.searchParams.get(key) === value,
- )
+ if (pushed.origin !== current.origin || pushed.pathname !== current.pathname) {
+ return false;
+ }
+
+ return [...pushed.searchParams].every(
+ ([key, value]) => current.searchParams.get(key) === value,
);
};
@@ -55,7 +72,7 @@ export const cameFromAppPage = (): boolean => {
* for a page that unmounts before the write.
*/
export const afterPageInHistory = (then: () => void): (() => void) => {
- if (window.history.state?.page) {
+ if (filled(window.history.state?.page)) {
then();
return () => {};
@@ -94,7 +111,7 @@ export const stepBackInHistory = (): void => {
* right away when none is under way.
*/
export const afterHistorySettles = (then: () => void): void => {
- if (settling) {
+ if (filled(settling)) {
void settling.then(then);
return;
diff --git a/resources/js/lib/labelColor.ts b/resources/js/lib/labelColor.ts
new file mode 100644
index 000000000..ca059d049
--- /dev/null
+++ b/resources/js/lib/labelColor.ts
@@ -0,0 +1,45 @@
+/**
+ * White text keeps a contrast of at least 3:1 (WCAG's minimum for short, bold
+ * text) on a color up to this relative luminance: (1 + 0.05) / (0.3 + 0.05).
+ */
+const WHITE_TEXT_UP_TO_LUMINANCE = 0.3;
+
+/** A label's color as every entry point stores it (`LabelRequestRules`). */
+const HEX_COLOR = /^#[0-9a-f]{6}$/i;
+
+const DARK_TEXT = '#0a0a0a';
+const LIGHT_TEXT = '#ffffff';
+
+/** One sRGB channel (0–255) as linear light, as WCAG measures it. */
+const linear = (channel: number): number => {
+ const value = channel / 255;
+
+ if (value <= 0.04045) {
+ return value / 12.92;
+ }
+
+ return ((value + 0.055) / 1.055) ** 2.4;
+};
+
+/**
+ * The text color of a label's chip on its color (`#RRGGBB`): white whenever it
+ * still reads (green, blue, red, purple), near black only on a light color
+ * (light gray, yellow) where white would fade. Anything else is no color to
+ * read, so it gets none and the chip keeps the theme's text color.
+ */
+export const labelTextColor = (hex: string): string | undefined => {
+ if (!HEX_COLOR.test(hex)) {
+ return undefined;
+ }
+
+ const [red, green, blue] = [1, 3, 5].map((start) =>
+ linear(Number.parseInt(hex.slice(start, start + 2), 16)),
+ );
+ const luminance = 0.2126 * red + 0.7152 * green + 0.0722 * blue;
+
+ if (luminance <= WHITE_TEXT_UP_TO_LUMINANCE) {
+ return LIGHT_TEXT;
+ }
+
+ return DARK_TEXT;
+};
diff --git a/resources/js/lib/postCard.ts b/resources/js/lib/postCard.ts
new file mode 100644
index 000000000..1ce13937f
--- /dev/null
+++ b/resources/js/lib/postCard.ts
@@ -0,0 +1,65 @@
+import { getPlatformLabel } from '@/composables/usePlatformLogo';
+import { filled } from '@/lib/helpers';
+import { isImage, isVideo } from '@/lib/mediaType';
+import type { MediaItem } from '@/types/media';
+import { PostStatus } from '@/types/post';
+import type { PostCard } from '@/types/publish';
+
+/** The channel a card names: the account's label, else the network's name; none without a channel. */
+export const postChannelLabel = (post: PostCard): string => {
+ if (!filled(post.platform)) {
+ return '';
+ }
+
+ if (filled(post.social_account?.display_label)) {
+ return post.social_account.display_label;
+ }
+
+ return getPlatformLabel(post.platform);
+};
+
+/** When the post went out or is due; none for a draft or approval request without a time. */
+export const postShownAt = (post: PostCard): string | null => {
+ if (filled(post.published_at)) {
+ return post.published_at;
+ }
+
+ if (filled(post.scheduled_at)) {
+ return post.scheduled_at;
+ }
+
+ return null;
+};
+
+/** When the post went out, is due, or was created: the instant its list and board sort by (`Post::scopeLatestAttempt`). */
+export const postAttemptAt = (post: PostCard): string => {
+ const shownAt = postShownAt(post);
+
+ if (filled(shownAt)) {
+ return shownAt;
+ }
+
+ return post.created_at;
+};
+
+/** What a post without a time shows: the queue slot its approval request asks for, else "No time". */
+export const postNoTimeKey = (post: PostCard): string => {
+ const slot = post.approval_queue_position;
+
+ if (post.status === PostStatus.PendingApproval && filled(slot)) {
+ return `posts.publish.pending_slot.${slot}`;
+ }
+
+ return 'posts.publish.no_time';
+};
+
+/** The first image or video of the post, shown as the card's thumbnail. */
+export const postThumbnail = (post: PostCard): MediaItem | null => {
+ const thumbnail = post.media?.find((item) => isImage(item) || isVideo(item));
+
+ if (!filled(thumbnail)) {
+ return null;
+ }
+
+ return thumbnail;
+};
diff --git a/resources/js/lib/utils.ts b/resources/js/lib/utils.ts
index ec0cf77fa..a334968a9 100644
--- a/resources/js/lib/utils.ts
+++ b/resources/js/lib/utils.ts
@@ -49,9 +49,14 @@ const withDash =
return format(value, ...args);
};
+/**
+ * A count in thousands or millions, written the same in every language:
+ * "1.5K", "10K", "1.2M" (a short count, never an amount in the reader's
+ * number format like "1,5 mil").
+ */
export const formatNumberCompact = withDash(
(value: number, digits: number = 1): string =>
- new Intl.NumberFormat(activeLocale.value, {
+ new Intl.NumberFormat('en-US', {
notation: 'compact',
compactDisplay: 'short',
maximumFractionDigits: digits,
@@ -101,10 +106,10 @@ export const formatFullNumber = withDash(
(value: number): string => value.toLocaleString(activeLocale.value),
);
-/** A change in a count, signed and compact: "+1.2K", "-3", "0". */
+/** A change in a count, signed and compact, the same in every language: "+1.2K", "-3", "0". */
export const formatCountChange = withDash(
(value: number): string =>
- new Intl.NumberFormat(activeLocale.value, {
+ new Intl.NumberFormat('en-US', {
notation: 'compact',
compactDisplay: 'short',
maximumFractionDigits: 1,
diff --git a/resources/js/pages/channels/Grid.vue b/resources/js/pages/channels/Grid.vue
index f45118aa0..dfaa6b454 100644
--- a/resources/js/pages/channels/Grid.vue
+++ b/resources/js/pages/channels/Grid.vue
@@ -25,6 +25,7 @@ import AppLayout from '@/layouts/AppLayout.vue';
import { isVideo } from '@/lib/mediaType';
import { videoFrameUrl } from '@/lib/videoFrame';
import {
+ board as channelBoard,
calendar as channelCalendar,
grid,
publish,
@@ -84,6 +85,7 @@ const openLightbox = (tile: GridTile): void => {
})
"
:grid-href="grid.url(channel.id)"
+ :board-href="channelBoard.url(channel.id)"
/>
<NewPostButton :social-account-ids="[channel.id]" />
</div>
diff --git a/resources/js/pages/insights/Index.vue b/resources/js/pages/insights/Index.vue
index b3a596b14..5969413ca 100644
--- a/resources/js/pages/insights/Index.vue
+++ b/resources/js/pages/insights/Index.vue
@@ -15,10 +15,12 @@ import SummaryCards from '@/components/analytics/workspace/SummaryCards.vue';
import TopPosts from '@/components/analytics/workspace/TopPosts.vue';
import EmptyState from '@/components/EmptyState.vue';
import HeaderTitle from '@/components/HeaderTitle.vue';
+import LabelFilter from '@/components/labels/LabelFilter.vue';
import PostChannelFilter from '@/components/posts/PostChannelFilter.vue';
import { useAnalyticsCoveragePoll } from '@/composables/useAnalyticsCoveragePoll';
import AppLayout from '@/layouts/AppLayout.vue';
import { accountColor } from '@/lib/analyticsColors';
+import { filled } from '@/lib/helpers';
import { insights as insightsRoute } from '@/routes/app';
import type {
AnalyticsChannelOption,
@@ -26,29 +28,71 @@ import type {
SummaryMetric,
WorkspaceAnalyticsReport,
} from '@/types/analytics';
+import type { PostCardLabel } from '@/types/publish';
const props = defineProps<{
report: WorkspaceAnalyticsReport;
channelOptions: AnalyticsChannelOption[];
+ labels: PostCardLabel[];
availableMetrics: SummaryMetric[] | null;
sync: InsightsSyncCadence;
}>();
const selectedChannelIds = ref<string[]>([...props.report.filters.channels]);
+const selectedLabelIds = ref<string[]>([...props.report.filters.labels]);
+const selectedUntagged = ref<boolean>(props.report.filters.untagged);
-const filterQuery = computed((): Record<string, string | string[]> => ({
- ...(selectedChannelIds.value.length
- ? { channels: selectedChannelIds.value }
- : {}),
-}));
+/** The channels and labels picked, as the page's query (an empty pick is left out). */
+const filterQuery = computed((): Record<string, string | string[]> => {
+ const query: Record<string, string | string[]> = {};
-const filtered = computed(() => props.report.filters.channels.length > 0);
+ if (filled(selectedChannelIds.value)) {
+ query.channels = selectedChannelIds.value;
+ }
+
+ if (filled(selectedLabelIds.value)) {
+ query.labels = selectedLabelIds.value;
+ }
+
+ if (selectedUntagged.value) {
+ query.untagged = '1';
+ }
+
+ return query;
+});
+
+/** Followers follow the channels only: labels narrow the post metrics. */
+const channelFiltered = computed(() => filled(props.report.filters.channels));
+
+/** Whether the post metrics are narrowed, by channel or by label. */
+const filtered = computed((): boolean => {
+ if (channelFiltered.value) {
+ return true;
+ }
+
+ if (props.report.filters.untagged) {
+ return true;
+ }
+
+ return filled(props.report.filters.labels);
+});
const sameIds = (left: string[], right: string[]): boolean =>
left.length === right.length && left.every((id) => right.includes(id));
-const selectionMatchesServer = (): boolean =>
- sameIds(selectedChannelIds.value, props.report.filters.channels);
+const selectionMatchesServer = (): boolean => {
+ const { channels, labels, untagged } = props.report.filters;
+
+ if (!sameIds(selectedChannelIds.value, channels)) {
+ return false;
+ }
+
+ if (!sameIds(selectedLabelIds.value, labels)) {
+ return false;
+ }
+
+ return selectedUntagged.value === untagged;
+};
watch(
() => props.report.filters,
@@ -56,20 +100,29 @@ watch(
if (!sameIds(selectedChannelIds.value, filters.channels)) {
selectedChannelIds.value = [...filters.channels];
}
+
+ if (!sameIds(selectedLabelIds.value, filters.labels)) {
+ selectedLabelIds.value = [...filters.labels];
+ }
+
+ if (selectedUntagged.value !== filters.untagged) {
+ selectedUntagged.value = filters.untagged;
+ }
},
);
-const rangeQuery = (): Record<string, string> =>
- props.report.filters.range === 'custom'
- ? {
- range: 'custom',
- start: props.report.filters.start,
- end: props.report.filters.end,
- }
- : { range: props.report.filters.range };
+const rangeQuery = (): Record<string, string> => {
+ const { range, start, end } = props.report.filters;
+
+ if (range === 'custom') {
+ return { range, start, end };
+ }
+
+ return { range };
+};
watch(
- [selectedChannelIds],
+ [selectedChannelIds, selectedLabelIds, selectedUntagged],
() => {
if (selectionMatchesServer()) {
return;
@@ -149,6 +202,13 @@ const accountColors = computed<Record<string, string>>(() => {
test-id="analytics-channel"
sheet-below-sm
/>
+ <LabelFilter
+ v-model="selectedLabelIds"
+ v-model:untagged="selectedUntagged"
+ :labels="labels"
+ test-id="analytics-label"
+ sheet-below-sm
+ />
</div>
</div>
</header>
@@ -156,7 +216,7 @@ const accountColors = computed<Record<string, string>>(() => {
<ImportCoverage :coverage="report.coverage" />
<EmptyState
- v-if="!report.bounds.min && report.filters.channels.length"
+ v-if="!report.bounds.min && channelFiltered"
data-testid="analytics-filtered-empty-state"
:icon="IconTrendingUp"
:title="$t('analytics.dashboard.filtered_no_data_title')"
@@ -188,8 +248,8 @@ const accountColors = computed<Record<string, string>>(() => {
:followers="report.followers"
:range="report.range"
:colors="accountColors"
- :filtered="report.filters.channels.length > 0"
- :channel-filtered="report.filters.channels.length > 0"
+ :filtered="channelFiltered"
+ :channel-filtered="channelFiltered"
:total-channels="channelOptions.length"
/>
<PostsChart
@@ -197,7 +257,7 @@ const accountColors = computed<Record<string, string>>(() => {
:range="report.range"
:colors="accountColors"
:filtered="filtered"
- :channel-filtered="report.filters.channels.length > 0"
+ :channel-filtered="channelFiltered"
:total-channels="channelOptions.length"
/>
</template>
diff --git a/resources/js/pages/labels/Index.vue b/resources/js/pages/labels/Index.vue
index 01c9c4c04..995daef24 100644
--- a/resources/js/pages/labels/Index.vue
+++ b/resources/js/pages/labels/Index.vue
@@ -3,10 +3,10 @@ import { Head, InfiniteScroll, router } from '@inertiajs/vue3';
import {
IconDotsVertical,
IconLayoutGrid,
- IconPencil,
IconPlus,
- IconTag,
+ IconSettings,
IconTrash,
+ IconTrendingUp,
} from '@tabler/icons-vue';
import { ref, watch } from 'vue';
@@ -26,8 +26,14 @@ import {
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import { TableLoadMore } from '@/components/ui/table';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
import debounce from '@/debounce';
import SettingsLayout from '@/layouts/SettingsLayout.vue';
+import { insights as insightsRoute } from '@/routes/app';
import {
destroy as labelsDestroy,
index as labelsIndex,
@@ -157,80 +163,109 @@ const labelQuery = (label: Label) => ({ query: { labels: [label.id] } });
<SettingsListRow
v-for="label in labels.data"
:key="label.id"
- class="cursor-pointer"
:data-testid="`label-row-${label.id}`"
- @click="openEditDialog(label)"
>
<template #media>
<span
- class="relative inline-flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-lg"
- :style="{ color: label.color }"
+ class="size-4 shrink-0 rounded-full"
+ :style="{ backgroundColor: label.color }"
+ aria-hidden="true"
:data-testid="`label-swatch-${label.id}`"
- >
- <span
- class="absolute inset-0 bg-current opacity-15"
- />
- <IconTag class="relative size-5" />
- </span>
+ />
</template>
- <p
- class="truncate text-sm leading-tight font-emphasis text-foreground"
- >
- {{ label.name }}
- </p>
- <p
- class="flex flex-wrap items-center gap-x-1.5 text-sm text-muted-foreground"
- >
- <span :data-testid="`label-posts-count-${label.id}`">{{
- $tChoice('labels.meta.posts', label.posts_count, {
- count: String(label.posts_count),
- })
- }}</span>
- </p>
+ <div class="flex min-w-0 items-center gap-2">
+ <p
+ class="min-w-0 truncate text-sm leading-tight font-emphasis text-foreground"
+ >
+ {{ label.name }}
+ </p>
+ <span
+ class="inline-flex h-5 shrink-0 items-center rounded-full bg-secondary px-2 text-xs font-medium text-muted-foreground tabular-nums"
+ :data-testid="`label-posts-count-${label.id}`"
+ >{{
+ $tChoice('labels.meta.posts', label.posts_count, {
+ count: String(label.posts_count),
+ })
+ }}</span
+ >
+ </div>
<template #actions>
- <DropdownMenu>
- <DropdownMenuTrigger as-child>
+ <Tooltip>
+ <TooltipTrigger as-child>
<Button
variant="ghost"
size="icon"
- class="shrink-0 text-muted-foreground data-[state=open]:bg-accent"
- :aria-label="$t('labels.actions.more')"
- :data-testid="`label-menu-${label.id}`"
- @click.stop
- >
- <IconDotsVertical class="size-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" @click.stop>
- <DropdownMenuItem
- :data-testid="`edit-label-${label.id}`"
+ class="shrink-0 text-muted-foreground"
+ :aria-label="$t('labels.actions.settings')"
+ :data-testid="`label-settings-${label.id}`"
@click="openEditDialog(label)"
>
- <IconPencil class="size-4" />
- {{ $t('labels.actions.edit') }}
- </DropdownMenuItem>
- <DropdownMenuItem as-child>
- <a
- :href="postsIndex.url(labelQuery(label))"
- target="_blank"
- rel="noopener"
- :data-testid="`label-view-posts-${label.id}`"
- >
- <IconLayoutGrid class="size-4" />
- {{ $t('labels.actions.view_posts') }}
- </a>
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- variant="destructive"
- :data-testid="`delete-label-${label.id}`"
- @click="handleDelete(label)"
- >
- <IconTrash class="size-4" />
- {{ $t('labels.actions.delete') }}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <IconSettings class="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`label-settings-tooltip-${label.id}`"
+ >
+ {{ $t('labels.actions.settings') }}
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <span class="inline-flex">
+ <DropdownMenu>
+ <DropdownMenuTrigger as-child>
+ <Button
+ variant="ghost"
+ size="icon"
+ class="shrink-0 text-muted-foreground data-[state=open]:bg-accent"
+ :aria-label="$t('labels.actions.more')"
+ :data-testid="`label-menu-${label.id}`"
+ >
+ <IconDotsVertical class="size-4" />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem as-child>
+ <a
+ :href="postsIndex.url(labelQuery(label))"
+ target="_blank"
+ rel="noopener"
+ :data-testid="`label-view-posts-${label.id}`"
+ >
+ <IconLayoutGrid class="size-4" />
+ {{ $t('labels.actions.view_posts') }}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuItem as-child>
+ <a
+ :href="insightsRoute.url(labelQuery(label))"
+ target="_blank"
+ rel="noopener"
+ :data-testid="`label-view-insights-${label.id}`"
+ >
+ <IconTrendingUp class="size-4" />
+ {{ $t('labels.actions.view_insights') }}
+ </a>
+ </DropdownMenuItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ variant="destructive"
+ :data-testid="`delete-label-${label.id}`"
+ @click="handleDelete(label)"
+ >
+ <IconTrash class="size-4" />
+ {{ $t('labels.actions.delete') }}
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`label-menu-tooltip-${label.id}`"
+ >
+ {{ $t('labels.actions.more') }}
+ </TooltipContent>
+ </Tooltip>
</template>
</SettingsListRow>
</ul>
diff --git a/resources/js/pages/posts/Board.vue b/resources/js/pages/posts/Board.vue
new file mode 100644
index 000000000..49a2aedb5
--- /dev/null
+++ b/resources/js/pages/posts/Board.vue
@@ -0,0 +1,347 @@
+<script setup lang="ts">
+import { Head, router, usePage } from '@inertiajs/vue3';
+import { IconPlus, IconUsers } from '@tabler/icons-vue';
+import { useDebounceFn } from '@vueuse/core';
+import { computed, onUnmounted, provide, ref, watch } from 'vue';
+
+import { destroy as destroyPost } from '@/actions/App/Http/Controllers/App/PostController';
+import AppHeaderActions from '@/components/AppHeaderActions.vue';
+import ConfirmDeleteModal from '@/components/ConfirmDeleteModal.vue';
+import EmptyState from '@/components/EmptyState.vue';
+import LabelFilter from '@/components/labels/LabelFilter.vue';
+import InviteMemberDialog from '@/components/members/InviteMemberDialog.vue';
+import PostChannelFilter from '@/components/posts/PostChannelFilter.vue';
+import ScheduleViewSwitch from '@/components/posts/ScheduleViewSwitch.vue';
+import BoardColumn from '@/components/publish/board/BoardColumn.vue';
+import BoardGroupMenu from '@/components/publish/board/BoardGroupMenu.vue';
+import NewPostButton from '@/components/publish/NewPostButton.vue';
+import PublishEmptyIllustration from '@/components/publish/PublishEmptyIllustration.vue';
+import PublishFilterMenu from '@/components/publish/PublishFilterMenu.vue';
+import PublishHeader from '@/components/publish/PublishHeader.vue';
+import { Button } from '@/components/ui/button';
+import { TooltipProvider } from '@/components/ui/tooltip';
+import { useWorkspaceEcho } from '@/composables/echo/useWorkspaceEcho';
+import { usePublishFilters } from '@/composables/publish/usePublishFilters';
+import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
+import {
+ deletePostCardKey,
+ postCardLabelsKey,
+ type PostCardReload,
+ postCardReloadKey,
+} from '@/composables/usePostCardActions';
+import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
+import AppLayout from '@/layouts/AppLayout.vue';
+import { blank, filled } from '@/lib/helpers';
+import { grid } from '@/routes/app/channels';
+import type { BoardColumnMeta, BoardGroup } from '@/types/board';
+import { channelName } from '@/types/channel';
+import type { TimezoneOption } from '@/types/posting-schedule';
+import type {
+ PostCard,
+ PostCardLabel,
+ PublishChannel,
+ PublishScope,
+ PublishSocialAccount,
+} from '@/types/publish';
+
+interface Props {
+ scope: PublishScope;
+ channel: PublishChannel | null;
+ group: BoardGroup;
+ groups: BoardGroup[];
+ boardColumns: BoardColumnMeta[];
+ displayTimezone: string;
+ timezones: TimezoneOption[];
+ labels: PostCardLabel[];
+ filters: {
+ labels: string[];
+ untagged: boolean;
+ channels: string[];
+ };
+ filterAccounts: PublishSocialAccount[];
+ hasChannels: boolean;
+}
+
+const props = defineProps<Props>();
+const page = usePage();
+const { canManageAccounts, canManageTeam } = useWorkspaceAbilities();
+
+const {
+ timezone,
+ setTimezone,
+ selectedLabelIds,
+ selectedUntagged,
+ selectedChannelIds,
+ filterQuery,
+ boardUrlFor,
+ listHref,
+ calendarHref,
+} = usePublishFilters(props, { reloadProps: () => ['displayTimezone'] });
+
+const deleteModal = ref<InstanceType<typeof ConfirmDeleteModal> | null>(null);
+
+/** Deleting a card reloads the columns only, like the card's other actions, so the board keeps its loaded pages. */
+provide(deletePostCardKey, (post: PostCard) => {
+ deleteModal.value?.open({
+ url: destroyPost.url(post.id),
+ visit: columnsReload(),
+ });
+});
+
+provide(
+ postCardLabelsKey,
+ computed(() => props.labels),
+);
+
+const selectedGroup = ref<BoardGroup>(props.group);
+
+/** The group in the URL; Status is the default and stays out of it. */
+const groupQuery = (): BoardGroup | undefined => {
+ if (selectedGroup.value === 'status') {
+ return undefined;
+ }
+
+ return selectedGroup.value;
+};
+
+const boardUrl = (): string =>
+ boardUrlFor({ ...filterQuery(), group: groupQuery() });
+
+const columnPaths = (): string[] =>
+ props.boardColumns.map((column) => `columns.${column.key}`);
+
+/** A new group or filter rebuilds the columns from their first page. */
+const applyBoard = (): void => {
+ router.get(
+ boardUrl(),
+ {},
+ {
+ preserveState: true,
+ preserveScroll: false,
+ replace: true,
+ },
+ );
+};
+
+watch(
+ [selectedGroup, selectedLabelIds, selectedUntagged, selectedChannelIds],
+ applyBoard,
+ { deep: true },
+);
+
+/** The board's columns reload with the list of columns, so a column that is gone leaves and a new one shows, and with the sidebar's channel counts. */
+const columnsReload = (): PostCardReload => ({
+ only: ['boardColumns', 'channels', ...columnPaths()],
+ reset: columnPaths(),
+});
+
+/** A card's actions (approve, reject, labels) reload every column from its first page. */
+provide(postCardReloadKey, columnsReload);
+
+/** The first page of each column the reloaded list brought that was not on the board (a new tag). */
+const loadNewColumns = (): void => {
+ const loaded = (page.props.columns ?? {}) as Record<string, unknown>;
+ const paths = props.boardColumns
+ .filter((column) => blank(loaded[column.key]))
+ .map((column) => `columns.${column.key}`);
+
+ if (filled(paths)) {
+ router.reload({ only: paths, reset: paths });
+ }
+};
+
+onUnmounted(
+ router.on('finish', (event) => {
+ const { visit } = event.detail;
+
+ if (visit.completed && visit.only.includes('boardColumns')) {
+ loadNewColumns();
+ }
+ }),
+);
+
+/** A burst of post events (a batch publishing) reloads the columns once. */
+const refresh = useDebounceFn((): void => {
+ router.reload(columnsReload());
+}, 300);
+
+useWorkspaceEcho(
+ ['.post.created', '.post.deleted', '.post.platform.status.updated'],
+ refresh,
+);
+
+const { open: openConnectDialog } = useConnectChannelDialog();
+const inviteMemberDialogOpen = ref(false);
+
+const openInviteMemberDialog = (): void => {
+ inviteMemberDialogOpen.value = true;
+};
+
+const connectChannel = (): void => {
+ openConnectDialog();
+};
+
+/** The tab's title: the channel's name, else the view's, resolved with the template's `$t`. */
+const pageTitle = (translate: (key: string) => string): string => {
+ if (filled(props.channel)) {
+ return channelName(props.channel);
+ }
+
+ return translate('posts.board.view');
+};
+
+/** The channel filter shows on the all-channels board while there are channels to pick. */
+const showsChannelFilter = computed((): boolean => {
+ if (props.scope !== 'all') {
+ return false;
+ }
+
+ return filled(props.filterAccounts);
+});
+
+/** The Instagram grid's link, for a channel that has one. */
+const gridHref = computed((): string | undefined => {
+ if (!props.channel?.has_grid) {
+ return undefined;
+ }
+
+ return grid.url(props.channel.id);
+});
+
+/** A new post starts on this page's channel, or on none from All channels. */
+const newPostAccountIds = computed((): string[] => {
+ if (filled(props.channel)) {
+ return [props.channel.id];
+ }
+
+ return [];
+});
+</script>
+
+<template>
+ <Head :title="pageTitle($t)" />
+
+ <AppLayout full-width>
+ <template #header>
+ <PublishHeader :channel="channel" />
+ </template>
+
+ <div
+ class="flex min-h-0 flex-1 flex-col overflow-hidden"
+ data-testid="publish-board"
+ >
+ <div
+ class="mx-4 mt-2 flex h-12 shrink-0 items-center justify-between gap-2 border-b border-border-strong md:mx-8 md:gap-4"
+ data-testid="board-toolbar"
+ >
+ <BoardGroupMenu v-model="selectedGroup" :groups="groups" />
+
+ <div
+ class="flex min-w-0 items-center gap-2"
+ data-testid="board-filters"
+ >
+ <PostChannelFilter
+ v-if="showsChannelFilter"
+ v-model="selectedChannelIds"
+ :channels="filterAccounts"
+ sheet-below-sm
+ />
+ <PublishFilterMenu
+ :timezone="timezone"
+ test-id="board"
+ :timezones="timezones"
+ @update:timezone="setTimezone"
+ >
+ <template #desktop-filters>
+ <LabelFilter
+ v-model="selectedLabelIds"
+ v-model:untagged="selectedUntagged"
+ :labels="labels"
+ />
+ </template>
+ </PublishFilterMenu>
+ <AppHeaderActions :on-phones="!channel">
+ <div class="flex items-center gap-2">
+ <ScheduleViewSwitch
+ active-view="board"
+ :list-href="listHref"
+ :calendar-href="calendarHref"
+ :board-href="boardUrl()"
+ :grid-href="gridHref"
+ />
+ <NewPostButton
+ :social-account-ids="newPostAccountIds"
+ />
+ </div>
+ </AppHeaderActions>
+ </div>
+ </div>
+
+ <EmptyState
+ v-if="!hasChannels"
+ :title="$t('posts.publish.welcome.title')"
+ :description="$t('posts.publish.welcome.description')"
+ data-testid="publish-welcome"
+ >
+ <template #illustration>
+ <PublishEmptyIllustration />
+ </template>
+ <template v-if="canManageAccounts" #action>
+ <div class="flex flex-wrap items-center justify-center gap-2">
+ <Button
+ data-testid="publish-welcome-connect"
+ @click="connectChannel"
+ >
+ <IconPlus class="size-4" />
+ {{ $t('channels.connect') }}
+ </Button>
+ <Button
+ v-if="canManageTeam"
+ variant="outline"
+ data-testid="publish-welcome-invite"
+ @click="openInviteMemberDialog"
+ >
+ <IconUsers class="size-4" />
+ {{ $t('posts.publish.welcome.invite') }}
+ </Button>
+ </div>
+ </template>
+ </EmptyState>
+
+ <EmptyState
+ v-else-if="blank(boardColumns)"
+ :title="$t('posts.board.no_columns.title')"
+ :description="$t('posts.board.no_columns.description')"
+ data-testid="board-no-columns"
+ />
+
+ <TooltipProvider v-else :delay-duration="0">
+ <div
+ class="flex min-h-0 flex-1 snap-x snap-mandatory scroll-px-4 gap-3 overflow-x-auto overscroll-x-contain px-4 pt-4 pb-4 sm:snap-none md:px-8"
+ data-testid="board-columns"
+ >
+ <BoardColumn
+ v-for="column in boardColumns"
+ :key="column.key"
+ :column="column"
+ :group="group"
+ :timezone="timezone"
+ />
+ </div>
+ </TooltipProvider>
+ </div>
+
+ <InviteMemberDialog
+ v-if="canManageTeam"
+ v-model:open="inviteMemberDialogOpen"
+ />
+ </AppLayout>
+
+ <ConfirmDeleteModal
+ ref="deleteModal"
+ :title="$t('posts.edit.delete_modal.title')"
+ :description="$t('posts.edit.delete_modal.description')"
+ :action="$t('posts.edit.delete_modal.action')"
+ :cancel="$t('posts.edit.delete_modal.cancel')"
+ />
+</template>
diff --git a/resources/js/pages/posts/Calendar.vue b/resources/js/pages/posts/Calendar.vue
index 1ef83109f..713645f0b 100644
--- a/resources/js/pages/posts/Calendar.vue
+++ b/resources/js/pages/posts/Calendar.vue
@@ -1,5 +1,5 @@
<script setup lang="ts">
-import { Head, router, usePage } from '@inertiajs/vue3';
+import { Head, router } from '@inertiajs/vue3';
import {
IconCheck,
IconLayoutSidebarRightCollapse,
@@ -42,16 +42,15 @@ import {
DRAG_HINT_ID,
useCalendarDrag,
} from '@/composables/calendar/useCalendarDrag';
+import { usePublishFilters } from '@/composables/publish/usePublishFilters';
import { useAtLeastBreakpoint } from '@/composables/useBreakpoint';
import { useCollapseWhenTruncated } from '@/composables/useCollapseWhenTruncated';
-import { useDisplayTimezone } from '@/composables/useDisplayTimezone';
import { openPostComposer } from '@/composables/useGlobalPostComposer';
import {
deletePostCardKey,
postCardLabelsKey,
} from '@/composables/usePostCardActions';
import { useShowPostingSlots } from '@/composables/useShowPostingSlots';
-import { provideViewTimezone } from '@/composables/useViewTimezone';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import date from '@/date';
import dayjs from '@/dayjs';
@@ -59,15 +58,7 @@ import { activeLocale } from '@/language';
import AppLayout from '@/layouts/AppLayout.vue';
import { calendarDayKey } from '@/lib/calendarItems';
import { afterPageInHistory } from '@/lib/inAppHistory';
-import { calendar } from '@/routes/app';
-import {
- calendar as channelCalendar,
- grid,
- publish,
- settings,
-} from '@/routes/app/channels';
-import { index as postsIndex } from '@/routes/app/posts';
-import type { User } from '@/types';
+import { grid, settings } from '@/routes/app/channels';
import type { TimezoneOption } from '@/types/posting-schedule';
import type {
CalendarPost,
@@ -105,7 +96,6 @@ interface Props {
}
const props = defineProps<Props>();
-const page = usePage();
const { canCreatePost, canManageAccounts, requiresApproval } =
useWorkspaceAbilities();
const { showSlots, setShowSlots } = useShowPostingSlots();
@@ -152,25 +142,17 @@ onUnmounted(() => {
cancelSlotsReload();
});
-const userTimezone = computed(
- () => (page.props.auth.user as User).timezone || props.displayTimezone,
-);
-
-const { timezone, setTimezone } = useDisplayTimezone(
- props.displayTimezone,
- props.timezones.map((option) => option.value),
- undefined,
- reloadProps,
-);
-
-provideViewTimezone(timezone);
-
-watch(
- () => props.displayTimezone,
- (value) => {
- timezone.value = value;
- },
-);
+const {
+ timezone,
+ setTimezone,
+ selectedLabelIds,
+ selectedUntagged,
+ selectedChannelIds,
+ filterQuery,
+ calendarUrlFor,
+ listHref,
+ boardHref,
+} = usePublishFilters(props, { reloadProps });
const confirmCustomTime = (from: string, to: string): Promise<boolean> =>
customTimeDialog.value?.confirm(from, to, timezone.value) ??
@@ -205,22 +187,9 @@ const isRescheduling = computed(() => movingPostIds.value.length > 0);
const undatedDraftList = computed(() => props.undatedDrafts?.data ?? null);
-const selectedLabelIds = ref<string[]>(props.filters.labels ?? []);
-const selectedUntagged = ref<boolean>(props.filters.untagged ?? false);
-const selectedChannelIds = ref<string[]>(props.filters.channels ?? []);
const selectedStatus = ref<CalendarStatus>(props.filters.status ?? 'all');
const undatedOpen = ref(props.undatedDrafts !== undefined);
-const filterQuery = (): Record<string, string | string[] | undefined> => ({
- labels: selectedLabelIds.value.length ? selectedLabelIds.value : undefined,
- untagged: selectedUntagged.value ? '1' : undefined,
- channels:
- props.scope === 'all' && selectedChannelIds.value.length
- ? selectedChannelIds.value
- : undefined,
- tz: timezone.value !== userTimezone.value ? timezone.value : undefined,
-});
-
const calendarUrl = (
view: CalendarView,
dateQuery: Record<string, string> = {},
@@ -234,25 +203,9 @@ const calendarUrl = (
slots: showSlots.value ? '1' : undefined,
};
- return props.channel
- ? channelCalendar.url({ account: props.channel.id, view }, { query })
- : calendar.url({ view }, { query });
+ return calendarUrlFor(view, query);
};
-const listHref = computed((): string => {
- const query = filterQuery();
-
- return props.channel
- ? publish.url(props.channel.id, {
- query: {
- labels: query.labels,
- untagged: query.untagged,
- tz: query.tz,
- },
- })
- : postsIndex.url({ query });
-});
-
const visit = (url: string): void => {
router.get(
url,
@@ -703,12 +656,12 @@ const goToDay = (key: string): void => {
>
<template
v-if="!isDesktop"
- #compact-items="{ rowClass, close }"
+ #compact-items="{ close }"
>
<button
type="button"
:aria-pressed="undatedOpen"
- :class="rowClass"
+ class="menu-row"
data-testid="calendar-no-date-menu"
@click="openUndatedFromMenu(close)"
>
@@ -727,6 +680,7 @@ const goToDay = (key: string): void => {
:calendar-href="
calendarUrl(isDesktop ? 'month' : 'days')
"
+ :board-href="boardHref"
:grid-href="
channel?.has_grid
? grid.url(channel.id)
diff --git a/resources/js/pages/publish/Index.vue b/resources/js/pages/publish/Index.vue
index 654201a17..6f1c40919 100644
--- a/resources/js/pages/publish/Index.vue
+++ b/resources/js/pages/publish/Index.vue
@@ -44,10 +44,9 @@ import PublishTabs from '@/components/publish/PublishTabs.vue';
import QueueTimeline from '@/components/publish/QueueTimeline.vue';
import { Button } from '@/components/ui/button';
import { useWorkspaceEcho } from '@/composables/echo/useWorkspaceEcho';
-import { useBelowBreakpoint } from '@/composables/useBreakpoint';
+import { usePublishFilters } from '@/composables/publish/usePublishFilters';
import { useComposerData } from '@/composables/useComposerData';
import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
-import { useDisplayTimezone } from '@/composables/useDisplayTimezone';
import { openPostComposer } from '@/composables/useGlobalPostComposer';
import {
deletePostCardKey,
@@ -62,21 +61,13 @@ import type {
} from '@/composables/usePostComposition';
import { useShowPostingSlots } from '@/composables/useShowPostingSlots';
import type { QueueSlotTarget } from '@/composables/useSortableQueue';
-import { provideViewTimezone } from '@/composables/useViewTimezone';
import { useWorkspaceAbilities } from '@/composables/useWorkspaceAbilities';
import date from '@/date';
import dayjs from '@/dayjs';
import AppLayout from '@/layouts/AppLayout.vue';
import { afterHistorySettles, cameFromAppPage } from '@/lib/inAppHistory';
-import { calendar } from '@/routes/app';
-import {
- calendar as channelCalendar,
- grid,
- publish,
- settings,
-} from '@/routes/app/channels';
-import { index as postsIndex } from '@/routes/app/posts';
-import type { User } from '@/types';
+import { postAttemptAt } from '@/lib/postCard';
+import { grid, settings } from '@/routes/app/channels';
import { PostStatus, ScheduleMode } from '@/types/post';
import type { TimezoneOption } from '@/types/posting-schedule';
import type {
@@ -129,73 +120,23 @@ const page = usePage();
const { canManageAccounts, canManageTeam, canPublishDirectly } =
useWorkspaceAbilities();
-const userTimezone = computed(
- () => (page.props.auth.user as User).timezone || props.displayTimezone,
-);
-
-const { timezone, setTimezone, dayKey } = useDisplayTimezone(
- props.displayTimezone,
- props.timezones.map((option) => option.value),
- () => props.tab,
-);
-
-provideViewTimezone(timezone);
-
-watch(
- () => props.displayTimezone,
- (value) => {
- timezone.value = value;
- },
-);
-
-const selectedLabelIds = ref<string[]>(props.filters.labels ?? []);
-const selectedUntagged = ref<boolean>(props.filters.untagged ?? false);
-const selectedChannelIds = ref<string[]>(props.filters.channels ?? []);
+const {
+ timezone,
+ setTimezone,
+ dayKey,
+ selectedLabelIds,
+ selectedUntagged,
+ selectedChannelIds,
+ filterQuery,
+ listUrlFor,
+ calendarHref,
+ boardHref,
+} = usePublishFilters(props, { currentTab: () => props.tab });
const listUrl = (
tab: PublishTab = props.tab,
extra: Record<string, string> = {},
-): string => {
- const query = {
- tab,
- labels: selectedLabelIds.value.length
- ? selectedLabelIds.value
- : undefined,
- untagged: selectedUntagged.value ? '1' : undefined,
- channels:
- props.scope === 'all' && selectedChannelIds.value.length
- ? selectedChannelIds.value
- : undefined,
- tz: timezone.value !== userTimezone.value ? timezone.value : undefined,
- ...extra,
- };
-
- return props.channel
- ? publish.url(props.channel.id, { query })
- : postsIndex.url({ query });
-};
-
-const isPhone = useBelowBreakpoint('md');
-
-const calendarUrl = computed((): string => {
- const query = {
- labels: selectedLabelIds.value.length
- ? selectedLabelIds.value
- : undefined,
- untagged: selectedUntagged.value ? '1' : undefined,
- channels:
- props.scope === 'all' && selectedChannelIds.value.length
- ? selectedChannelIds.value
- : undefined,
- tz: timezone.value !== userTimezone.value ? timezone.value : undefined,
- };
-
- const view = isPhone.value ? 'days' : 'week';
-
- return props.channel
- ? channelCalendar.url({ account: props.channel.id, view }, { query })
- : calendar.url({ view }, { query });
-});
+): string => listUrlFor({ tab, ...filterQuery(), ...extra });
const applyFilters = (): void => {
router.get(
@@ -236,7 +177,7 @@ const listGroups = computed<CardGroup[]>(() => {
const at =
props.tab === 'drafts' || props.tab === 'approvals'
? post.scheduled_at
- : (post.published_at ?? post.scheduled_at ?? post.created_at);
+ : postAttemptAt(post);
const key = at ? dayKey(at) : NO_TIME;
groups.set(key, [...(groups.get(key) ?? []), post]);
@@ -907,7 +848,8 @@ const submitComposition = (
<ScheduleViewSwitch
active-view="list"
:list-href="listUrl()"
- :calendar-href="calendarUrl"
+ :calendar-href="calendarHref"
+ :board-href="boardHref"
:grid-href="
channel?.has_grid
? grid.url(channel.id)
diff --git a/resources/js/pages/settings/workspace/Channels.vue b/resources/js/pages/settings/workspace/Channels.vue
index 1fa5a3789..f566110e1 100644
--- a/resources/js/pages/settings/workspace/Channels.vue
+++ b/resources/js/pages/settings/workspace/Channels.vue
@@ -1,31 +1,103 @@
<script setup lang="ts">
-import { Head, usePage } from '@inertiajs/vue3';
+import { Head, InfiniteScroll, router, usePage } from '@inertiajs/vue3';
import { IconPlus } from '@tabler/icons-vue';
-import { computed, ref } from 'vue';
+import { computed, ref, watch } from 'vue';
import ChannelListItem from '@/components/channels/ChannelListItem.vue';
import ChannelsEmptyIllustration from '@/components/channels/ChannelsEmptyIllustration.vue';
import DisconnectChannelDialog from '@/components/channels/DisconnectChannelDialog.vue';
import EmptyState from '@/components/EmptyState.vue';
+import NetworkFilter from '@/components/NetworkFilter.vue';
+import SettingsSearch from '@/components/settings/SettingsSearch.vue';
import { Button } from '@/components/ui/button';
+import { TableLoadMore } from '@/components/ui/table';
import { orderChannels } from '@/composables/useChannelOrder';
import { useConnectChannelDialog } from '@/composables/useConnectChannelDialog';
import { useNetworkConnect } from '@/composables/useNetworkConnect';
+import debounce from '@/debounce';
import SettingsLayout from '@/layouts/SettingsLayout.vue';
+import { blank } from '@/lib/helpers';
+import { channels as channelsSettings } from '@/routes/app/workspace';
import { Platform } from '@/types/platform';
import type {
AvailablePlatform,
+ ChannelListRow,
ConnectedAccount,
} from '@/types/social-account';
+interface ScrollChannelRows {
+ data: ChannelListRow[];
+}
+
const props = defineProps<{
- connectedChannels: ConnectedAccount[];
+ connectedChannels: ScrollChannelRows;
+ /** Every channel of the workspace, whatever the search and filter. */
+ total: number;
+ /** Every network the workspace has a channel on, in channel order. */
+ networks: string[];
+ filters: { search: string; networks: string[] };
}>();
-const channels = computed<ConnectedAccount[]>(() =>
- orderChannels(props.connectedChannels),
+const channels = computed<ChannelListRow[]>(() =>
+ orderChannels(props.connectedChannels.data),
);
+const search = ref(props.filters.search);
+const selectedNetworks = ref<string[]>(props.filters.networks);
+
+/** Whether the workspace has any channel, whatever the search and filter. */
+const hasChannels = computed((): boolean => {
+ if (props.total > 0) {
+ return true;
+ }
+
+ return false;
+});
+
+/** The network filter shows once there is more than one network to pick from. */
+const showsNetworkFilter = computed((): boolean => {
+ if (props.networks.length > 1) {
+ return true;
+ }
+
+ return false;
+});
+
+const searchQuery = (): string | undefined => {
+ if (blank(search.value)) {
+ return undefined;
+ }
+
+ return search.value;
+};
+
+const networksQuery = (): string[] | undefined => {
+ if (blank(selectedNetworks.value)) {
+ return undefined;
+ }
+
+ return selectedNetworks.value;
+};
+
+/** A new search or filter reloads the list from its first page. */
+const applyFilters = debounce((): void => {
+ router.get(
+ channelsSettings.url(),
+ {
+ search: searchQuery(),
+ networks: networksQuery(),
+ },
+ {
+ preserveState: true,
+ preserveScroll: true,
+ replace: true,
+ reset: ['connectedChannels'],
+ },
+ );
+}, 300);
+
+watch([search, selectedNetworks], applyFilters);
+
const page = usePage();
const platforms = computed<AvailablePlatform[]>(
() => (page.props.connectablePlatforms as AvailablePlatform[]) ?? [],
@@ -57,7 +129,9 @@ const disconnectChannel = (channel: ConnectedAccount): void =>
<SettingsLayout
:title="$t('channels.title')"
:description="$t('channels.description')"
- :centered="channels.length === 0"
+ :centered="!hasChannels"
+ :total="total"
+ wide
>
<template #actions>
<Button data-testid="channels-connect" @click="openConnectDialog()">
@@ -66,21 +140,74 @@ const disconnectChannel = (channel: ConnectedAccount): void =>
</Button>
</template>
- <ul v-if="channels.length > 0" class="flex flex-col gap-3">
- <li
- v-for="channel in channels"
- :key="channel.id"
- :data-testid="`channel-list-row-${channel.id}`"
- >
- <ChannelListItem
- :channel="channel"
- :can-link-facebook="canLinkFacebook(channel)"
- @reconnect="reconnectChannel"
- @link-facebook="linkFacebook"
- @disconnect="disconnectChannel"
+ <div v-if="hasChannels" class="flex flex-col gap-3">
+ <div class="flex items-center gap-2" data-testid="channels-toolbar">
+ <SettingsSearch
+ v-model="search"
+ class="min-w-0 flex-1"
+ :placeholder="$t('channels.list.search')"
+ />
+ <NetworkFilter
+ v-if="showsNetworkFilter"
+ v-model="selectedNetworks"
+ :networks="networks"
+ test-id="channels-network"
+ sheet-below-sm
/>
- </li>
- </ul>
+ </div>
+
+ <EmptyState
+ v-if="blank(channels)"
+ :title="$t('channels.list.no_results')"
+ data-testid="channels-no-results"
+ >
+ <template #illustration>
+ <ChannelsEmptyIllustration />
+ </template>
+ </EmptyState>
+
+ <div
+ v-else
+ class="overflow-hidden rounded-xl border border-border bg-card"
+ data-testid="channels-list"
+ >
+ <div
+ class="hidden gap-x-3 border-b border-border bg-secondary/50 px-4 py-2 text-xs font-medium text-muted-foreground md:grid md:channel-list-columns"
+ aria-hidden="true"
+ >
+ <span>{{ $t('channels.list.columns.channel') }}</span>
+ <span>{{ $t('channels.list.columns.timezone') }}</span>
+ <span>{{ $t('channels.list.columns.posting_times') }}</span>
+ <span>{{ $t('channels.list.columns.this_week') }}</span>
+ <span />
+ </div>
+ <InfiniteScroll
+ data="connectedChannels"
+ items-element="#channels-body"
+ preserve-url
+ >
+ <ul id="channels-body" class="divide-y divide-border">
+ <li
+ v-for="channel in channels"
+ :key="channel.id"
+ :data-testid="`channel-list-row-${channel.id}`"
+ >
+ <ChannelListItem
+ :channel="channel"
+ :can-link-facebook="canLinkFacebook(channel)"
+ @reconnect="reconnectChannel"
+ @link-facebook="linkFacebook"
+ @disconnect="disconnectChannel"
+ />
+ </li>
+ </ul>
+
+ <template #next="{ loading }">
+ <TableLoadMore v-if="loading" />
+ </template>
+ </InfiniteScroll>
+ </div>
+ </div>
<EmptyState
v-else
diff --git a/resources/js/pages/signatures/Index.vue b/resources/js/pages/signatures/Index.vue
index cabb3909c..e060ff28c 100644
--- a/resources/js/pages/signatures/Index.vue
+++ b/resources/js/pages/signatures/Index.vue
@@ -1,9 +1,8 @@
<script setup lang="ts">
import { Head, InfiniteScroll, router } from '@inertiajs/vue3';
import {
- IconDotsVertical,
- IconPencil,
IconPlus,
+ IconSettings,
IconSignature,
IconTrash,
} from '@tabler/icons-vue';
@@ -17,14 +16,12 @@ import CreateDialog from '@/components/signatures/CreateDialog.vue';
import EditDialog from '@/components/signatures/EditDialog.vue';
import SignaturesEmptyIllustration from '@/components/signatures/SignaturesEmptyIllustration.vue';
import { Button } from '@/components/ui/button';
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu';
import { TableLoadMore } from '@/components/ui/table';
+import {
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
+} from '@/components/ui/tooltip';
import debounce from '@/debounce';
import SettingsLayout from '@/layouts/SettingsLayout.vue';
import {
@@ -157,9 +154,7 @@ const handleDelete = (signature: Signature) => {
<SettingsListRow
v-for="signature in signatures.data"
:key="signature.id"
- class="cursor-pointer"
:data-testid="`signature-row-${signature.id}`"
- @click="openEditDialog(signature)"
>
<template #media>
<span
@@ -181,38 +176,46 @@ const handleDelete = (signature: Signature) => {
{{ signature.content }}
</p>
<template #actions>
- <DropdownMenu>
- <DropdownMenuTrigger as-child>
- <Button
- variant="ghost"
- size="icon"
- class="shrink-0 text-muted-foreground data-[state=open]:bg-accent"
- :aria-label="$t('signatures.row_actions')"
- :data-testid="`signature-menu-${signature.id}`"
- @click.stop
- >
- <IconDotsVertical class="size-4" />
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" @click.stop>
- <DropdownMenuItem
- :data-testid="`edit-signature-${signature.id}`"
- @click="openEditDialog(signature)"
+ <div class="flex shrink-0 items-center gap-1">
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <Button
+ variant="ghost"
+ size="icon"
+ class="shrink-0 text-muted-foreground"
+ :aria-label="$t('signatures.actions.settings')"
+ :data-testid="`signature-settings-${signature.id}`"
+ @click="openEditDialog(signature)"
+ >
+ <IconSettings class="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`signature-settings-tooltip-${signature.id}`"
>
- <IconPencil class="size-4" />
- {{ $t('signatures.actions.edit') }}
- </DropdownMenuItem>
- <DropdownMenuSeparator />
- <DropdownMenuItem
- variant="destructive"
- :data-testid="`delete-signature-${signature.id}`"
- @click="handleDelete(signature)"
+ {{ $t('signatures.actions.settings') }}
+ </TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <Button
+ variant="ghost"
+ size="icon"
+ class="shrink-0 text-destructive-text hover:bg-critical-subtle hover:text-destructive-text"
+ :aria-label="$t('signatures.actions.delete')"
+ :data-testid="`signature-delete-${signature.id}`"
+ @click="handleDelete(signature)"
+ >
+ <IconTrash class="size-4" />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent
+ :data-testid="`signature-delete-tooltip-${signature.id}`"
>
- <IconTrash class="size-4" />
{{ $t('signatures.actions.delete') }}
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ </TooltipContent>
+ </Tooltip>
+ </div>
</template>
</SettingsListRow>
</ul>
diff --git a/resources/js/types/analytics.ts b/resources/js/types/analytics.ts
index d3640d3c7..1ccdcd038 100644
--- a/resources/js/types/analytics.ts
+++ b/resources/js/types/analytics.ts
@@ -172,6 +172,8 @@ export interface AnalyticsFilters {
export interface WorkspaceAnalyticsFilters extends AnalyticsFilters {
channels: string[];
+ labels: string[];
+ untagged: boolean;
}
export interface AnalyticsChannelOption {
diff --git a/resources/js/types/board.ts b/resources/js/types/board.ts
new file mode 100644
index 000000000..d766abdb2
--- /dev/null
+++ b/resources/js/types/board.ts
@@ -0,0 +1,12 @@
+import type { PostCardLabel, PublishSocialAccount } from '@/types/publish';
+
+export type BoardGroup = 'status' | 'tag' | 'channel';
+
+export type BoardColumnType = 'status' | 'label' | 'untagged' | 'channel';
+
+export interface BoardColumnMeta {
+ key: string;
+ type: BoardColumnType;
+ label?: PostCardLabel;
+ channel?: PublishSocialAccount;
+}
diff --git a/resources/js/types/browser-storage.ts b/resources/js/types/browser-storage.ts
index d38619503..648fa274f 100644
--- a/resources/js/types/browser-storage.ts
+++ b/resources/js/types/browser-storage.ts
@@ -1,6 +1,7 @@
import type { AutosaveSnapshot } from '@/composables/useComposerAutosave';
import type { PerformanceMetric, SummaryMetric } from '@/types/analytics';
import type { PlatformValue } from '@/types/platform';
+import type { PublishView } from '@/types/publish';
/** The columns picked for each network's per-post table on the channel insights. */
type ChannelColumns = {
@@ -16,6 +17,7 @@ export interface UserStorage extends ChannelColumns {
'calendar.skipCustomTimeConfirm': boolean;
'publish.tz': string;
'publish.showSlots': boolean;
+ 'publish.view': PublishView;
'insights.performanceColumns': PerformanceMetric[];
'composer.instagramCollaboratorsNoticeSeen': boolean;
'emoji.recents': string[];
diff --git a/resources/js/types/publish.ts b/resources/js/types/publish.ts
index d5b2c6d14..ccd725523 100644
--- a/resources/js/types/publish.ts
+++ b/resources/js/types/publish.ts
@@ -19,6 +19,11 @@ export type PublishTab = 'queue' | 'approvals' | 'drafts' | 'sent';
export type PublishScope = 'all' | 'channel';
+/** The ways the Publish page shows posts; the Instagram grid is not one of them. */
+export const PUBLISH_VIEWS = ['list', 'calendar', 'board'] as const;
+
+export type PublishView = (typeof PUBLISH_VIEWS)[number];
+
export type PublishCounts = Record<PublishTab, number>;
export interface PublishSocialAccount {
@@ -131,6 +136,7 @@ export interface QueueView {
export interface ScrollPostCards {
data: PostCard[];
+ total: number;
}
export type PostCardMove = 'top' | 'up' | 'down';
diff --git a/resources/js/types/social-account.ts b/resources/js/types/social-account.ts
index 04f902208..c3e3cd569 100644
--- a/resources/js/types/social-account.ts
+++ b/resources/js/types/social-account.ts
@@ -1,6 +1,11 @@
+import { filled } from '@/lib/helpers';
import type { MediaType } from '@/lib/mediaType';
import { Platform } from '@/types/platform';
-import type { SocialAccountStatusValue } from '@/types/social-account-status';
+import type { TimezoneOption } from '@/types/posting-schedule';
+import {
+ SocialAccountStatus,
+ type SocialAccountStatusValue,
+} from '@/types/social-account-status';
export interface AvailablePlatform {
value: string;
@@ -12,6 +17,19 @@ export interface AvailablePlatform {
connect_methods?: string[];
}
+/** Where a channel stands on its weekly posting goal this week; no goal is null. */
+export interface PostingGoalProgress {
+ posting_goal: number | null;
+ sent_this_week: number;
+ scheduled_this_week: number;
+}
+
+/** A connected channel as the channels settings list shows it. */
+export interface ChannelListRow extends ConnectedAccount, PostingGoalProgress {
+ timezone_option: TimezoneOption;
+ posting_times_per_week: number;
+}
+
export interface ConnectedAccount {
id: string;
platform: string;
@@ -26,16 +44,36 @@ export interface ConnectedAccount {
status: SocialAccountStatusValue | null;
}
+const CONNECTION_LOST_STATUSES: SocialAccountStatusValue[] = [
+ SocialAccountStatus.Disconnected,
+ SocialAccountStatus.TokenExpired,
+];
+
+/** Networks connected in several ways, whose accounts name the way they were connected ("LinkedIn Page"). */
+const PLATFORMS_WITH_ACCOUNT_TYPE: string[] = [
+ Platform.LinkedInPage,
+ Platform.InstagramFacebook,
+];
+
+/** A channel that can no longer publish until it is reconnected. */
export const isConnectionLost = (account: {
status: SocialAccountStatusValue | null;
-}): boolean =>
- account.status === 'disconnected' || account.status === 'token_expired';
-
-export const accountTypeKey = (account: { platform: string }): string | null =>
- account.platform === Platform.LinkedInPage ||
- account.platform === Platform.InstagramFacebook
- ? `channels.variants.${account.platform}`
- : null;
+}): boolean => {
+ if (!filled(account.status)) {
+ return false;
+ }
+
+ return CONNECTION_LOST_STATUSES.includes(account.status);
+};
+
+/** The lang key of an account's type ("LinkedIn Page"); none on a network connected one way only. */
+export const accountTypeKey = (account: { platform: string }): string | null => {
+ if (!PLATFORMS_WITH_ACCOUNT_TYPE.includes(account.platform)) {
+ return null;
+ }
+
+ return `channels.variants.${account.platform}`;
+};
/** The verification badge a network shows next to an account (only X reports one today). */
export type VerifiedBadge = 'blue' | 'business' | 'government';
diff --git a/routes/app.php b/routes/app.php
index 33e4671ac..05bd1a12d 100644
--- a/routes/app.php
+++ b/routes/app.php
@@ -223,6 +223,7 @@ Route::middleware(['auth', EnsureAccountReady::class, EnsureHasWorkspace::class]
Route::get('channels/{account}/calendar/{view?}', [ChannelController::class, 'calendar'])
->where('view', 'days|week|month')
->name('app.channels.calendar');
+ Route::get('channels/{account}/board', [ChannelController::class, 'board'])->name('app.channels.board');
Route::get('channels/{account}/insights', [ChannelController::class, 'insights'])->name('app.channels.insights');
Route::get('channels/{account}/insights/download/{format}', [ChannelController::class, 'downloadInsights'])
->whereIn('format', ExportFormat::values())
@@ -245,6 +246,7 @@ Route::middleware(['auth', EnsureAccountReady::class, EnsureHasWorkspace::class]
Route::get('schedule/calendar/{view?}', [PostController::class, 'calendar'])
->where('view', 'days|week|month')
->name('app.calendar');
+ Route::get('schedule/board', [PostController::class, 'board'])->name('app.posts.board');
Route::get('posts/composer/live', ComposerLiveDataController::class)->name('app.posts.composer.live');
Route::get('posts/composer/accounts/{account}', [ComposerAccountDataController::class, 'show'])->name('app.posts.composer.account');
diff --git a/tests/Browser/CalendarPageTest.php b/tests/Browser/CalendarPageTest.php
index 24fa33c8c..db0cbfd17 100644
--- a/tests/Browser/CalendarPageTest.php
+++ b/tests/Browser/CalendarPageTest.php
@@ -657,6 +657,8 @@ test('a details action reloads the calendar and the details show the new status'
expect($post->refresh()->status)->toBe(PostStatus::Draft);
+ waitForGone($page, "@post-card-menu-content-details-{$post->id}");
+ waitForOpen($page, "@post-details-{$post->id}");
$page->keys("@post-details-{$post->id}", 'Escape');
waitForGone($page, "@post-details-{$post->id}");
$page->assertVisible("@calendar-post-{$post->id}")
@@ -724,7 +726,9 @@ test('on a phone the calendar tab of the view switch keeps the three days view,
$calendarTabPath = 'new URL(document.querySelector(\'[data-testid="schedule-view-calendar"]\').href).pathname';
$page = visit(route('app.calendar', ['view' => 'days']))->resize(390, 844);
- waitFor($page, '@schedule-view-calendar');
+ waitFor($page, '@schedule-view-trigger');
+ $page->click('@schedule-view-trigger');
+ waitForOpen($page, '@schedule-view-menu');
$page->assertScript($calendarTabPath, route('app.calendar', ['view' => 'days'], false))
->click('@schedule-view-calendar');
waitFor($page, '@calendar-time-grid');
diff --git a/tests/Browser/ChannelGridTest.php b/tests/Browser/ChannelGridTest.php
index a38ebf83d..ce7b3b26a 100644
--- a/tests/Browser/ChannelGridTest.php
+++ b/tests/Browser/ChannelGridTest.php
@@ -201,3 +201,17 @@ test('the grid tooltip shows the sent time in the user zone, not the browser zon
->toBe("This post was sent {$reel->published_at->setTimezone('Asia/Tokyo')->format('F j, Y \\a\\t g:i A')}");
$page->assertNoJavaScriptErrors();
});
+
+test('the grid links to the channel board', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.channels.grid', $this->instagram))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+
+ waitForPath($page, route('app.channels.board', $this->instagram, absolute: false));
+ waitFor($page, '@board-column-draft');
+
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ChannelsSettingsTest.php b/tests/Browser/ChannelsSettingsTest.php
index 17ac64fa9..8ea51a776 100644
--- a/tests/Browser/ChannelsSettingsTest.php
+++ b/tests/Browser/ChannelsSettingsTest.php
@@ -6,6 +6,7 @@ use App\Enums\SocialAccount\Platform;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
+use App\Support\PostingSchedule;
function channelsSettingsAdmin(): User
{
@@ -106,10 +107,12 @@ test('a channel with a lost connection shows the disconnected dot in the list an
$page->assertVisible("@channel-avatar-disconnected-{$lost->id}")
->assertMissing("@channel-avatar-disconnected-{$healthy->id}")
- ->assertSeeIn("@channel-connection-lost-{$lost->id}", __('channels.connection_lost_hint'))
+ ->assertSeeIn("@channel-connection-lost-{$lost->id}", __('channels.list.connection_lost'))
->assertVisible("@channel-reconnect-{$lost->id}")
+ ->assertVisible("@channel-settings-{$lost->id}")
->assertMissing("@channel-connection-lost-{$healthy->id}")
->assertMissing("@channel-reconnect-{$healthy->id}")
+ ->assertSeeIn("@channel-reconnect-{$lost->id}", __('channels.reconnect'))
->assertNoJavaScriptErrors();
$page = visit(route('app.channels.publish', $lost));
@@ -199,3 +202,120 @@ test('an instagram login channel offers to link a facebook page, which reconnect
->and($page->script('new URL(window.__connectUrl).pathname'))->toBe((string) parse_url(route('app.social.instagram-facebook.connect'), PHP_URL_PATH));
$page->assertNoJavaScriptErrors();
});
+
+test('each channel row shows its weekly posting goal without a popover, or a link to set one', function () {
+ $user = channelsSettingsAdmin();
+ connectAiTo($user);
+ $withGoal = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id, 'posting_goal' => 5]);
+ $withoutGoal = SocialAccount::factory()->create(['workspace_id' => $user->current_workspace_id, 'platform' => Platform::X, 'posting_goal' => null]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.workspace.channels'))->resize(1280, 900);
+ waitFor($page, "@channel-goal-{$withGoal->id}-progress");
+
+ $page->assertSeeIn("@channel-goal-{$withGoal->id}-progress", '0/5');
+
+ $page->click("@channel-goal-{$withGoal->id}-progress");
+
+ expect($page->script("document.querySelectorAll('[data-testid=\"channel-goal-{$withGoal->id}-popover\"]').length"))->toBe(0);
+
+ $page->click("@channel-goal-set-{$withoutGoal->id}");
+ waitForPath($page, route('app.channels.settings', $withoutGoal, absolute: false));
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('each channel row shows its time zone and posting times, and the list is searched and filtered by network', function () {
+ $user = channelsSettingsAdmin();
+ connectAiTo($user);
+ $linkedin = SocialAccount::factory()->linkedin()->create([
+ 'workspace_id' => $user->current_workspace_id,
+ 'display_name' => 'Acme LinkedIn',
+ 'username' => 'acme',
+ 'timezone' => 'America/Sao_Paulo',
+ 'posting_schedule' => PostingSchedule::empty()->withTime(1, '09:00')->withTime(3, '09:00'),
+ ]);
+ $x = SocialAccount::factory()->create([
+ 'workspace_id' => $user->current_workspace_id,
+ 'platform' => Platform::X,
+ 'display_name' => 'Beta X',
+ 'username' => null,
+ 'timezone' => 'UTC',
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.workspace.channels'))->resize(1280, 900);
+ waitFor($page, "@channel-row-{$linkedin->id}");
+
+ $page->assertSeeIn("@channel-timezone-{$linkedin->id}", 'Sao Paulo')
+ ->assertSeeIn("@channel-posting-times-{$linkedin->id}", __('channels.list.posting_times_per_week', ['count' => 2]))
+ ->assertSeeIn("@channel-posting-times-{$x->id}", __('channels.list.no_posting_times'))
+ ->assertSeeIn("@channel-network-{$linkedin->id}", 'LinkedIn · @acme');
+
+ expect($page->text("@channel-network-{$x->id}"))->toBe('X');
+
+ $page
+ ->assertSeeIn('@header-title-total', '(2)');
+
+ $page->type('@header-search-input', 'beta');
+ waitForGone($page, "@channel-row-{$linkedin->id}");
+ $page->assertVisible("@channel-row-{$x->id}");
+
+ $page->type('@header-search-input', 'nothing like this');
+ waitFor($page, '@channels-no-results');
+
+ $page->clear('@header-search-input');
+ waitFor($page, "@channel-row-{$linkedin->id}");
+
+ $page->click('@channels-network-filter');
+ waitFor($page, '@channels-network-option-linkedin');
+ waitForState($page, '@channels-network-option-linkedin', 'element.getBoundingClientRect().width > 0 && element.getBoundingClientRect().top >= 0 && element.getBoundingClientRect().bottom <= window.innerHeight');
+ $page->click('@channels-network-option-linkedin');
+ waitForGone($page, "@channel-row-{$x->id}");
+
+ $page->assertVisible("@channel-row-{$linkedin->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('the channels list loads its next page without repeating a channel', function () {
+ config(['app.pagination.default' => 2]);
+ $user = channelsSettingsAdmin();
+ connectAiTo($user);
+ $channels = collect(range(0, 2))->map(fn (int $position) => SocialAccount::factory()->create([
+ 'workspace_id' => $user->current_workspace_id,
+ 'platform' => Platform::X,
+ 'position' => $position,
+ ]));
+ $this->actingAs($user);
+
+ $page = visit(route('app.workspace.channels'))->resize(1280, 900);
+ waitFor($page, "@channel-row-{$channels[2]->id}");
+ waitForCount($page, '[data-testid^="channel-row-"]', 3);
+
+ $page->assertSeeIn('@header-title-total', '(3)')
+ ->assertNoJavaScriptErrors();
+});
+
+test('the settings cog and the actions menu of a channel row show a tooltip, and the menu still opens', function () {
+ $user = channelsSettingsAdmin();
+ connectAiTo($user);
+ $channel = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.workspace.channels'))->resize(1280, 900);
+ waitFor($page, "@channel-settings-{$channel->id}");
+
+ $page->hover("@channel-settings-{$channel->id}");
+ waitFor($page, "@channel-settings-tooltip-{$channel->id}");
+ $page->assertSeeIn("@channel-settings-tooltip-{$channel->id}", __('channels.list.settings'));
+
+ $page->hover('@header-title')->hover("@channel-menu-{$channel->id}");
+ waitFor($page, "@channel-menu-tooltip-{$channel->id}");
+ $page->assertSeeIn("@channel-menu-tooltip-{$channel->id}", __('channels.list.more_actions'));
+
+ $page->click("@channel-menu-{$channel->id}");
+ waitFor($page, "@channel-disconnect-{$channel->id}");
+ waitForState($page, "@channel-disconnect-{$channel->id}", 'element.getBoundingClientRect().width > 0 && element.getBoundingClientRect().top >= 0 && element.getBoundingClientRect().bottom <= window.innerHeight');
+
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/ComposerAutosaveTest.php b/tests/Browser/ComposerAutosaveTest.php
index b37b5e0c9..4538b0c81 100644
--- a/tests/Browser/ComposerAutosaveTest.php
+++ b/tests/Browser/ComposerAutosaveTest.php
@@ -9,6 +9,7 @@ use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
use Carbon\CarbonImmutable;
+use Illuminate\Support\Str;
/**
* @return array{0: User, 1: Workspace, 2: SocialAccount}
@@ -483,3 +484,78 @@ test('resuming an unfinished post keeps its thread replies', function () {
->assertValue("@composer-caption-{$bluesky->id}", 'Thread root')
->assertNoJavaScriptErrors();
});
+
+test('the sidebar new button marks an unfinished post as soon as the composer closes and drops the mark once it is discarded', function () {
+ [$user, , $account] = composerAutosaveWorkspace();
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@sidebar-new');
+ $page->assertMissing('@sidebar-new-unfinished');
+
+ openComposerForAutosave($page);
+ writeUnfinishedPost($page, $account, 'Half written idea');
+ closeComposerForAutosave($page);
+ waitFor($page, '@sidebar-new-unfinished');
+
+ $page->hover('@sidebar-new');
+ waitForText($page, '@sidebar-new-unfinished-tooltip', __('sidebar.unfinished_post'));
+ $page->click('@sidebar-new');
+ waitForOpen($page, '@sidebar-new-menu');
+ $page->assertVisible('@sidebar-new-post-unfinished')
+ ->assertSeeIn('@sidebar-new-post-unfinished', __('sidebar.unfinished_post'));
+ $page->keys('@sidebar-new-post', 'Escape');
+ waitForGone($page, '@sidebar-new-menu');
+
+ openComposerForAutosave($page);
+ waitFor($page, '@composer-resume-dialog');
+ $page->click('@composer-resume-discard');
+ waitForGone($page, '@composer-resume-dialog');
+ closeComposerForAutosave($page);
+
+ waitForGone($page, '@sidebar-new-unfinished');
+ $page->hover('@sidebar-new');
+ $page->script('new Promise((resolve) => setTimeout(resolve, 800))');
+ $page->assertMissing('@sidebar-new-unfinished-tooltip');
+
+ $page->click('@sidebar-new');
+ waitForOpen($page, '@sidebar-new-menu');
+ $page->assertMissing('@sidebar-new-post-unfinished')
+ ->assertNoJavaScriptErrors();
+});
+
+test('the sidebar new button marks only a draft the composer offers back, not one left with labels, a disconnected channel or expired uploads', function (Closure $draft, bool $marked) {
+ [$user, $workspace, $account] = composerAutosaveWorkspace();
+ $this->actingAs($user);
+
+ $page = visit(route('app.calendar'))->resize(1280, 900);
+ waitFor($page, '@sidebar-new');
+ seedComposerAutosave($page, $user, $workspace->id, $draft($account));
+
+ $page->navigate(route('app.posts.index'));
+ waitFor($page, '@sidebar-new');
+
+ if ($marked) {
+ waitFor($page, '@sidebar-new-unfinished');
+ } else {
+ $page->script('new Promise((resolve) => setTimeout(resolve, 400))');
+ $page->assertMissing('@sidebar-new-unfinished');
+ }
+
+ openComposerForAutosave($page);
+
+ if ($marked) {
+ waitFor($page, '@composer-resume-dialog');
+ } else {
+ $page->assertMissing('@composer-resume-dialog');
+ }
+
+ $page->assertNoJavaScriptErrors();
+})->with([
+ 'its text' => [fn (SocialAccount $account): array => ['content' => 'Half written'], true],
+ 'its channel' => [fn (SocialAccount $account): array => ['accountIds' => [$account->id]], true],
+ 'a fresh upload' => [fn (SocialAccount $account): array => ['media' => [['id' => 'fresh', 'upload_token' => 'fresh-token', 'created_at' => now()->subHour()->toISOString(), 'url' => '/images/fresh.png', 'type' => 'image', 'mime_type' => 'image/png']]], true],
+ 'only labels' => [fn (SocialAccount $account): array => ['labelIds' => ['label']], false],
+ 'a disconnected channel' => [fn (SocialAccount $account): array => ['accountIds' => [(string) Str::uuid()]], false],
+ 'an expired upload' => [fn (SocialAccount $account): array => ['media' => [['id' => 'expired', 'upload_token' => 'expired-token', 'created_at' => now()->subHours(25)->toISOString(), 'url' => '/images/expired.png', 'type' => 'image', 'mime_type' => 'image/png']]], false],
+]);
diff --git a/tests/Browser/ComposerUnsavedChangesTest.php b/tests/Browser/ComposerUnsavedChangesTest.php
index 24d1010ea..b6827615a 100644
--- a/tests/Browser/ComposerUnsavedChangesTest.php
+++ b/tests/Browser/ComposerUnsavedChangesTest.php
@@ -1162,3 +1162,29 @@ test('manage posting times in the schedule menu of an edited post asks first ins
->assertVisible('@post-composer-dialog')
->assertNoJavaScriptErrors();
});
+
+test('closing the copy of a post duplicated from the board goes back to the board, and one back reaches the page before', function () {
+ $post = seedUnsavedChangesReel();
+ $post->update(['status' => PostStatus::Draft]);
+ subscribeAccount($post->user->account);
+
+ $page = visit(route('app.settings.preferences'))->navigate(route('app.posts.board'));
+ waitFor($page, "@board-card-menu-{$post->id}");
+ $page->click("@board-card-menu-{$post->id}");
+ waitForOpen($page, "@post-card-menu-content-board-{$post->id}");
+ $page->click("@post-duplicate-board-{$post->id}");
+ waitFor($page, '@post-composer-dialog');
+
+ $page->click('@composer-close');
+ waitForPath($page, (string) parse_url(route('app.posts.board'), PHP_URL_PATH));
+
+ $page->assertPathIs((string) parse_url(route('app.posts.board'), PHP_URL_PATH))
+ ->assertMissing('@post-composer-dialog')
+ ->assertMissing('@unsaved-changes-dialog');
+
+ $page->back();
+ waitForPath($page, (string) parse_url(route('app.settings.preferences'), PHP_URL_PATH));
+
+ $page->assertPathIs((string) parse_url(route('app.settings.preferences'), PHP_URL_PATH))
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/CreateIdeaEditorTest.php b/tests/Browser/CreateIdeaEditorTest.php
index 40b4f70c5..7678f7e48 100644
--- a/tests/Browser/CreateIdeaEditorTest.php
+++ b/tests/Browser/CreateIdeaEditorTest.php
@@ -835,3 +835,21 @@ test('the stage picker search ignores accents and matches each word in any order
->assertMissing('@idea-editor-stage-option-unassigned')
->assertNoJavaScriptErrors();
});
+
+test('the idea editor label button shows the first two labels and counts the rest', function () {
+ [$user, $workspace] = createIdeaEditorSetup();
+ $labels = collect(['Alpha', 'Beta', 'Gamma'])
+ ->map(fn (string $name) => WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => $name]));
+ $idea = createIdeaEditorIdea($workspace, $user, ['title' => 'Greeting', 'body' => 'Hello']);
+ $idea->labels()->attach($labels->pluck('id'));
+ $this->actingAs($user);
+
+ $page = visit(route('app.create.ideas.show', $idea));
+ waitForOpen($page, '@idea-editor');
+ waitForText($page, '@idea-editor-labels-chip-more', '+1');
+
+ $page->assertSeeIn('@idea-editor-labels', 'Alpha')
+ ->assertSeeIn('@idea-editor-labels', 'Beta')
+ ->assertDontSeeIn('@idea-editor-labels', 'Gamma')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/CreateIdeasBoardTest.php b/tests/Browser/CreateIdeasBoardTest.php
index d9c637d17..dec0dc1a7 100644
--- a/tests/Browser/CreateIdeasBoardTest.php
+++ b/tests/Browser/CreateIdeasBoardTest.php
@@ -863,3 +863,18 @@ test('on a phone the label filter opens as a sheet', function () {
$page->assertVisible('@ideas-filter-labels-sheet')
->assertNoJavaScriptErrors();
});
+
+test('an idea card shows its labels as chips in their own color', function () {
+ [$user, $workspace, $stages] = createIdeasBoardSetup();
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Launch', 'color' => '#7c3aed']);
+ $idea = createIdeasBoardIdea($workspace, $user, $stages['todo'], 1, 'Spring sale');
+ $idea->labels()->attach($label);
+ $this->actingAs($user);
+
+ $page = visit(route('app.create.ideas.index'));
+ waitFor($page, "@idea-card-label-{$idea->id}-{$label->id}");
+
+ $page->assertSeeIn("@idea-card-label-{$idea->id}-{$label->id}", 'Launch')
+ ->assertScript("getComputedStyle(document.querySelector('[data-testid=\"idea-card-label-{$idea->id}-{$label->id}\"]')).backgroundColor", 'rgb(124, 58, 237)')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/InsightsChannelFilterTest.php b/tests/Browser/InsightsChannelFilterTest.php
index 2b1c9d1c8..c8e6c6d39 100644
--- a/tests/Browser/InsightsChannelFilterTest.php
+++ b/tests/Browser/InsightsChannelFilterTest.php
@@ -3,14 +3,17 @@
declare(strict_types=1);
use App\Enums\SocialAccount\Platform;
+use App\Enums\User\Locale;
use App\Jobs\Analytics\BootstrapAccountAnalytics;
use App\Jobs\Analytics\CollectAccountDailySnapshot;
use App\Models\AnalyticsAccountDailySnapshot;
use App\Models\AnalyticsPublication;
use App\Models\AnalyticsPublicationDailySnapshot;
+use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
use Illuminate\Support\Facades\Queue;
/** @return array{0: User, 1: list<SocialAccount>} */
@@ -336,3 +339,147 @@ test('on a touch screen a tap on a line’s label, which never leaves it, fades
->and($dimmed)->toBe(0);
$page->assertNoJavaScriptErrors();
});
+
+test('a follower change of a thousand or more reads short and signed, the same in every language', function () {
+ [$user, [$alpha]] = insightsChannelFilterFixture();
+ $user->update(['locale' => Locale::PortugueseBrazil]);
+ AnalyticsAccountDailySnapshot::query()
+ ->where('social_account_id', $alpha->id)
+ ->where('followers_count', 120)
+ ->update(['followers_count' => 1300]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitFor($page, '@analytics-followers-change');
+
+ $page->assertSeeIn('@analytics-followers-change', '+1.2K')
+ ->assertNoJavaScriptErrors();
+});
+
+test('picking a label narrows the post metrics and keeps the label in the url', function () {
+ [$user, [$alpha]] = insightsChannelFilterFixture();
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $alpha->workspace_id, 'name' => 'Launch']);
+ $post = Post::factory()->forAccount($alpha)->published()->create(['user_id' => $user->id]);
+ $post->labels()->attach($label);
+ AnalyticsPublication::query()->where('social_account_id', $alpha->id)->update(['post_id' => $post->id]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+
+ $page->click('@analytics-label-filter');
+ waitFor($page, "@analytics-label-checkbox-{$label->id}");
+ $page->click("@analytics-label-checkbox-{$label->id}");
+ waitForCondition($page, "[...new URLSearchParams(location.search)].some(([key, value]) => key.startsWith('labels') && value === '{$label->id}')");
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '1'");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('picking untagged counts only the posts without a label and clearing the filter brings every post back', function () {
+ [$user, [$alpha]] = insightsChannelFilterFixture();
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $alpha->workspace_id]);
+ $post = Post::factory()->forAccount($alpha)->published()->create(['user_id' => $user->id]);
+ $post->labels()->attach($label);
+ AnalyticsPublication::query()->where('social_account_id', $alpha->id)->update(['post_id' => $post->id]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+
+ $page->click('@analytics-label-filter');
+ waitFor($page, '@analytics-label-untagged-checkbox');
+ $page->click('@analytics-label-untagged-checkbox');
+ waitForCondition($page, "new URLSearchParams(location.search).get('untagged') === '1'");
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '1'");
+
+ $page->click('@analytics-label-clear');
+ waitForCondition($page, "!new URLSearchParams(location.search).has('untagged')");
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+function insightsLabelledFixture(): array
+{
+ [$user, [$alpha]] = insightsChannelFilterFixture();
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $alpha->workspace_id]);
+ $post = Post::factory()->forAccount($alpha)->published()->create(['user_id' => $user->id]);
+ $post->labels()->attach($label);
+ AnalyticsPublication::query()->where('social_account_id', $alpha->id)->update(['post_id' => $post->id]);
+
+ return [$user, $label];
+}
+
+function pickInsightsLabel(mixed $page, WorkspaceLabel $label): void
+{
+ $page->click('@analytics-label-filter');
+ waitFor($page, "@analytics-label-checkbox-{$label->id}");
+ $page->click("@analytics-label-checkbox-{$label->id}");
+ waitForCondition($page, "[...new URLSearchParams(location.search)].some(([key, value]) => key.startsWith('labels') && value === '{$label->id}')");
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '1'");
+ $page->keys("@analytics-label-checkbox-{$label->id}", 'Escape');
+ waitForGone($page, "@analytics-label-checkbox-{$label->id}");
+}
+
+test('a picked label stays through a range change and goes into the export links', function () {
+ [$user, $label] = insightsLabelledFixture();
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+ pickInsightsLabel($page, $label);
+
+ $page->click('@insights-range-7d');
+ waitForQueryParameter($page, 'range', '7d');
+ waitForCondition($page, "[...new URLSearchParams(location.search)].some(([key, value]) => key.startsWith('labels') && value === '{$label->id}')");
+
+ $page->click('@insights-export');
+ waitFor($page, '@insights-export-csv');
+ expect(urldecode((string) $page->script('document.querySelector("[data-testid=insights-export-csv]").href')))
+ ->toContain($label->id)
+ ->toContain('range=7d');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('history back re-syncs the label filter of the workspace insights with the page', function () {
+ [$user, $label] = insightsLabelledFixture();
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights'));
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+
+ $page->click('@insights-range-7d');
+ waitForQueryParameter($page, 'range', '7d');
+ pickInsightsLabel($page, $label);
+
+ $page->script('history.back()');
+ waitForCondition($page, "!location.search.includes('range=7d') && !location.search.includes('labels')");
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+
+ $page->click('@analytics-label-filter');
+ waitFor($page, "@analytics-label-checkbox-{$label->id}");
+ $page->assertAttribute("@analytics-label-checkbox-{$label->id}", 'data-state', 'unchecked')
+ ->assertNoJavaScriptErrors();
+});
+
+test('a deleted label in the url keeps the workspace insights open and matches no post', function () {
+ [$user, $label] = insightsLabelledFixture();
+ $label->delete();
+ $this->actingAs($user);
+
+ $page = visit(route('app.insights', ['labels' => [$label->id]]));
+ waitFor($page, '@analytics-label-filter');
+
+ $page->assertPathIs(route('app.insights', absolute: false))
+ ->assertNoJavaScriptErrors();
+ expect($page->script('location.search'))->toContain($label->id);
+
+ $page->click('@analytics-label-filter');
+ waitFor($page, '@analytics-label-clear');
+ $page->click('@analytics-label-clear');
+ waitForCondition($page, "!location.search.includes('labels')");
+ waitForState($page, '@analytics-summary-posts .font-heading', "element.textContent.trim() === '2'");
+
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/LabelFilterPopoverTest.php b/tests/Browser/LabelFilterPopoverTest.php
index ad1162354..667fe11e3 100644
--- a/tests/Browser/LabelFilterPopoverTest.php
+++ b/tests/Browser/LabelFilterPopoverTest.php
@@ -108,3 +108,31 @@ test('the label filter search ignores accents and hides untagged when it does no
->assertVisible("@posts-label-option-{$launch->id}")
->assertNoJavaScriptErrors();
});
+
+test('each label in the filter shows as a chip in its own color', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['account_id' => $user->account_id, 'user_id' => $user->id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ subscribeAccount($user->account);
+ $green = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Green', 'color' => '#16a34a']);
+ $gray = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Gray', 'color' => '#d1d5db']);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index', ['tab' => 'drafts']));
+ waitFor($page, '@posts-label-filter');
+ $page->click('@posts-label-filter');
+ waitFor($page, "@posts-label-chip-{$green->id}");
+
+ $chip = fn (WorkspaceLabel $label): array => $page->script(<<<JS
+ (() => {
+ const style = getComputedStyle(document.querySelector('[data-testid="posts-label-chip-{$label->id}"]'));
+ return [style.backgroundColor, style.color];
+ })()
+ JS);
+
+ expect($chip($green))->toBe(['rgb(22, 163, 74)', 'rgb(255, 255, 255)'])
+ ->and($chip($gray))->toBe(['rgb(209, 213, 219)', 'rgb(10, 10, 10)']);
+ $page->assertSeeIn("@posts-label-chip-{$green->id}", 'Green')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/LabelRowMenuTest.php b/tests/Browser/LabelRowMenuTest.php
index efcc76227..bb6738fae 100644
--- a/tests/Browser/LabelRowMenuTest.php
+++ b/tests/Browser/LabelRowMenuTest.php
@@ -6,6 +6,10 @@ use App\Models\Post;
use App\Models\User;
use App\Models\Workspace;
use App\Models\WorkspaceLabel;
+use Illuminate\Support\Arr;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Str;
function labelMenuOwner(): array
{
@@ -176,15 +180,80 @@ test('a label row shows its color, how many posts use it and its actions in one
$page->assertSeeIn("@label-posts-count-{$label->id}", trans_choice('labels.meta.posts', 1, ['count' => 1]));
- expect($page->script("getComputedStyle(document.querySelector('[data-testid=\"label-swatch-{$label->id}\"]')).color"))
+ expect($page->script("getComputedStyle(document.querySelector('[data-testid=\"label-swatch-{$label->id}\"]')).backgroundColor"))
->toBe('rgb(22, 163, 74)');
$page->click("@label-menu-{$label->id}");
- waitFor($page, "@edit-label-{$label->id}");
+ waitFor($page, "@delete-label-{$label->id}");
- $page->assertVisible("@delete-label-{$label->id}")
- ->click("@edit-label-{$label->id}");
- waitFor($page, '@edit-label-dialog');
+ $page->assertVisible("@label-view-posts-{$label->id}")
+ ->assertVisible("@label-view-insights-{$label->id}")
+ ->assertMissing("@edit-label-{$label->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('only the cog on a label row opens its edit dialog, not the rest of the row, and the cog and menu say Settings and More actions', function () {
+ [$user, $label] = labelMenuOwner();
+ $this->actingAs($user);
+
+ $page = visit(route('app.labels.index'));
+ waitFor($page, "@label-settings-{$label->id}");
+
+ $page->click("@label-posts-count-{$label->id}");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 400))');
+ $page->assertMissing('@edit-label-dialog');
+
+ $page->hover("@label-settings-{$label->id}");
+ waitForText($page, "@label-settings-tooltip-{$label->id}", __('labels.actions.settings'));
+ $page->hover('@header-title')->hover("@label-menu-{$label->id}");
+ waitForText($page, "@label-menu-tooltip-{$label->id}", __('labels.actions.more'));
- $page->assertVisible('@edit-label-dialog')->assertNoJavaScriptErrors();
+ $page->click("@label-settings-{$label->id}");
+ waitForOpen($page, '@edit-label-dialog');
+
+ $page->assertVisible('@edit-label-dialog')
+ ->assertNoJavaScriptErrors();
+});
+
+test('label row menu opens insights filtered by the label in a new tab, with the label picked in the filter', function () {
+ [$user, $label] = labelMenuOwner();
+ subscribeAccount($user->account);
+ $this->actingAs($user);
+
+ $page = visit(route('app.labels.index'));
+ waitFor($page, "@label-menu-{$label->id}");
+ $page->click("@label-menu-{$label->id}");
+ waitFor($page, "@label-view-insights-{$label->id}");
+
+ $link = $page->script(<<<JS
+ (() => {
+ const link = document.querySelector('[data-testid="label-view-insights-{$label->id}"]');
+ return { href: decodeURIComponent(link.href), target: link.target, rel: link.rel };
+ })()
+ JS);
+
+ expect($link['target'])->toBe('_blank')
+ ->and($link['rel'])->toContain('noopener')
+ ->and($link['href'])->toStartWith(route('app.insights'))
+ ->and($link['href'])->toContain("labels[]={$label->id}");
+
+ assertLabelFilterSelected(visit(route('app.insights', ['labels' => [$label->id]])), 'analytics-label', $label->id);
+});
+
+test('a label without posts says so and a label with thousands of posts shows its exact count', function () {
+ [$user, $label] = labelMenuOwner();
+ $empty = WorkspaceLabel::factory()->create(['workspace_id' => $label->workspace_id, 'name' => 'Empty']);
+ $post = Post::factory()->create(['workspace_id' => $label->workspace_id, 'user_id' => $user->id]);
+ $row = Arr::except((array) DB::table('posts')->where('id', $post->id)->first(), ['id']);
+ $ids = collect(range(1, 1200))->map(fn (): string => (string) Str::uuid());
+ $ids->chunk(200)->each(fn (Collection $chunk) => DB::table('posts')->insert($chunk->map(fn (string $id): array => [...$row, 'id' => $id])->all()));
+ $ids->chunk(200)->each(fn (Collection $chunk) => DB::table('post_workspace_label')->insert($chunk->map(fn (string $id): array => ['post_id' => $id, 'workspace_label_id' => $label->id])->values()->all()));
+ $this->actingAs($user);
+
+ $page = visit(route('app.labels.index'));
+ waitFor($page, "@label-posts-count-{$label->id}");
+
+ $page->assertSeeIn("@label-posts-count-{$label->id}", trans_choice('labels.meta.posts', 1200, ['count' => 1200]))
+ ->assertSeeIn("@label-posts-count-{$empty->id}", trans_choice('labels.meta.posts', 0, ['count' => 0]))
+ ->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/PostCardLabelsTest.php b/tests/Browser/PostCardLabelsTest.php
index f0366ad92..19c97d2b0 100644
--- a/tests/Browser/PostCardLabelsTest.php
+++ b/tests/Browser/PostCardLabelsTest.php
@@ -216,17 +216,18 @@ test('the first label of the card picker sits apart from its search box', functi
$page->assertNoJavaScriptErrors();
});
-test('a card label shows its name as typed, in a chip as tall as the label button beside it', function () {
+test('a card label shows its name as typed on its own color, in a chip as tall as the label button beside it', function () {
[$user, $workspace, $channel] = cardLabelsSetup();
- $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Coca Cola']);
+ $light = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Coca Cola', 'color' => '#d1d5db']);
+ $dark = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Green', 'color' => '#16a34a']);
$post = cardLabelsPost($user, $workspace, $channel);
- $post->labels()->attach($label);
+ $post->labels()->attach([$light->id, $dark->id]);
$this->actingAs($user);
$page = visit(route('app.posts.index'));
- waitFor($page, "@post-label-chip-{$post->id}-{$label->id}");
+ waitFor($page, "@post-label-chip-{$post->id}-{$dark->id}");
- $chip = $page->script(<<<JS
+ $chip = fn (WorkspaceLabel $label) => $page->script(<<<JS
(() => {
const chip = document.querySelector('[data-testid="post-label-chip-{$post->id}-{$label->id}"]');
const button = document.querySelector('[data-testid="post-labels-{$post->id}-edit"]');
@@ -236,20 +237,23 @@ test('a card label shows its name as typed, in a chip as tall as the label butto
text: chip.innerText.trim(),
transform: style.textTransform,
fontSize: style.fontSize,
- radius: style.borderTopLeftRadius,
- shadow: style.boxShadow,
+ background: style.backgroundColor,
+ color: style.color,
sameHeight: Math.round(chip.getBoundingClientRect().height) === Math.round(button.getBoundingClientRect().height),
};
})()
JS);
- expect($chip)->toBe([
+ expect($chip($light))->toBe([
'text' => 'Coca Cola',
'transform' => 'none',
'fontSize' => '12px',
- 'radius' => '6px',
- 'shadow' => 'none',
+ 'background' => 'rgb(209, 213, 219)',
+ 'color' => 'rgb(10, 10, 10)',
'sameHeight' => true,
+ ])->and($chip($dark))->toMatchArray([
+ 'background' => 'rgb(22, 163, 74)',
+ 'color' => 'rgb(255, 255, 255)',
]);
$page->assertNoJavaScriptErrors();
});
diff --git a/tests/Browser/PostComposerDialogTest.php b/tests/Browser/PostComposerDialogTest.php
index c13906bb5..4f6eb1a4e 100644
--- a/tests/Browser/PostComposerDialogTest.php
+++ b/tests/Browser/PostComposerDialogTest.php
@@ -1367,3 +1367,36 @@ test('select all picks only the channels the search shows, and the last used sho
->assertMissing("@composer-account-{$x->id}")
->assertNoJavaScriptErrors();
});
+
+test('the composer label button keeps its tag icon, shows the first two labels as colored chips and counts the rest', function () {
+ $user = User::factory()->create();
+ $workspace = Workspace::factory()->create(['user_id' => $user->id, 'account_id' => $user->account_id]);
+ $workspace->members()->attach($user->id, membershipPivot('admin'));
+ $user->update(['current_workspace_id' => $workspace->id]);
+ subscribeAccount($user->account);
+ $account = SocialAccount::factory()->linkedin()->create(['workspace_id' => $workspace->id]);
+ $labels = collect(['Alpha' => '#16a34a', 'Beta' => '#7c3aed', 'Gamma' => '#dc2626'])
+ ->map(fn (string $color, string $name) => WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => $name, 'color' => $color]));
+ $post = Post::factory()->forAccount($account)->draft()->create(['user_id' => $user->id]);
+ $post->labels()->attach($labels->pluck('id'));
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.edit', $post));
+ waitForComposerReady($page, 'composer-tags-trigger');
+ waitForText($page, '@composer-tags-chip-more', '+1');
+
+ $chips = $page->script(<<<'JS'
+ Array.from(document.querySelectorAll('[data-testid^="composer-tags-chip-"]:not([data-testid$="-more"])'), (chip) => ({
+ text: chip.innerText.trim(),
+ background: getComputedStyle(chip).backgroundColor,
+ }))
+ JS);
+
+ expect($chips)->toBe([
+ ['text' => 'Alpha', 'background' => 'rgb(22, 163, 74)'],
+ ['text' => 'Beta', 'background' => 'rgb(124, 58, 237)'],
+ ]);
+ $page->assertDontSeeIn('@composer-tags-trigger', 'Gamma')
+ ->assertVisible('@composer-tags-icon')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PostNotesTest.php b/tests/Browser/PostNotesTest.php
index c681eabf6..6f6ff24ac 100644
--- a/tests/Browser/PostNotesTest.php
+++ b/tests/Browser/PostNotesTest.php
@@ -849,9 +849,11 @@ test('notes open, grow, send, edit and fit the card on every tab, on desktop and
$page->fill('@note-input', 'First line');
waitForEditorText($page, '@note-input', 'First line');
$page->keys('@note-input', ['Shift+Enter']);
+ waitFor($page, '@note-input br');
$page->typeSlowly('@note-input', 'Second line', 10);
waitForEditorText($page, '@note-input', "First line\nSecond line");
$page->keys('@note-input', ['Shift+Enter']);
+ waitForCount($page, '@note-input br', 2, '>=');
$page->typeSlowly('@note-input', 'Third line', 10);
waitForEditorText($page, '@note-input', "First line\nSecond line\nThird line");
$grown = $page->script("document.querySelector('[data-testid=\"note-input\"]').getBoundingClientRect().height");
diff --git a/tests/Browser/PublishBoardTest.php b/tests/Browser/PublishBoardTest.php
new file mode 100644
index 000000000..8c9d06a97
--- /dev/null
+++ b/tests/Browser/PublishBoardTest.php
@@ -0,0 +1,643 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\Post\Status as PostStatus;
+use App\Enums\SocialAccount\Platform;
+use App\Enums\User\Locale;
+use App\Jobs\PublishPost;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+use Illuminate\Support\Arr;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Queue;
+use Illuminate\Support\Str;
+
+function boardInsideViewport(): string
+{
+ return 'element.getBoundingClientRect().width > 0 && element.getBoundingClientRect().top >= 0 && element.getBoundingClientRect().left >= 0 && element.getBoundingClientRect().right <= window.innerWidth + 1 && element.getBoundingClientRect().bottom <= window.innerHeight + 1';
+}
+
+beforeEach(function () {
+ $this->user = User::factory()->create(['timezone' => 'UTC', 'locale' => Locale::DEFAULT]);
+ $this->workspace = Workspace::factory()->create(['user_id' => $this->user->id, 'account_id' => $this->user->account_id]);
+ $this->workspace->members()->attach($this->user->id, membershipPivot('admin'));
+ $this->user->update(['current_workspace_id' => $this->workspace->id]);
+ subscribeAccount($this->user->account);
+ $this->user = $this->user->fresh();
+ connectAiTo($this->user);
+
+ $this->channel = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::LinkedIn,
+ 'position' => 1,
+ ]);
+ $this->draft = Post::factory()->forAccount($this->channel)->draft()->create(['user_id' => $this->user->id]);
+});
+
+test('the list links to the board and the board groups by status', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+
+ waitForPath($page, route('app.posts.board', absolute: false));
+ waitFor($page, '@board-column-draft');
+
+ $page->assertVisible('@board-column-draft')
+ ->assertVisible('@board-column-approvals')
+ ->assertVisible('@board-column-scheduled')
+ ->assertVisible('@board-column-published')
+ ->assertVisible('@board-column-failed');
+
+ waitFor($page, "@board-column-draft @board-card-{$this->draft->id}");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('group by tag shows a post in each of its tags', function () {
+ $alpha = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Alpha', 'color' => '#16a34a']);
+ $beta = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Beta']);
+ $this->draft->labels()->attach([$alpha->id, $beta->id]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitForCount($page, '@board-group-trigger', 1);
+ waitForState($page, '@board-group-trigger', 'element.getBoundingClientRect().height > 0');
+
+ $page->click('@board-group-trigger');
+
+ waitForOpen($page, '@board-group-content');
+ waitForState($page, '@board-group-content', boardInsideViewport());
+
+ $page->click('@board-group-option-tag');
+
+ waitFor($page, "@board-column-label_{$alpha->id}");
+ waitFor($page, "@board-column-label_{$alpha->id} @board-card-{$this->draft->id}");
+ waitFor($page, "@board-column-label_{$beta->id} @board-card-{$this->draft->id}");
+ waitForCount($page, "@board-card-{$this->draft->id}", 2);
+
+ $page->assertVisible("@board-column-label_{$beta->id}")
+ ->assertSeeIn("@board-column-label-label_{$alpha->id}", 'Alpha')
+ ->assertScript("getComputedStyle(document.querySelector('[data-testid=\"board-column-label-label_{$alpha->id}\"]')).backgroundColor", 'rgb(22, 163, 74)')
+ ->assertNoJavaScriptErrors();
+});
+
+test('a card opens the post details', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-card-open-{$this->draft->id}");
+
+ $page->click("@board-card-open-{$this->draft->id}");
+
+ waitForOpen($page, "@post-details-{$this->draft->id}");
+ waitForState($page, "@post-details-{$this->draft->id}", boardInsideViewport());
+
+ $page->assertVisible("@post-details-{$this->draft->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('on a phone the group menu is a bottom sheet', function () {
+ $channelTwo = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Mastodon,
+ 'position' => 2,
+ ]);
+ Post::factory()->forAccount($channelTwo)->draft()->create(['user_id' => $this->user->id]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(390, 844);
+ waitForCount($page, '@board-group-trigger', 1);
+ waitForState($page, '@board-group-trigger', 'element.getBoundingClientRect().height > 0');
+
+ $page->assertAttribute('@board-group-trigger', 'aria-label', __('posts.board.group_by_value', ['group' => __('posts.board.groups.status')]));
+
+ $page->click('@board-group-trigger');
+
+ waitForOpen($page, '@board-group-sheet');
+ waitForState($page, '@board-group-sheet', boardInsideViewport());
+
+ $page->click('@board-group-option-channel');
+
+ waitFor($page, "@board-column-channel_{$this->channel->id}");
+
+ $page->assertVisible("@board-column-channel_{$this->channel->id}")
+ ->assertAttribute('@board-group-trigger', 'aria-label', __('posts.board.group_by_value', ['group' => __('posts.board.groups.channel')]))
+ ->assertNoJavaScriptErrors();
+});
+
+test('the channel filter, the label filter and a card menu open inside the viewport', function () {
+ WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Alpha']);
+ SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::Mastodon,
+ 'position' => 2,
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, '@posts-channel-filter');
+
+ $page->click('@posts-channel-filter');
+ waitFor($page, '@posts-channel-toggle-all');
+ waitForState($page, '@posts-channel-toggle-all', boardInsideViewport());
+ $page->click('@posts-channel-filter');
+ waitForGone($page, '@posts-channel-toggle-all');
+
+ $page->click('@posts-label-filter');
+ waitFor($page, '@posts-label-untagged');
+ waitForState($page, '@posts-label-untagged', boardInsideViewport());
+ $page->click('@posts-label-filter');
+ waitForGone($page, '@posts-label-untagged');
+
+ $page->click("@board-card-menu-{$this->draft->id}");
+ waitForOpen($page, "@post-card-menu-content-board-{$this->draft->id}");
+ waitForState($page, "@post-card-menu-content-board-{$this->draft->id}", boardInsideViewport());
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a card action reloads the columns, so a tagged card moves to its tag', function () {
+ $alpha = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Alpha']);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board', ['group' => 'tag']))->resize(1280, 900);
+ waitFor($page, "@board-column-untagged @board-card-{$this->draft->id}");
+ $page->assertMissing("@board-column-label_{$alpha->id} @board-card-{$this->draft->id}");
+
+ $page->click("@post-labels-board-{$this->draft->id}-trigger");
+ waitFor($page, "@post-labels-board-{$this->draft->id}-checkbox-{$alpha->id}");
+ $page->click("@post-labels-board-{$this->draft->id}-checkbox-{$alpha->id}");
+
+ waitFor($page, "@board-column-label_{$alpha->id} @board-card-{$this->draft->id}");
+ waitForGone($page, "@board-column-untagged @board-card-{$this->draft->id}");
+ waitForText($page, "@board-column-count-label_{$alpha->id}", '1');
+
+ expect($this->draft->labels()->pluck('workspace_labels.id')->all())->toBe([$alpha->id]);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a card action brings a tag created meanwhile in as a column and drops a deleted one', function () {
+ $alpha = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Alpha']);
+ $gone = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Gone']);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board', ['group' => 'tag']))->resize(1280, 900);
+ waitFor($page, "@board-column-untagged @board-card-{$this->draft->id}");
+ waitFor($page, "@board-column-label_{$gone->id}");
+
+ $added = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Added']);
+ $gone->delete();
+
+ $page->click("@post-labels-board-{$this->draft->id}-trigger");
+ waitFor($page, "@post-labels-board-{$this->draft->id}-checkbox-{$alpha->id}");
+ $page->click("@post-labels-board-{$this->draft->id}-checkbox-{$alpha->id}");
+
+ waitFor($page, "@board-column-label_{$alpha->id} @board-card-{$this->draft->id}");
+ waitFor($page, "@board-column-empty-label_{$added->id}");
+ waitForGone($page, "@board-column-label_{$gone->id}");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('an approver approves a pending post from its board card', function () {
+ $pending = Post::factory()->forAccount($this->channel)->pendingApproval()->create([
+ 'user_id' => $this->user->id,
+ 'content' => '<p>Ready for review</p>',
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-column-approvals @board-card-{$pending->id}");
+
+ $page->click("@post-approve-board-{$pending->id}");
+
+ waitFor($page, "@board-column-scheduled @board-card-{$pending->id}");
+ waitForGone($page, "@board-column-approvals @board-card-{$pending->id}");
+
+ waitForText($page, '@post-approval-toast', __('posts.approvals.toasts.scheduled'));
+
+ expect($pending->fresh()->status)->toBe(PostStatus::Scheduled);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a pending card reads Pending and splits its approval buttons across the row', function () {
+ $pending = Post::factory()->forAccount($this->channel)->pendingApproval()->create([
+ 'user_id' => $this->user->id,
+ 'scheduled_at' => now()->addDays(2),
+ ]);
+ $requester = workspaceMember($this->workspace, 'approval');
+ $request = Post::factory()->forAccount($this->channel)->pendingApproval()->create([
+ 'user_id' => $requester->id,
+ 'approval_requested_by' => $requester->id,
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board', ['group' => 'channel']))->resize(1280, 900);
+ waitFor($page, "@post-reject-board-{$pending->id}");
+
+ $page->assertSeeIn("@board-card-status-{$pending->id}", __('posts.status.pending_approval'));
+
+ $widths = $page->script("(() => { const row = document.querySelector('[data-testid=\"board-card-approval-{$pending->id}\"]').getBoundingClientRect(); const approve = document.querySelector('[data-testid=\"post-approve-board-{$pending->id}\"]').getBoundingClientRect(); const reject = document.querySelector('[data-testid=\"post-reject-board-{$pending->id}\"]').getBoundingClientRect(); return { equal: Math.abs(approve.width - reject.width) < 1, fills: Math.abs(approve.width + reject.width + 8 - row.width) < 1 }; })()");
+
+ expect($widths)->toBe(['equal' => true, 'fills' => true]);
+
+ $this->actingAs($requester);
+
+ $own = visit(route('app.posts.board', ['group' => 'channel']))->resize(1280, 900);
+ waitFor($own, "@post-revert-board-{$request->id}");
+
+ $fills = $own->script("(() => { const row = document.querySelector('[data-testid=\"board-card-approval-{$request->id}\"]').getBoundingClientRect(); const revert = document.querySelector('[data-testid=\"post-revert-board-{$request->id}\"]').getBoundingClientRect(); return Math.abs(revert.width - row.width) < 1; })()");
+
+ expect($fills)->toBeTrue();
+ $own->assertMissing("@post-approve-board-{$request->id}")
+ ->assertMissing("@post-reject-board-{$request->id}")
+ ->assertMissing("@board-card-{$pending->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('an approver rejects a pending post from its board card', function () {
+ $pending = Post::factory()->forAccount($this->channel)->pendingApproval()->create(['user_id' => $this->user->id]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-column-approvals @board-card-{$pending->id}");
+
+ $page->click("@post-reject-board-{$pending->id}");
+
+ waitFor($page, "@board-column-draft @board-card-{$pending->id}");
+ waitForGone($page, "@board-column-approvals @board-card-{$pending->id}");
+
+ waitForText($page, '@post-approval-toast', __('posts.approvals.toasts.rejected'));
+
+ expect($pending->fresh()->status)->toBe(PostStatus::Draft);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a label filter matching no column says so instead of an empty board', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board', ['group' => 'tag', 'labels' => [(string) str()->uuid()]]))->resize(1280, 900);
+ waitFor($page, '@board-no-columns');
+
+ $page->assertSeeIn('@board-no-columns', __('posts.board.no_columns.title'))
+ ->assertNoJavaScriptErrors();
+});
+
+test('moving a scheduled post to drafts from its board card menu reloads the columns in place', function () {
+ $scheduled = Post::factory()->forAccount($this->channel)->scheduled()->create([
+ 'user_id' => $this->user->id,
+ 'scheduled_at' => now()->addDays(2),
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-column-scheduled @board-card-{$scheduled->id}");
+ $page->script('document.querySelector(\'[data-testid="board-column-failed"]\').dataset.mounted = "before"');
+
+ $page->click("@board-card-menu-{$scheduled->id}");
+ waitForOpen($page, "@post-card-menu-content-board-{$scheduled->id}");
+ $page->click("@post-move-drafts-board-{$scheduled->id}");
+
+ waitFor($page, "@board-column-draft @board-card-{$scheduled->id}");
+ waitForGone($page, "@board-column-scheduled @board-card-{$scheduled->id}");
+
+ expect($page->script('document.querySelector(\'[data-testid="board-column-failed"]\').dataset.mounted'))->toBe('before');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('deleting a card from its menu reloads the columns in place', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-column-draft @board-card-{$this->draft->id}");
+ waitFor($page, '@board-column-scroll-failed');
+ $page->script('document.querySelector(\'[data-testid="board-column-scroll-failed"]\').dataset.mounted = "before"');
+
+ $page->click("@board-card-menu-{$this->draft->id}");
+ waitForOpen($page, "@post-card-menu-content-board-{$this->draft->id}");
+ $page->click("@post-delete-board-{$this->draft->id}");
+ waitForOpen($page, '@confirm-delete-modal');
+ $page->click('@confirm-delete-action');
+
+ waitForGone($page, "@board-card-{$this->draft->id}");
+
+ expect($page->script('document.querySelector(\'[data-testid="board-column-scroll-failed"]\')?.dataset.mounted'))->toBe('before')
+ ->and(Post::query()->whereKey($this->draft->id)->exists())->toBeFalse();
+ $page->assertNoJavaScriptErrors();
+});
+
+test('publishing now from a board card\'s details reloads the columns in place', function () {
+ Queue::fake([PublishPost::class]);
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ $scheduled = Post::factory()->forAccount($this->channel)->scheduled()->create([
+ 'user_id' => $this->user->id,
+ 'scheduled_at' => now()->addDays(2),
+ 'content' => 'Ready to go out',
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board', ['group' => 'tag']))->resize(1280, 900);
+ waitForText($page, "@board-card-status-{$scheduled->id}", __('posts.status.scheduled'));
+ waitFor($page, "@board-column-scroll-label_{$label->id}");
+ $page->script("document.querySelector('[data-testid=\"board-column-scroll-label_{$label->id}\"]').dataset.mounted = 'before'");
+
+ $page->click("@board-card-open-{$scheduled->id}");
+ waitFor($page, "@post-details-publish-now-{$scheduled->id}");
+ $page->click("@post-details-publish-now-{$scheduled->id}");
+
+ waitForText($page, "@board-card-status-{$scheduled->id}", __('posts.status.publishing'));
+
+ expect($page->script("document.querySelector('[data-testid=\"board-column-scroll-label_{$label->id}\"]')?.dataset.mounted"))->toBe('before')
+ ->and($scheduled->refresh()->status)->toBe(PostStatus::Publishing);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a draft without a time reads No time like the list, a dated one shows its time', function () {
+ $this->draft->update(['scheduled_at' => null]);
+ $dated = Post::factory()->forAccount($this->channel)->draft()->create([
+ 'user_id' => $this->user->id,
+ 'scheduled_at' => now('UTC')->addMonthNoOverflow()->startOfMonth()->addDays(14)->setTime(10, 0),
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-card-no-time-{$this->draft->id}");
+
+ $page->assertSeeIn("@board-card-no-time-{$this->draft->id}", __('posts.publish.no_time'))
+ ->assertMissing("@board-card-time-{$this->draft->id}")
+ ->assertVisible("@board-card-time-{$dated->id}")
+ ->assertMissing("@board-card-no-time-{$dated->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('a video thumbnail loads only once its card comes near the screen', function () {
+ $video = Post::factory()->forAccount($this->channel)->failed()->create([
+ 'user_id' => $this->user->id,
+ 'media' => [['id' => (string) str()->uuid(), 'path' => 'media/clip.mp4', 'url' => 'https://cdn.test/clip.mp4', 'type' => 'video', 'mime_type' => 'video/mp4']],
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(390, 844);
+ waitFor($page, "@board-card-thumbnail-{$video->id}");
+
+ expect($page->script("document.querySelectorAll('[data-testid=\"board-card-thumbnail-{$video->id}\"] video').length"))->toBe(0);
+
+ $page->script('document.querySelector(\'[data-testid="board-column-failed"]\').scrollIntoView({ inline: "start" })');
+ waitFor($page, "@board-card-thumbnail-{$video->id} video");
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a thousand posts or more show as a short count on the board column and the list tab, the same in every language', function () {
+ $this->user->update(['locale' => Locale::PortugueseBrazil]);
+ $published = Post::factory()->forAccount($this->channel)->published()->create(['user_id' => $this->user->id]);
+ $row = Arr::except((array) DB::table('posts')->where('id', $published->id)->first(), ['id']);
+
+ collect(range(1, 1199))
+ ->map(fn (): array => [...$row, 'id' => (string) Str::uuid()])
+ ->chunk(200)
+ ->each(fn (Collection $rows) => DB::table('posts')->insert($rows->all()));
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitForText($page, '@board-column-count-published', '1.2K');
+
+ $page->assertAttribute('@board-column-count-published', 'title', '1200')
+ ->assertSeeIn('@board-column-count-draft', '1')
+ ->assertNoJavaScriptErrors();
+
+ $list = visit(route('app.posts.index'))->resize(1280, 900);
+ waitForText($list, '@publish-tab-count-sent', '1.2K');
+
+ $list->assertSeeIn('@publish-tab-count-drafts', '1')
+ ->assertNoJavaScriptErrors();
+});
+
+test('a post created, published or deleted elsewhere reaches the open board and the sidebar counts without a reload', function () {
+ $scheduled = Post::factory()->forAccount($this->channel)->scheduled()->create(['user_id' => $this->user->id]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-column-scheduled @board-card-{$scheduled->id}");
+ waitForCondition($page, "Boolean(window.Pusher?.instances[0]?.channels.channels['private-workspace.{$this->workspace->id}'])");
+ waitForText($page, "@sidebar-channel-count-{$this->channel->id}", '1');
+
+ $emit = fn (string $event) => $page->script(<<<JS
+ window.Pusher.instances[0].channels.channels['private-workspace.{$this->workspace->id}'].emit('{$event}', {})
+ JS);
+
+ $created = Post::factory()->forAccount($this->channel)->draft()->create(['user_id' => $this->user->id]);
+ $emit('post.created');
+ waitFor($page, "@board-column-draft @board-card-{$created->id}");
+
+ $scheduled->markAsPublished();
+ $emit('post.platform.status.updated');
+ waitFor($page, "@board-column-published @board-card-{$scheduled->id}");
+ waitForGone($page, "@board-column-scheduled @board-card-{$scheduled->id}");
+ waitForText($page, "@sidebar-channel-count-{$this->channel->id}", '0');
+
+ $this->draft->delete();
+ $emit('post.deleted');
+ waitForGone($page, "@board-card-{$this->draft->id}");
+
+ $page->assertVisible("@board-card-{$created->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('a column loads its next posts as it scrolls', function () {
+ config()->set('app.pagination.default', 2);
+ Post::factory()->forAccount($this->channel)->draft()->count(4)->create(['user_id' => $this->user->id]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitForCount($page, '@board-column-draft [data-testid^="board-card-open-"]', 2);
+ waitForText($page, '@board-column-count-draft', '5');
+
+ $scrollDown = "document.querySelector('[data-testid=\"board-column-scroll-draft\"]').scrollTop = 100000";
+ $page->script($scrollDown);
+ waitForCount($page, '@board-column-draft [data-testid^="board-card-open-"]', 4);
+ $page->script($scrollDown);
+ waitForCount($page, '@board-column-draft [data-testid^="board-card-open-"]', 5);
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a card opens its details from the keyboard', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-card-open-{$this->draft->id}");
+
+ $page->keys("@board-card-open-{$this->draft->id}", 'Enter');
+
+ waitForOpen($page, "@post-details-{$this->draft->id}");
+ $page->assertVisible("@post-details-{$this->draft->id}")
+ ->assertNoJavaScriptErrors();
+});
+
+test('approving from a board card shows the button waiting until the answer lands', function () {
+ $pending = Post::factory()->forAccount($this->channel)->pendingApproval()->create([
+ 'user_id' => $this->user->id,
+ 'content' => '<p>Ready for review</p>',
+ 'scheduled_at' => now()->addDays(2),
+ ]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@post-approve-board-{$pending->id}");
+
+ $page->script(<<<'JS'
+ (() => {
+ const send = XMLHttpRequest.prototype.send;
+ window.__heldRequests = [];
+ XMLHttpRequest.prototype.send = function (body) {
+ window.__heldRequests.push(() => send.call(this, body));
+ };
+ window.__releaseRequests = () => {
+ XMLHttpRequest.prototype.send = send;
+ window.__heldRequests.splice(0).forEach((release) => release());
+ };
+ })()
+ JS);
+
+ $page->click("@post-approve-board-{$pending->id}");
+ waitForCondition($page, 'window.__heldRequests.length === 1');
+ waitForState($page, "@post-approve-board-{$pending->id}", 'element.disabled');
+
+ expect($pending->fresh()->status)->toBe(PostStatus::PendingApproval);
+
+ $page->script('window.__releaseRequests()');
+ waitFor($page, "@board-column-scheduled @board-card-{$pending->id}");
+ expect($pending->fresh()->status)->toBe(PostStatus::Scheduled);
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the recurrence opened for another channel of the post from its details reads that channel\'s time zone', function () {
+ $newYork = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::LinkedIn,
+ 'position' => 2,
+ 'timezone' => 'America/New_York',
+ ]);
+ $this->channel->update(['timezone' => 'UTC']);
+ $at = now('UTC')->addMonthNoOverflow()->startOfMonth()->addDays(14)->setTime(2, 0);
+ $group = (string) Str::uuid();
+ $first = Post::factory()->forAccount($this->channel)->scheduled()->create(['user_id' => $this->user->id, 'post_group_id' => $group, 'scheduled_at' => $at]);
+ $sibling = Post::factory()->forAccount($newYork)->scheduled()->create(['user_id' => $this->user->id, 'post_group_id' => $group, 'scheduled_at' => $at]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-card-open-{$first->id}");
+ $page->click("@board-card-open-{$first->id}");
+ waitForOpen($page, "@post-details-{$first->id}");
+
+ waitFor($page, "@post-details-rail-item-{$sibling->id}");
+ $page->click("@post-details-rail-item-{$sibling->id}");
+ waitFor($page, "@post-card-menu-details-{$sibling->id}");
+ $page->click("@post-card-menu-details-{$sibling->id}");
+ waitFor($page, "@post-recurrence-open-details-{$sibling->id}");
+ $page->click("@post-recurrence-open-details-{$sibling->id}");
+ waitFor($page, "@post-recurrence-summary-{$first->id}");
+
+ $local = $at->setTimezone('America/New_York');
+ waitForText($page, "@post-recurrence-summary-{$first->id}", "every {$local->format('l')} at {$local->format('g:i A')}");
+ $page->assertNoJavaScriptErrors();
+});
+
+test('compose on the board opens the composer there and closing it stays on the board with its grouping', function () {
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board', ['compose' => 1, 'group' => 'tag']))->resize(1280, 900);
+ waitFor($page, '@post-composer-dialog');
+
+ $page->assertPathIs(route('app.posts.board', absolute: false));
+ waitForCondition($page, "new URLSearchParams(location.search).get('group') === 'tag'");
+
+ $page->click('@composer-close');
+ waitForGone($page, '@post-composer-dialog');
+ waitFor($page, '@board-column-untagged');
+
+ $page->assertPathIs(route('app.posts.board', absolute: false))
+ ->assertNoJavaScriptErrors();
+ expect($page->script('location.search'))->toContain('group=tag');
+});
+
+test('editing a post from its board card lands back on the board after closing or saving', function (string $leave) {
+ $this->actingAs($this->user);
+ $before = route('app.settings.preferences', absolute: false);
+ $boardPath = route('app.posts.board', absolute: false);
+
+ $page = visit(route('app.settings.preferences'))->resize(1280, 900)->navigate(route('app.posts.board'));
+ waitFor($page, "@board-card-open-{$this->draft->id}");
+ $page->click("@board-card-open-{$this->draft->id}");
+ waitFor($page, "@post-details-edit-{$this->draft->id}");
+ $page->click("@post-details-edit-{$this->draft->id}");
+ waitFor($page, '@post-composer-dialog');
+
+ $page->click($leave);
+ waitForGone($page, '@post-composer-dialog');
+ waitForPath($page, $boardPath);
+ waitForCondition($page, "!location.search.includes('edit=')");
+ waitFor($page, "@board-card-{$this->draft->id}");
+
+ $page->assertPathIs($boardPath)->assertMissing('@unsaved-changes-dialog');
+
+ $page->back();
+ waitForPath($page, $before);
+
+ $page->assertPathIs($before)->assertNoJavaScriptErrors();
+})->with([
+ 'closing' => '@composer-close',
+ 'saving' => '@composer-save-draft',
+]);
+
+test('tab moves through a card\'s controls in reading order, then to the next card', function () {
+ $scheduled = Post::factory()->forAccount($this->channel)->scheduled()->create(['user_id' => $this->user->id]);
+
+ $this->actingAs($this->user);
+
+ $page = visit(route('app.posts.board'))->resize(1280, 900);
+ waitFor($page, "@board-column-scheduled @board-card-open-{$scheduled->id}");
+
+ $focused = "board-card-open-{$this->draft->id}";
+ $order = [$focused];
+
+ foreach (range(1, 3) as $step) {
+ $page->keys("@{$focused}", 'Tab');
+ $focused = $page->script("document.activeElement?.closest('[data-testid]')?.dataset.testid ?? ''");
+ $order[] = $focused;
+ }
+
+ expect($order)->toBe([
+ "board-card-open-{$this->draft->id}",
+ "post-labels-board-{$this->draft->id}-trigger",
+ "board-card-menu-{$this->draft->id}",
+ "board-card-open-{$scheduled->id}",
+ ]);
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PublishFiltersTest.php b/tests/Browser/PublishFiltersTest.php
new file mode 100644
index 000000000..b09717211
--- /dev/null
+++ b/tests/Browser/PublishFiltersTest.php
@@ -0,0 +1,81 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\SocialAccount\Platform;
+use App\Enums\User\Locale;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+
+function waitForPublishFiltersInUrl(mixed $page, string $labelId, string $channelId): void
+{
+ waitForCondition($page, <<<JS
+ ((params) => {
+ const values = (name) => [...params.entries()].filter(([key]) => key.startsWith(name + '[')).map(([, value]) => value);
+
+ return values('labels').includes('{$labelId}')
+ && params.get('untagged') === '1'
+ && values('channels').includes('{$channelId}')
+ && params.get('tz') === 'Asia/Tokyo';
+ })(new URLSearchParams(location.search))
+ JS);
+}
+
+function assertPublishFilterControls(mixed $page): void
+{
+ waitForText($page, '@posts-label-count', '2');
+ waitForText($page, '@posts-channel-count', '1');
+ waitForText($page, '@publish-timezone-select', 'Tokyo');
+}
+
+beforeEach(function () {
+ $this->user = User::factory()->create(['timezone' => 'UTC', 'locale' => Locale::DEFAULT]);
+ $workspace = Workspace::factory()->create(['user_id' => $this->user->id, 'account_id' => $this->user->account_id]);
+ $workspace->members()->attach($this->user->id, membershipPivot('admin'));
+ $this->user->update(['current_workspace_id' => $workspace->id]);
+ subscribeAccount($this->user->account);
+ $this->user = $this->user->fresh();
+ connectAiTo($this->user);
+
+ $this->linkedin = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::LinkedIn, 'timezone' => 'UTC']);
+ SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::X, 'timezone' => 'UTC']);
+ $this->label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id, 'name' => 'Campaign']);
+
+ $this->actingAs($this->user);
+});
+
+test('switching from the list to the calendar and the board keeps the label, untagged, channel and time zone filters', function () {
+ $page = visit(route('app.posts.index', [
+ 'tab' => 'drafts',
+ 'channels' => [$this->linkedin->id],
+ 'tz' => 'Asia/Tokyo',
+ ]))->resize(1600, 900);
+ waitFor($page, '@posts-label-filter');
+
+ $page->click('@posts-label-filter');
+ waitFor($page, "@posts-label-checkbox-{$this->label->id}");
+ $page->click("@posts-label-checkbox-{$this->label->id}");
+ $page->click('@posts-label-untagged-checkbox');
+ waitForPublishFiltersInUrl($page, $this->label->id, $this->linkedin->id);
+ $page->click('@posts-label-filter');
+ waitForGone($page, '@posts-label-untagged');
+
+ $page->click('@schedule-view-calendar');
+ waitForPath($page, route('app.calendar', ['view' => 'week'], absolute: false));
+ waitForPublishFiltersInUrl($page, $this->label->id, $this->linkedin->id);
+ assertPublishFilterControls($page);
+
+ $page->click('@schedule-view-board');
+ waitForPath($page, route('app.posts.board', absolute: false));
+ waitForPublishFiltersInUrl($page, $this->label->id, $this->linkedin->id);
+ assertPublishFilterControls($page);
+
+ $page->click('@schedule-view-list');
+ waitForPath($page, route('app.posts.index', absolute: false));
+ waitForPublishFiltersInUrl($page, $this->label->id, $this->linkedin->id);
+ assertPublishFilterControls($page);
+
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PublishHeaderSettingsTest.php b/tests/Browser/PublishHeaderSettingsTest.php
new file mode 100644
index 000000000..9a9194b76
--- /dev/null
+++ b/tests/Browser/PublishHeaderSettingsTest.php
@@ -0,0 +1,73 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+
+function publishHeaderUser(bool $admin): User
+{
+ $owner = User::factory()->create();
+ $workspace = Workspace::factory()->create(['account_id' => $owner->account_id, 'user_id' => $owner->id]);
+ $workspace->members()->attach($owner->id, membershipPivot('admin'));
+ $owner->update(['current_workspace_id' => $workspace->id]);
+
+ if ($admin) {
+ return $owner->fresh();
+ }
+
+ $member = User::factory()->create(['account_id' => $owner->account_id]);
+ $workspace->members()->attach($member->id, membershipPivot('member'));
+ $member->update(['current_workspace_id' => $workspace->id]);
+
+ return $member->fresh();
+}
+
+test('the all channels header links to the channels settings with a tooltip', function () {
+ $user = publishHeaderUser(admin: true);
+ SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
+ connectAiTo($user);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index'));
+ waitFor($page, '@publish-channels-settings');
+
+ $page->hover('@publish-channels-settings');
+ waitFor($page, '@publish-channels-settings-tooltip');
+ $page->assertSeeIn('@publish-channels-settings-tooltip', __('channels.manage'));
+
+ $page->click('@publish-channels-settings');
+ waitForPath($page, route('app.workspace.channels', absolute: false));
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the channel header settings cog shows a tooltip', function () {
+ $user = publishHeaderUser(admin: true);
+ $channel = SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
+ connectAiTo($user);
+ $this->actingAs($user);
+
+ $page = visit(route('app.channels.publish', $channel));
+ waitFor($page, '@publish-channel-settings');
+
+ $page->hover('@publish-channel-settings');
+ waitFor($page, '@publish-channel-settings-tooltip');
+
+ $page->assertSeeIn('@publish-channel-settings-tooltip', __('channels.settings'))
+ ->assertNoJavaScriptErrors();
+});
+
+test('members do not see the channels settings cog in the header', function () {
+ $user = publishHeaderUser(admin: false);
+ SocialAccount::factory()->linkedin()->create(['workspace_id' => $user->current_workspace_id]);
+ connectAiTo($user);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index'));
+ waitFor($page, '@header-title');
+
+ $page->assertMissing('@publish-channels-settings')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/PublishPageTest.php b/tests/Browser/PublishPageTest.php
index 583a99551..0eeca0f92 100644
--- a/tests/Browser/PublishPageTest.php
+++ b/tests/Browser/PublishPageTest.php
@@ -404,7 +404,7 @@ test('the calendar keeps its filters in one menu until the screen is wide enough
return {
oneRow: row.every((box) => Math.abs(middle(box) - middle(row[0])) <= 2),
- viewSwitchInHeader: Boolean(document.querySelector('[data-testid="app-header"] [data-testid="schedule-view-list"]')?.getClientRects().length),
+ viewSwitchInHeader: Boolean(document.querySelector('[data-testid="app-header"] [data-testid="schedule-view-trigger"]')?.getClientRects().length),
noDateButton: visible(document.querySelector('[data-testid="calendar-no-date"]')),
channelText: [...channelFilter.querySelectorAll('span')].filter((span) => visible(span) && span.textContent.trim() !== '').length,
tags: Boolean(document.querySelector('[data-testid="posts-label-filter"]')?.getClientRects().length),
@@ -505,7 +505,7 @@ test('the channel page adapts its filters, tabs, calendar link and notes button
(() => {
const rect = (id) => document.querySelector(`[data-testid="${id}"]`).getBoundingClientRect();
const middle = (box) => Math.round(box.top + box.height / 2);
- const row = ['publish-tabs-mobile-trigger', 'publish-menu', 'schedule-view-list', 'posts-new-post'].map(rect);
+ const row = ['publish-tabs-mobile-trigger', 'publish-menu', 'schedule-view-trigger', 'posts-new-post'].map(rect);
return {
oneRow: row.every((box) => Math.abs(middle(box) - middle(row[0])) <= 2),
@@ -517,9 +517,16 @@ test('the channel page adapts its filters, tabs, calendar link and notes button
JS);
expect($phone)->toBe(['oneRow' => true, 'belowGoal' => true, 'tags' => false, 'overflow' => false])
- ->and($page->script($calendarPath))->toBe(route('app.channels.calendar', ['account' => $channel->id, 'view' => 'days'], false))
->and($page->script('Boolean(document.querySelector(\'[data-testid="publish-timezone-trigger"]\'))'))->toBeFalse();
+ $page->click('@schedule-view-trigger');
+ waitForOpen($page, '@schedule-view-menu');
+
+ expect($page->script($calendarPath))->toBe(route('app.channels.calendar', ['account' => $channel->id, 'view' => 'days'], false));
+
+ $page->keys('@schedule-view-menu', 'Escape');
+ waitForGone($page, '@schedule-view-menu');
+
$page->click('@publish-menu');
waitFor($page, '@publish-menu-content');
waitForState($page, '@publish-menu-content', 'Math.abs(window.innerHeight - element.getBoundingClientRect().bottom) <= 1');
@@ -573,9 +580,13 @@ test('the channel page adapts its filters, tabs, calendar link and notes button
->assertMissing('@publish-tabs-sheet');
$page->navigate(route('app.posts.index'));
- waitFor($page, '@schedule-view-calendar');
+ waitFor($page, '@schedule-view-trigger');
+ $page->click('@schedule-view-trigger');
+ waitForOpen($page, '@schedule-view-menu');
expect($page->script($calendarPath))->toBe(route('app.calendar', ['view' => 'days'], false));
+ $page->keys('@schedule-view-menu', 'Escape');
+ waitForGone($page, '@schedule-view-menu');
$page->resize(1280, 800);
waitForCondition($page, $calendarPath.'.endsWith("/week")');
expect($page->script($calendarPath))->toBe(route('app.calendar', ['view' => 'week'], false));
@@ -615,7 +626,7 @@ test('on a phone the view switch and the new post button fit inside the card, on
$fits = $page->script(<<<'JS'
(() => {
const card = document.querySelector('[data-testid="publish-page"]').getBoundingClientRect();
- return ['posts-new-post', 'schedule-view-calendar'].every((testId) => {
+ return ['posts-new-post', 'schedule-view-trigger'].every((testId) => {
const box = document.querySelector(`[data-testid="${testId}"]`).getBoundingClientRect();
return box.width > 0 && box.left >= card.left && box.right <= card.right;
});
diff --git a/tests/Browser/PublishViewMemoryTest.php b/tests/Browser/PublishViewMemoryTest.php
new file mode 100644
index 000000000..f49198302
--- /dev/null
+++ b/tests/Browser/PublishViewMemoryTest.php
@@ -0,0 +1,174 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\SocialAccount\Platform;
+use App\Enums\User\Locale;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+
+beforeEach(function () {
+ $this->user = User::factory()->create(['timezone' => 'UTC', 'locale' => Locale::DEFAULT]);
+ $workspace = Workspace::factory()->create(['user_id' => $this->user->id, 'account_id' => $this->user->account_id]);
+ $workspace->members()->attach($this->user->id, membershipPivot('admin'));
+ $this->user->update(['current_workspace_id' => $workspace->id]);
+ subscribeAccount($this->user->account);
+ $this->user = $this->user->fresh();
+ connectAiTo($this->user);
+
+ $this->channel = SocialAccount::factory()->create([
+ 'workspace_id' => $workspace->id,
+ 'platform' => Platform::LinkedIn,
+ ]);
+
+ $this->insightsPath = route('app.insights', absolute: false);
+
+ $this->actingAs($this->user);
+});
+
+test('the publish menu link opens the list until another view is picked', function () {
+ $publishLink = route('app.posts.index', absolute: false);
+
+ $page = visit(route('app.insights'))->resize(1280, 900);
+ waitFor($page, "[data-testid=\"nav-{$publishLink}\"]");
+
+ $page->click("@nav-{$publishLink}");
+ waitForPath($page, route('app.posts.index', absolute: false));
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the publish menu link reopens the board picked in the view switch', function () {
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+ waitFor($page, '@board-column-draft');
+
+ expect(browserStorageItem($page, $this->user, 'publish.view'))->toBe('board');
+
+ $page->click("@nav-{$this->insightsPath}");
+ waitForPath($page, route('app.insights', absolute: false));
+
+ $boardPath = route('app.posts.board', absolute: false);
+ $page->click("@nav-{$boardPath}");
+ waitForPath($page, route('app.posts.board', absolute: false));
+ waitFor($page, '@board-column-draft');
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a channel publish link reopens the calendar picked in the view switch', function () {
+ $page = visit(route('app.channels.publish', $this->channel))->resize(1280, 900);
+ waitFor($page, '@schedule-view-calendar');
+
+ $page->click('@schedule-view-calendar');
+ waitForPath($page, route('app.channels.calendar', ['account' => $this->channel, 'view' => 'week'], absolute: false));
+
+ expect(browserStorageItem($page, $this->user, 'publish.view'))->toBe('calendar');
+
+ $page->click("@nav-{$this->insightsPath}");
+ waitForPath($page, route('app.insights', absolute: false));
+
+ $page->click("@sidebar-channel-{$this->channel->id}");
+ waitForPath($page, route('app.channels.calendar', ['account' => $this->channel, 'view' => 'week'], absolute: false));
+
+ $page->assertNoJavaScriptErrors();
+});
+
+test('landing on the calendar through a redirect keeps the view the user picked', function () {
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+ waitFor($page, '@board-column-draft');
+
+ $calendarPath = json_encode(route('app.calendar', absolute: false));
+ $page->navigate(route('app.home'));
+ waitForCondition($page, "location.pathname.startsWith({$calendarPath})");
+ waitForState($page, '@schedule-view-calendar', "element.getAttribute('aria-current') === 'page'");
+
+ expect(browserStorageItem($page, $this->user, 'publish.view'))->toBe('board');
+
+ $boardPath = route('app.posts.board', absolute: false);
+ waitFor($page, "[data-testid=\"nav-{$boardPath}\"]");
+ $page->assertNoJavaScriptErrors();
+});
+
+test('a link to one post on the list keeps the view the user picked', function () {
+ $post = Post::factory()->forAccount($this->channel)->draft()->create(['user_id' => $this->user->id]);
+
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+ waitFor($page, '@board-column-draft');
+
+ $page->navigate(route('app.posts.index', ['post' => $post->id]));
+ waitFor($page, "@post-card-{$post->id}");
+
+ expect(browserStorageItem($page, $this->user, 'publish.view'))->toBe('board');
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the command palette opens a channel in the view the user picked', function () {
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+ waitFor($page, '@board-column-draft');
+
+ $page->keys('@app-content-shell', 'ControlOrMeta+k');
+ waitFor($page, "@command-palette-item-channel-{$this->channel->id}");
+ $page->click("@command-palette-item-channel-{$this->channel->id}");
+
+ waitForPath($page, route('app.channels.board', $this->channel, absolute: false));
+ $page->assertNoJavaScriptErrors();
+});
+
+test('going back to the list keeps the board as the view the user picked', function () {
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+ waitFor($page, '@board-column-draft');
+
+ $page->back();
+ waitForPath($page, route('app.posts.index', absolute: false));
+ waitFor($page, '@schedule-view-board');
+
+ expect(browserStorageItem($page, $this->user, 'publish.view'))->toBe('board');
+
+ $boardPath = route('app.posts.board', absolute: false);
+ waitFor($page, "[data-testid=\"nav-{$boardPath}\"]");
+ $page->assertNoJavaScriptErrors();
+});
+
+test('the view the user picked follows them to another workspace', function () {
+ $second = Workspace::factory()->create(['user_id' => $this->user->id, 'account_id' => $this->user->account_id]);
+ $second->members()->attach($this->user->id, membershipPivot('admin'));
+
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, '@schedule-view-board');
+
+ $page->click('@schedule-view-board');
+ waitFor($page, '@board-column-draft');
+
+ $page->click('@sidebar-workspace-menu');
+ waitFor($page, '@sidebar-workspaces-trigger');
+ $page->click('@sidebar-workspaces-trigger');
+ waitFor($page, "@sidebar-workspace-{$second->id}");
+ $page->click("@sidebar-workspace-{$second->id}");
+ waitForDatabase($page, fn () => $this->user->fresh()->current_workspace_id === $second->id);
+ waitForPath($page, route('app.calendar', absolute: false));
+
+ $boardPath = route('app.posts.board', absolute: false);
+ waitFor($page, "[data-testid=\"nav-{$boardPath}\"]");
+ $page->click("@nav-{$boardPath}");
+ waitForPath($page, $boardPath);
+ waitFor($page, '@board-column-draft');
+
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/SidebarChannelsTest.php b/tests/Browser/SidebarChannelsTest.php
index 29cb65e25..763f473c0 100644
--- a/tests/Browser/SidebarChannelsTest.php
+++ b/tests/Browser/SidebarChannelsTest.php
@@ -326,7 +326,7 @@ test('the channels settings and connect actions show a tooltip above them', func
$page->hover('@sidebar-channels-label')->hover("@sidebar-channels-{$action}");
waitFor($page, "@sidebar-channels-{$action}-tooltip");
- $page->assertSeeIn("@sidebar-channels-{$action}-tooltip", $action === 'settings' ? __('channels.settings') : __('channels.connect'));
+ $page->assertSeeIn("@sidebar-channels-{$action}-tooltip", $action === 'settings' ? __('channels.manage') : __('channels.connect'));
expect($page->script(<<<JS
(() => {
@@ -415,3 +415,29 @@ test('the collapsed sidebar shows every channel network badge without clipping i
$page->assertNoJavaScriptErrors();
});
+
+test('a long channel name stops before its post count and ends in an ellipsis', function () {
+ $user = sidebarChannelsUser('admin');
+ $channel = SocialAccount::factory()->linkedin()->create([
+ 'workspace_id' => $user->current_workspace_id,
+ 'display_name' => 'Acme Shop on Google Business Profile Downtown',
+ ]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.posts.index'))->resize(1280, 900);
+ waitFor($page, "@sidebar-channel-count-{$channel->id}");
+
+ $layout = $page->script(<<<JS
+ (() => {
+ const name = document.querySelector('[data-testid="sidebar-channel-name-{$channel->id}"]');
+ const count = document.querySelector('[data-testid="sidebar-channel-count-{$channel->id}"]').getBoundingClientRect();
+ return {
+ clearsCount: name.getBoundingClientRect().right <= count.left,
+ ellipsis: getComputedStyle(name).textOverflow === 'ellipsis' && name.scrollWidth > name.clientWidth,
+ };
+ })()
+ JS);
+
+ expect($layout)->toBe(['clearsCount' => true, 'ellipsis' => true]);
+ $page->assertNoJavaScriptErrors();
+});
diff --git a/tests/Browser/SignatureLabelHeaderTest.php b/tests/Browser/SignatureLabelHeaderTest.php
index ec9f7456f..2cf96cf8d 100644
--- a/tests/Browser/SignatureLabelHeaderTest.php
+++ b/tests/Browser/SignatureLabelHeaderTest.php
@@ -63,13 +63,13 @@ test('signature edit uses a centered dialog and resets canceled changes', functi
$page = visit(route('app.signatures.index'));
$page
- ->click("@signature-row-{$signature->id}")
+ ->click("@signature-settings-{$signature->id}")
->assertVisible('@edit-signature-sheet')
->assertVisible('@edit-signature-name')
->fill('@edit-signature-name', 'Unsaved name')
->click('@cancel-edit-signature')
->assertMissing('@edit-signature-sheet')
- ->click("@signature-row-{$signature->id}")
+ ->click("@signature-settings-{$signature->id}")
->assertValue('@edit-signature-name', 'Original signature');
$layout = $page->script(<<<'JS'
@@ -131,8 +131,7 @@ test('label and signature deletion use a plain confirmation without typing', fun
->assertNoJavaScriptErrors();
visit(route('app.signatures.index'))
- ->click("@signature-menu-{$signature->id}")
- ->click("@delete-signature-{$signature->id}")
+ ->click("@signature-delete-{$signature->id}")
->assertVisible('@confirm-delete-modal')
->assertMissing('@confirm-delete-input')
->click('@confirm-delete-action')
diff --git a/tests/Browser/SignaturesPageTest.php b/tests/Browser/SignaturesPageTest.php
index df6fca716..105e71400 100644
--- a/tests/Browser/SignaturesPageTest.php
+++ b/tests/Browser/SignaturesPageTest.php
@@ -117,3 +117,35 @@ test('the signatures empty state is never cut off on a short screen', function (
$page->assertNoJavaScriptErrors();
});
+
+test('a signature row opens the edit sheet and the delete confirmation only from its cog and trash, each with a short tooltip', function () {
+ [$user, $workspace] = signaturesPageOwner();
+ $signature = WorkspaceSignature::factory()->create(['workspace_id' => $workspace->id]);
+ $this->actingAs($user);
+
+ $page = visit(route('app.signatures.index'));
+ waitFor($page, "@signature-settings-{$signature->id}");
+
+ $page->assertVisible("@signature-delete-{$signature->id}")
+ ->assertMissing("@signature-menu-{$signature->id}");
+
+ $page->click("@signature-row-{$signature->id}");
+ $page->script('new Promise((resolve) => setTimeout(resolve, 400))');
+ $page->assertMissing('@edit-signature-sheet');
+
+ $page->hover("@signature-settings-{$signature->id}");
+ waitForText($page, "@signature-settings-tooltip-{$signature->id}", __('signatures.actions.settings'));
+ $page->hover('@header-title')->hover("@signature-delete-{$signature->id}");
+ waitForText($page, "@signature-delete-tooltip-{$signature->id}", __('signatures.actions.delete'));
+
+ $page->click("@signature-settings-{$signature->id}");
+ waitForOpen($page, '@edit-signature-sheet');
+ $page->click('@cancel-edit-signature');
+ waitForGone($page, '@edit-signature-sheet');
+
+ $page->click("@signature-delete-{$signature->id}");
+ waitForOpen($page, '@confirm-delete-modal');
+
+ $page->assertMissing('@edit-signature-sheet')
+ ->assertNoJavaScriptErrors();
+});
diff --git a/tests/Feature/Analytics/ChannelInsightsFiltersTest.php b/tests/Feature/Analytics/ChannelInsightsFiltersTest.php
index 2cf467c61..d2a03e26f 100644
--- a/tests/Feature/Analytics/ChannelInsightsFiltersTest.php
+++ b/tests/Feature/Analytics/ChannelInsightsFiltersTest.php
@@ -174,15 +174,21 @@ test('labels and post types combine', function () {
->etc());
});
-test('a label of another workspace or a deleted label is refused', function () {
+test('a label of another workspace or a deleted label matches no post instead of failing', function () {
$foreign = WorkspaceLabel::factory()->create(['workspace_id' => Workspace::factory()->create()->id]);
$deleted = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ Post::query()->whereKey($this->reel->post_id)->sole()->labels()->attach($deleted);
$deleted->delete();
foreach ([$foreign, $deleted] as $label) {
$this->actingAs($this->user)
->get(filteredInsightsUrl($this->instagram, ['labels' => [$label->id]]))
- ->assertSessionHasErrors('labels.0');
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('filters.labels', [$label->id])
+ ->where('report.summary.posts.value', 0)
+ ->has('publications.data', 0)
+ ->etc());
}
$this->actingAs($this->user)
diff --git a/tests/Feature/Analytics/InsightsLabelFilterTest.php b/tests/Feature/Analytics/InsightsLabelFilterTest.php
new file mode 100644
index 000000000..c1f1ced4d
--- /dev/null
+++ b/tests/Feature/Analytics/InsightsLabelFilterTest.php
@@ -0,0 +1,152 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\SocialAccount\Platform;
+use App\Jobs\Analytics\BootstrapAccountAnalytics;
+use App\Jobs\Analytics\CollectAccountDailySnapshot;
+use App\Models\AnalyticsAccountDailySnapshot;
+use App\Models\AnalyticsPublication;
+use App\Models\AnalyticsPublicationDailySnapshot;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+use Illuminate\Support\Facades\Queue;
+use Inertia\Testing\AssertableInertia as Assert;
+
+beforeEach(function () {
+ Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
+ $this->user = User::factory()->create();
+ $this->workspace = Workspace::factory()->create(['user_id' => $this->user->id]);
+ $this->user->update(['current_workspace_id' => $this->workspace->id]);
+ $this->account = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Instagram]);
+ $this->label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Launch']);
+ $this->day = now('UTC')->subDays(5)->startOfDay();
+ $this->range = ['range' => 'custom', 'start' => $this->day->subDays(5)->toDateString(), 'end' => $this->day->addDays(2)->toDateString()];
+
+ AnalyticsAccountDailySnapshot::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'social_account_id' => $this->account->id,
+ 'social_account_key' => $this->account->id,
+ 'platform' => Platform::Instagram,
+ 'network' => Platform::Instagram->network(),
+ 'platform_user_id' => $this->account->platform_user_id,
+ 'date' => $this->day->toDateString(),
+ 'followers_count' => 500,
+ ]);
+
+ foreach ([[$this->label, 10], [null, 4]] as [$attached, $reactions]) {
+ $post = Post::factory()->forAccount($this->account)->published()->create(['user_id' => $this->user->id]);
+
+ if ($attached !== null) {
+ $post->labels()->attach($attached);
+ }
+
+ $publication = AnalyticsPublication::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'social_account_id' => $this->account->id,
+ 'social_account_key' => $this->account->id,
+ 'post_id' => $post->id,
+ 'platform' => Platform::Instagram,
+ 'provider_published_at' => $this->day->setTime(12, 0),
+ ]);
+ AnalyticsPublicationDailySnapshot::factory()->create(['publication_id' => $publication->id, 'date' => $this->day->toDateString(), 'reactions_count' => $reactions]);
+ }
+});
+
+test('the workspace insights page offers the labels and counts only the posts of the picked ones', function (Closure $query, int $posts, int $reactions) {
+ $filters = $query($this->label);
+
+ $this->actingAs($this->user)
+ ->get(route('app.insights', [...$this->range, ...$filters]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->component('insights/Index')
+ ->where('labels.0.id', $this->label->id)
+ ->where('labels.0.name', 'Launch')
+ ->where('report.filters.labels', data_get($filters, 'labels', []))
+ ->where('report.filters.untagged', (bool) data_get($filters, 'untagged', false))
+ ->where('report.summary.posts.value', $posts)
+ ->where('report.summary.reactions.value', $reactions)
+ ->where('report.summary.followers.value', 500)
+ ->etc());
+})->with([
+ 'no label filter' => [fn (WorkspaceLabel $label): array => [], 2, 14],
+ 'one label' => [fn (WorkspaceLabel $label): array => ['labels' => [$label->id]], 1, 10],
+ 'untagged' => [fn (WorkspaceLabel $label): array => ['untagged' => 1], 1, 4],
+ 'the label or untagged' => [fn (WorkspaceLabel $label): array => ['labels' => [$label->id], 'untagged' => 1], 2, 14],
+]);
+
+test('a label of another workspace or a deleted one matches no post instead of failing, and a malformed id is refused', function () {
+ $foreign = WorkspaceLabel::factory()->create();
+ $deleted = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ $this->account->posts()->first()->labels()->attach($deleted);
+ $deleted->delete();
+
+ foreach ([$foreign, $deleted] as $label) {
+ $this->actingAs($this->user)
+ ->get(route('app.insights', [...$this->range, 'labels' => [$label->id]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('report.filters.labels', [$label->id])
+ ->where('report.summary.posts.value', 0)
+ ->where('report.summary.followers.value', 500)
+ ->etc());
+ }
+
+ $this->actingAs($this->user)
+ ->getJson(route('app.insights', [...$this->range, 'labels' => ['not-a-uuid']]))
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors('labels.0');
+});
+
+test('the insights export counts only the posts of the picked labels', function () {
+ $content = $this->actingAs($this->user)
+ ->get(route('app.insights.download', ['format' => 'csv', ...$this->range, 'labels' => [$this->label->id]]))
+ ->assertOk()
+ ->streamedContent();
+ $rows = collect(preg_split('/\r?\n/', trim(ltrim($content, "\u{FEFF}"))))
+ ->map(fn (string $line): array => str_getcsv($line, escape: ''))
+ ->all();
+
+ expect($rows)->toContain(['Posts', '1', '0', ''])
+ ->and($rows)->toContain(['Reactions', '10', '', '']);
+});
+
+test('the label filter combines with the channel filter', function () {
+ $facebook = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Facebook]);
+ $post = Post::factory()->forAccount($facebook)->published()->create(['user_id' => $this->user->id]);
+ $post->labels()->attach($this->label);
+ $publication = AnalyticsPublication::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'social_account_id' => $facebook->id,
+ 'social_account_key' => $facebook->id,
+ 'post_id' => $post->id,
+ 'platform' => Platform::Facebook,
+ 'network' => Platform::Facebook->network(),
+ 'provider_published_at' => $this->day->setTime(12, 0),
+ ]);
+ AnalyticsPublicationDailySnapshot::factory()->create(['publication_id' => $publication->id, 'date' => $this->day->toDateString(), 'reactions_count' => 20]);
+
+ $report = fn (array $filters) => $this->actingAs($this->user)
+ ->get(route('app.insights', [...$this->range, ...$filters]))
+ ->assertOk();
+
+ $report(['labels' => [$this->label->id]])->assertInertia(fn (Assert $page) => $page
+ ->where('report.summary.posts.value', 2)
+ ->where('report.summary.reactions.value', 30)
+ ->etc());
+
+ $report(['labels' => [$this->label->id], 'channels' => [$this->account->id]])->assertInertia(fn (Assert $page) => $page
+ ->where('report.filters.channels', [$this->account->id])
+ ->where('report.filters.labels', [$this->label->id])
+ ->where('report.summary.posts.value', 1)
+ ->where('report.summary.reactions.value', 10)
+ ->etc());
+
+ $report(['untagged' => 1, 'channels' => [$facebook->id]])->assertInertia(fn (Assert $page) => $page
+ ->where('report.summary.posts.value', 0)
+ ->etc());
+});
diff --git a/tests/Feature/Analytics/InsightsNoLabelFilterTest.php b/tests/Feature/Analytics/InsightsNoLabelFilterTest.php
deleted file mode 100644
index 9dff62437..000000000
--- a/tests/Feature/Analytics/InsightsNoLabelFilterTest.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-declare(strict_types=1);
-
-use App\Enums\SocialAccount\Platform;
-use App\Jobs\Analytics\BootstrapAccountAnalytics;
-use App\Jobs\Analytics\CollectAccountDailySnapshot;
-use App\Models\AnalyticsPublication;
-use App\Models\AnalyticsPublicationDailySnapshot;
-use App\Models\Post;
-use App\Models\SocialAccount;
-use App\Models\User;
-use App\Models\Workspace;
-use App\Models\WorkspaceLabel;
-use Carbon\CarbonImmutable;
-use Illuminate\Support\Facades\Queue;
-use Inertia\Testing\AssertableInertia as Assert;
-
-test('the workspace insights page ignores label parameters and offers no label filter', function () {
- Queue::fake([BootstrapAccountAnalytics::class, CollectAccountDailySnapshot::class]);
- $user = User::factory()->create();
- $workspace = Workspace::factory()->create(['user_id' => $user->id]);
- $user->update(['current_workspace_id' => $workspace->id]);
- $account = SocialAccount::factory()->create(['workspace_id' => $workspace->id, 'platform' => Platform::Instagram]);
- $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
-
- foreach ([$label, null] as $attached) {
- $post = Post::factory()->forAccount($account)->published()->create(['user_id' => $user->id]);
-
- if ($attached !== null) {
- $post->labels()->attach($attached);
- }
-
- $publication = AnalyticsPublication::factory()->create([
- 'workspace_id' => $workspace->id,
- 'social_account_id' => $account->id,
- 'social_account_key' => $account->id,
- 'post_id' => $post->id,
- 'platform' => Platform::Instagram,
- 'provider_published_at' => CarbonImmutable::parse('2026-09-15 12:00:00', 'UTC'),
- ]);
- AnalyticsPublicationDailySnapshot::factory()->create(['publication_id' => $publication->id, 'date' => '2026-09-15', 'reactions_count' => 10]);
- }
-
- $this->actingAs($user)
- ->get(route('app.insights', ['range' => 'custom', 'start' => '2026-09-01', 'end' => '2026-09-30', 'labels' => [$label->id], 'untagged' => 1]))
- ->assertOk()
- ->assertInertia(fn (Assert $page) => $page
- ->component('insights/Index')
- ->missing('labels')
- ->missing('report.filters.labels')
- ->missing('report.filters.untagged')
- ->where('report.summary.posts.value', 2)
- ->etc());
-});
diff --git a/tests/Feature/Channels/ChannelRoutesTest.php b/tests/Feature/Channels/ChannelRoutesTest.php
index 46a9b7b2e..f88ac3096 100644
--- a/tests/Feature/Channels/ChannelRoutesTest.php
+++ b/tests/Feature/Channels/ChannelRoutesTest.php
@@ -25,8 +25,8 @@ test('admins see the channel list of the current workspace only', function () {
->assertOk()
->assertInertia(fn ($page) => $page
->component('settings/workspace/Channels', false)
- ->has('connectedChannels', 1)
- ->where('connectedChannels.0.id', $mine->id)
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $mine->id)
);
});
diff --git a/tests/Feature/Channels/ReorderChannelsTest.php b/tests/Feature/Channels/ReorderChannelsTest.php
index be63f5e3f..689550176 100644
--- a/tests/Feature/Channels/ReorderChannelsTest.php
+++ b/tests/Feature/Channels/ReorderChannelsTest.php
@@ -71,9 +71,9 @@ test('reorder persists the new order and both the sidebar and settings list foll
->where('channels.0.id', $c->id)
->where('channels.1.id', $a->id)
->where('channels.2.id', $b->id)
- ->where('connectedChannels.0.id', $c->id)
- ->where('connectedChannels.1.id', $a->id)
- ->where('connectedChannels.2.id', $b->id)
+ ->where('connectedChannels.data.0.id', $c->id)
+ ->where('connectedChannels.data.1.id', $a->id)
+ ->where('connectedChannels.data.2.id', $b->id)
);
});
diff --git a/tests/Feature/Parity/CrossCuttingParityTest.php b/tests/Feature/Parity/CrossCuttingParityTest.php
index bfcac0910..f0db591d5 100644
--- a/tests/Feature/Parity/CrossCuttingParityTest.php
+++ b/tests/Feature/Parity/CrossCuttingParityTest.php
@@ -71,7 +71,7 @@ test('the bare lists paginate with the app default on the api and mcp, ignore a
'labels' => ['api.labels.index', ListLabelsTool::class, 'labels', fn (TestCase $t) => WorkspaceLabel::factory()->count(3)->sequence(fn (Sequence $sequence) => ['created_at' => now()->subMinutes($sequence->index)])->create(['workspace_id' => $t->workspace->id]), null],
'signatures' => ['api.signatures.index', ListSignaturesTool::class, 'signatures', fn (TestCase $t) => WorkspaceSignature::factory()->count(3)->sequence(fn (Sequence $sequence) => ['created_at' => now()->subMinutes($sequence->index)])->create(['workspace_id' => $t->workspace->id]), null],
'webhooks' => ['api.webhooks.index', ListWebhooksTool::class, 'webhooks', fn (TestCase $t) => Webhook::factory()->count(3)->sequence(fn (Sequence $sequence) => ['created_at' => now()->subMinutes($sequence->index)])->create(['workspace_id' => $t->workspace->id]), fn (TestCase $t) => $t->get(route('app.webhooks.index'))->assertOk()->viewData('page')['props']['webhooks']],
- 'social accounts' => ['api.social-accounts.index', ListSocialAccountsTool::class, 'social_accounts', fn (TestCase $t) => SocialAccount::factory()->count(3)->sequence(fn (Sequence $sequence) => ['position' => 2 - $sequence->index])->create(['workspace_id' => $t->workspace->id]), fn (TestCase $t) => $t->get(route('app.workspace.channels'))->assertOk()->viewData('page')['props']['connectedChannels']],
+ 'social accounts' => ['api.social-accounts.index', ListSocialAccountsTool::class, 'social_accounts', fn (TestCase $t) => SocialAccount::factory()->count(3)->sequence(fn (Sequence $sequence) => ['position' => 2 - $sequence->index])->create(['workspace_id' => $t->workspace->id]), fn (TestCase $t) => collect([1, 2])->flatMap(fn (int $page) => $t->get(route('app.workspace.channels', ['page' => $page]))->assertOk()->viewData('page')['props']['connectedChannels']['data'])->all()],
'api keys' => ['api.api-keys.index', ListApiKeysTool::class, 'api_keys', fn (TestCase $t) => collect(range(1, 3))->each(fn (int $index) => AccessToken::query()->findOrFail($t->user->createToken("Key {$index}")->token->id)->forceFill(['workspace_id' => $t->workspace->id, 'created_at' => now()->addMinutes($index)])->saveQuietly()), fn (TestCase $t) => $t->get(route('app.api-keys.index'))->assertOk()->viewData('page')['props']['apiTokens']],
]);
diff --git a/tests/Feature/Parity/InsightsParityTest.php b/tests/Feature/Parity/InsightsParityTest.php
index 3fa47b01e..fffe77841 100644
--- a/tests/Feature/Parity/InsightsParityTest.php
+++ b/tests/Feature/Parity/InsightsParityTest.php
@@ -162,6 +162,97 @@ test('the web, api and mcp filter the workspace report by channel alike', functi
->etc());
});
+test('the web, api and mcp filter the workspace report by label alike, leaving followers account-wide', function (Closure $query, int $posts) {
+ [, $tagged] = ($this->seedInsightsParityChannel)(Platform::Instagram, 120, 7, 'alpha');
+ ($this->seedInsightsParityChannel)(Platform::Facebook, 30, 5, 'bravo');
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ $post = Post::factory()->forAccount(SocialAccount::find($tagged->social_account_id))->published()->create(['user_id' => $this->user->id]);
+ $post->labels()->attach($label);
+ $tagged->update(['post_id' => $post->id]);
+ $filtered = [...$this->range, ...$query($label)];
+
+ $web = null;
+ $this->actingAs($this->user)
+ ->get(route('app.insights', $filtered))
+ ->assertInertia(function (Assert $page) use (&$web, $posts) {
+ $page->where('report.summary.posts.value', $posts)
+ ->where('report.summary.followers.value', 150)
+ ->etc();
+ $web = data_get($page->toArray(), 'props.report.summary');
+ });
+
+ auth()->forgetGuards();
+ $api = $this->withHeaders(parityApi($this->token))
+ ->getJson(route('api.analytics.index', $filtered))
+ ->assertOk()
+ ->assertJsonPath('summary.posts.value', $posts)
+ ->json('summary');
+
+ expect($api)->toEqual($web);
+
+ TryPostServer::actingAs($this->user)
+ ->tool(GetAnalyticsReportTool::class, $filtered)
+ ->assertStructuredContent(fn (AssertableJson $json) => $json
+ ->where('summary', $web)
+ ->etc());
+})->with([
+ 'one label' => [fn (WorkspaceLabel $label): array => ['labels' => [$label->id]], 1],
+ 'untagged' => [fn (WorkspaceLabel $label): array => ['untagged' => true], 1],
+]);
+
+test('a label of another workspace or a deleted one matches no post alike on web, api and mcp', function (Closure $label) {
+ ($this->seedInsightsParityChannel)(Platform::Instagram, 120, 7, 'alpha');
+ $query = [...$this->range, 'labels' => [$label($this->workspace)]];
+
+ $web = null;
+ $this->actingAs($this->user)
+ ->get(route('app.insights', $query))
+ ->assertOk()
+ ->assertInertia(function (Assert $page) use (&$web) {
+ $page->where('report.summary.posts.value', 0)->etc();
+ $web = data_get($page->toArray(), 'props.report.summary');
+ });
+ auth()->forgetGuards();
+
+ $api = $this->withHeaders(parityApi($this->token))
+ ->getJson(route('api.analytics.index', $query))
+ ->assertOk()
+ ->json('summary');
+
+ expect($api)->toEqual($web);
+
+ TryPostServer::actingAs($this->user)
+ ->tool(GetAnalyticsReportTool::class, $query)
+ ->assertStructuredContent(fn (AssertableJson $json) => $json->where('summary', $web)->etc());
+})->with([
+ 'of another workspace' => [fn (Workspace $workspace): string => WorkspaceLabel::factory()->create()->id],
+ 'deleted' => [function (Workspace $workspace): string {
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $workspace->id]);
+ $label->delete();
+
+ return $label->id;
+ }],
+]);
+
+test('the workspace report refuses a malformed label alike on web, api and mcp', function () {
+ $query = [...$this->range, 'labels' => ['not-a-uuid']];
+
+ $web = $this->actingAs($this->user)
+ ->getJson(route('app.insights', $query))
+ ->assertUnprocessable()
+ ->json('errors')['labels.0'][0];
+ auth()->forgetGuards();
+
+ $this->withHeaders(parityApi($this->token))
+ ->getJson(route('api.analytics.index', $query))
+ ->assertUnprocessable()
+ ->assertJsonValidationErrors(['labels.0' => $web]);
+
+ TryPostServer::actingAs($this->user)
+ ->tool(GetAnalyticsReportTool::class, $query)
+ ->assertHasErrors([$web]);
+});
+
test('range presets are accepted and custom without dates is refused alike by web, api and mcp', function () {
($this->seedInsightsParityChannel)(Platform::Instagram, 120, 7, 'alpha');
@@ -459,6 +550,12 @@ test('channel insights show the same summary, metrics, series and ranking on web
'untagged' => [fn (WorkspaceLabel $label): array => ['untagged' => '1']],
'types' => [fn (WorkspaceLabel $label): array => ['types' => [ContentType::InstagramReel->value]]],
'previous period' => [fn (WorkspaceLabel $label): array => ['period' => 'previous', 'range' => '30d']],
+ 'a label of another workspace' => [fn (WorkspaceLabel $label): array => ['labels' => [WorkspaceLabel::factory()->create()->id]]],
+ 'the posts label, deleted' => [function (WorkspaceLabel $label): array {
+ $label->delete();
+
+ return ['labels' => [$label->id]];
+ }],
]);
test('channel insights series: reach is the total of the posts published each day and net followers is cumulative', function () {
@@ -478,7 +575,7 @@ test('channel insights series: reach is the total of the posts published each da
->and(data_get($byDay, '2026-09-25.values.net_followers'))->toBe(30);
});
-test('channel insights refuse a foreign label and a post type of another platform with the web message', function (Closure $input, string $key) {
+test('channel insights refuse a malformed label and a post type of another platform with the web message', function (Closure $input, string $key) {
['account' => $account] = seedChannelInsightsParity($this->workspace, $this->user);
$query = $input();
@@ -501,7 +598,7 @@ test('channel insights refuse a foreign label and a post type of another platfor
->assertHasErrors([$web]);
}
})->with([
- 'foreign label' => [fn (): array => ['labels' => [WorkspaceLabel::factory()->create()->id]], 'labels.0'],
+ 'malformed label' => [fn (): array => ['labels' => ['not-a-uuid']], 'labels.0'],
'type of another platform' => [fn (): array => ['types' => [ContentType::LinkedInPost->value]], 'types.0'],
'custom range without dates' => [fn (): array => ['range' => 'custom'], 'start'],
]);
diff --git a/tests/Feature/Posts/PublishBoardTest.php b/tests/Feature/Posts/PublishBoardTest.php
new file mode 100644
index 000000000..41eb0f009
--- /dev/null
+++ b/tests/Feature/Posts/PublishBoardTest.php
@@ -0,0 +1,401 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Enums\Post\Status as PostStatus;
+use App\Enums\SocialAccount\Platform;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+use Illuminate\Testing\TestResponse;
+use Inertia\Support\Header;
+use Inertia\Testing\AssertableInertia as Assert;
+
+beforeEach(function () {
+ $this->user = User::factory()->create();
+ $this->workspace = Workspace::factory()->create([
+ 'account_id' => $this->user->account_id,
+ 'user_id' => $this->user->id,
+ ]);
+ $this->workspace->members()->attach($this->user->id, membershipPivot('admin'));
+ $this->user->update(['current_workspace_id' => $this->workspace->id]);
+ $this->channel = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::LinkedIn,
+ 'position' => 1,
+ ]);
+});
+
+function boardPost(SocialAccount $channel, string $state = 'draft', array $attributes = []): Post
+{
+ return Post::factory()->forAccount($channel)->{$state}()->create([
+ 'user_id' => $channel->workspace->user_id,
+ ...$attributes,
+ ]);
+}
+
+/**
+ * @return list<string>
+ */
+function boardColumnIds(Assert $page, string $key): array
+{
+ return collect(data_get($page->toArray(), "props.columns.{$key}.data"))->pluck('id')->all();
+}
+
+/**
+ * A partial reload of the board asking for these props, as the page sends it.
+ */
+function boardReload(string $only, array $query = [], ?Closure $beforeReload = null): TestResponse
+{
+ $test = test();
+ $url = route('app.posts.board', $query);
+ $version = (string) data_get($test->actingAs($test->user)->get($url)->viewData('page'), 'version');
+
+ if ($beforeReload) {
+ $beforeReload();
+ }
+
+ $response = $test->withHeaders([
+ Header::INERTIA => 'true',
+ Header::VERSION => $version,
+ Header::PARTIAL_COMPONENT => 'posts/Board',
+ Header::PARTIAL_ONLY => $only,
+ ])->get($url)->assertOk();
+
+ $test->flushHeaders();
+
+ return $response;
+}
+
+test('it renders the board on both pages', function () {
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board'))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->component('posts/Board')
+ ->where('scope', 'all')
+ ->where('channel', null)
+ ->where('group', 'status')
+ ->where('groups', ['status', 'tag', 'channel'])
+ ->where('hasChannels', true));
+
+ $this->actingAs($this->user)
+ ->get(route('app.channels.board', $this->channel))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->component('posts/Board')
+ ->where('scope', 'channel')
+ ->where('channel.id', $this->channel->id)
+ ->where('group', 'status')
+ ->where('groups', ['status', 'tag']));
+});
+
+test('it redirects compose=1 to the board with the composer flash', function () {
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['compose' => 1, 'group' => 'tag']))
+ ->assertRedirect(route('app.posts.board', ['group' => 'tag']))
+ ->assertSessionHas('flash.openPostComposer');
+
+ $this->actingAs($this->user)
+ ->get(route('app.channels.board', ['account' => $this->channel, 'compose' => 1, 'group' => 'tag']))
+ ->assertRedirect(route('app.channels.board', ['account' => $this->channel, 'group' => 'tag']))
+ ->assertSessionHas('flash.openPostComposer');
+});
+
+test('it groups posts by status into the five columns', function () {
+ $draft = boardPost($this->channel, 'draft');
+ $pending = boardPost($this->channel, 'pendingApproval');
+ $scheduled = boardPost($this->channel, 'scheduled');
+ $publishing = boardPost($this->channel, 'publishing', ['scheduled_at' => now()->subMinute()]);
+ $published = boardPost($this->channel, 'published');
+ $failed = boardPost($this->channel, 'failed');
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board'))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('boardColumns', [
+ ['key' => 'draft', 'type' => 'status'],
+ ['key' => 'approvals', 'type' => 'status'],
+ ['key' => 'scheduled', 'type' => 'status'],
+ ['key' => 'published', 'type' => 'status'],
+ ['key' => 'failed', 'type' => 'status'],
+ ])
+ ->missing('columns.draft')
+ ->loadDeferredProps(function (Assert $reload) use ($draft, $pending, $scheduled, $publishing, $published, $failed): void {
+ $reload->where('columns.draft.total', 1)
+ ->where('columns.approvals.total', 1)
+ ->where('columns.scheduled.total', 2)
+ ->where('columns.published.total', 1)
+ ->where('columns.failed.total', 1);
+
+ expect(boardColumnIds($reload, 'draft'))->toBe([$draft->id])
+ ->and(boardColumnIds($reload, 'approvals'))->toBe([$pending->id])
+ ->and(boardColumnIds($reload, 'scheduled'))->toBe([$publishing->id, $scheduled->id])
+ ->and(boardColumnIds($reload, 'published'))->toBe([$published->id])
+ ->and(boardColumnIds($reload, 'failed'))->toBe([$failed->id]);
+ }));
+});
+
+test('it lists a post with two labels in both tag columns', function () {
+ $alpha = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Alpha']);
+ $beta = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Beta']);
+ $both = boardPost($this->channel, 'draft');
+ $both->labels()->attach([$alpha->id, $beta->id]);
+ $none = boardPost($this->channel, 'published');
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'tag']))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('group', 'tag')
+ ->where('boardColumns.0.key', "label_{$alpha->id}")
+ ->where('boardColumns.0.type', 'label')
+ ->where('boardColumns.0.label.name', 'Alpha')
+ ->where('boardColumns.1.key', "label_{$beta->id}")
+ ->where('boardColumns.2', ['key' => 'untagged', 'type' => 'untagged'])
+ ->has('boardColumns', 3)
+ ->loadDeferredProps(function (Assert $reload) use ($alpha, $beta, $both, $none): void {
+ $reload->where("columns.label_{$alpha->id}.total", 1)
+ ->where("columns.label_{$beta->id}.total", 1)
+ ->where('columns.untagged.total', 1);
+
+ expect(boardColumnIds($reload, "label_{$alpha->id}"))->toBe([$both->id])
+ ->and(boardColumnIds($reload, "label_{$beta->id}"))->toBe([$both->id])
+ ->and(boardColumnIds($reload, 'untagged'))->toBe([$none->id]);
+ }));
+});
+
+test('it applies the label filter to a status column and its total', function () {
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ $tagged = boardPost($this->channel, 'draft');
+ $tagged->labels()->attach($label);
+ boardPost($this->channel, 'draft');
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['labels' => [$label->id]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->loadDeferredProps(function (Assert $reload) use ($tagged): void {
+ $reload->where('columns.draft.total', 1);
+ expect(boardColumnIds($reload, 'draft'))->toBe([$tagged->id]);
+ }));
+});
+
+test('it limits tag columns to the label filter', function () {
+ $alpha = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Alpha']);
+ WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id, 'name' => 'Beta']);
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'tag', 'labels' => [$alpha->id]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('boardColumns', [['key' => "label_{$alpha->id}", 'type' => 'label', 'label' => ['id' => $alpha->id, 'name' => 'Alpha', 'color' => $alpha->color]]])
+ ->where('filters.labels', [$alpha->id]));
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'tag', 'labels' => [$alpha->id], 'untagged' => 1]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('boardColumns.0.key', "label_{$alpha->id}")
+ ->where('boardColumns.1.key', 'untagged')
+ ->has('boardColumns', 2));
+});
+
+test('it groups by channel in the sidebar order and leaves drafts without a channel out', function () {
+ $second = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::X,
+ 'position' => 0,
+ ]);
+ Post::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'user_id' => $this->user->id,
+ 'status' => PostStatus::Draft,
+ ]);
+ $onFirst = boardPost($this->channel, 'scheduled');
+ $onSecond = boardPost($second, 'published');
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'channel']))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('group', 'channel')
+ ->where('boardColumns.0.key', "channel_{$second->id}")
+ ->where('boardColumns.0.type', 'channel')
+ ->where('boardColumns.0.channel.id', $second->id)
+ ->where('boardColumns.1.key', "channel_{$this->channel->id}")
+ ->has('boardColumns', 2)
+ ->loadDeferredProps(function (Assert $reload) use ($onFirst, $onSecond, $second): void {
+ expect(boardColumnIds($reload, "channel_{$second->id}"))->toBe([$onSecond->id])
+ ->and(boardColumnIds($reload, "channel_{$this->channel->id}"))->toBe([$onFirst->id]);
+ }));
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'channel', 'channels' => [$second->id]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('boardColumns.0.key', "channel_{$second->id}")
+ ->has('boardColumns', 1));
+});
+
+test('it builds no column for a workspace without channels', function () {
+ $this->channel->delete();
+ Post::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'user_id' => $this->user->id,
+ 'status' => PostStatus::Draft,
+ ]);
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'channel']))
+ ->assertOk()
+ ->assertInertia(function (Assert $page): void {
+ $page->where('hasChannels', false)
+ ->where('boardColumns', [])
+ ->where('columns', []);
+
+ expect(data_get($page->toArray(), 'deferredProps'))->toBeEmpty();
+ });
+});
+
+test('it shows no tag column for a label filter naming no label of the workspace', function () {
+ WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'tag', 'labels' => [(string) str()->uuid()]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page->where('boardColumns', []));
+});
+
+test('it falls back to status for group=channel on a channel page', function () {
+ $this->actingAs($this->user)
+ ->get(route('app.channels.board', ['account' => $this->channel, 'group' => 'channel']))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('group', 'status')
+ ->where('boardColumns.0.key', 'draft'));
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'unknown']))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page->where('group', 'status'));
+});
+
+test('it shows a member who needs approval only their own pending posts', function () {
+ $requester = workspaceMember($this->workspace, 'approval');
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ $own = boardPost($this->channel, 'pendingApproval', ['user_id' => $requester->id, 'approval_requested_by' => $requester->id]);
+ $other = boardPost($this->channel, 'pendingApproval');
+ $own->labels()->attach($label);
+ $other->labels()->attach($label);
+
+ $this->actingAs($requester)
+ ->get(route('app.posts.board'))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->loadDeferredProps(fn (Assert $reload) => expect(boardColumnIds($reload->where('columns.approvals.total', 1), 'approvals'))->toBe([$own->id])));
+
+ $this->actingAs($requester)
+ ->get(route('app.posts.board', ['group' => 'tag']))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->loadDeferredProps(fn (Assert $reload) => expect(boardColumnIds($reload->where("columns.label_{$label->id}.total", 1), "label_{$label->id}"))->toBe([$own->id])));
+
+ $this->actingAs($requester)
+ ->get(route('app.posts.board', ['group' => 'channel']))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->loadDeferredProps(fn (Assert $reload) => expect(boardColumnIds($reload->where("columns.channel_{$this->channel->id}.total", 1), "channel_{$this->channel->id}"))->toBe([$own->id])));
+});
+
+test('it never shows another workspace\'s posts or labels', function () {
+ $otherWorkspace = Workspace::factory()->create(['account_id' => $this->user->account_id, 'user_id' => $this->user->id]);
+ $otherChannel = SocialAccount::factory()->create(['workspace_id' => $otherWorkspace->id, 'platform' => Platform::X]);
+ $otherLabel = WorkspaceLabel::factory()->create(['workspace_id' => $otherWorkspace->id]);
+ $foreign = boardPost($otherChannel, 'draft');
+ $foreign->labels()->attach($otherLabel);
+ $mine = boardPost($this->channel, 'draft');
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board'))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->loadDeferredProps(fn (Assert $reload) => expect(boardColumnIds($reload->where('columns.draft.total', 1), 'draft'))->toBe([$mine->id])));
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'tag', 'labels' => [$otherLabel->id]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('boardColumns', [])
+ ->has('labels', 0));
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => 'channel', 'channels' => [$otherChannel->id]]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page->where('boardColumns', []));
+});
+
+test('it pages a column with its own page name', function () {
+ config(['app.pagination.default' => 2]);
+
+ $oldest = boardPost($this->channel, 'draft', ['created_at' => now()->subHours(3)]);
+ boardPost($this->channel, 'draft', ['created_at' => now()->subHours(2)]);
+ boardPost($this->channel, 'draft', ['created_at' => now()->subHour()]);
+
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['draft_page' => 2]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->reloadOnly('columns.draft', function (Assert $reload) use ($oldest): void {
+ $reload->where('columns.draft.total', 3);
+ expect(boardColumnIds($reload, 'draft'))->toBe([$oldest->id]);
+ $reload->missing('columns.scheduled');
+ }));
+});
+
+test('it loads only the requested column on a partial reload of columns', function () {
+ $other = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'position' => 2]);
+ $post = boardPost($this->channel, 'draft');
+ boardPost($other, 'draft');
+
+ $response = boardReload("columns.channel_{$this->channel->id}", ['group' => 'channel'])->json('props');
+
+ expect(collect(data_get($response, "columns.channel_{$this->channel->id}.data"))->pluck('id')->all())->toBe([$post->id])
+ ->and(data_get($response, 'columns'))->toHaveKeys(["channel_{$this->channel->id}"])->toHaveCount(1)
+ ->and($response)->not->toHaveKey('boardColumns');
+});
+
+test('a partial reload of a column builds no column for another workspace\'s label or channel or an unknown key', function () {
+ $otherWorkspace = Workspace::factory()->create(['account_id' => $this->user->account_id, 'user_id' => $this->user->id]);
+ $otherChannel = SocialAccount::factory()->create(['workspace_id' => $otherWorkspace->id, 'platform' => Platform::X]);
+ $otherLabel = WorkspaceLabel::factory()->create(['workspace_id' => $otherWorkspace->id]);
+ boardPost($otherChannel, 'draft')->labels()->attach($otherLabel);
+
+ $tag = boardReload("columns.label_{$otherLabel->id},columns.label_nope,columns.draft", ['group' => 'tag'])->json('props');
+ $channel = boardReload("columns.channel_{$otherChannel->id}", ['group' => 'channel'])->json('props');
+
+ expect(data_get($tag, 'columns', []))->toBe([])
+ ->and(data_get($channel, 'columns', []))->toBe([]);
+});
+
+test('a group or a time zone sent as a list in the url opens the board on status in the user zone instead of failing', function () {
+ $this->actingAs($this->user)
+ ->get(route('app.posts.board', ['group' => ['tag'], 'tz' => ['Asia/Tokyo']]))
+ ->assertOk()
+ ->assertInertia(fn (Assert $page) => $page
+ ->where('group', 'status')
+ ->etc());
+});
+
+test('a time zone sent as a list in the url opens the list and the calendar in the user zone instead of failing', function () {
+ $this->actingAs($this->user)
+ ->get(route('app.posts.index', ['tz' => ['Asia/Tokyo']]))
+ ->assertOk();
+
+ $this->actingAs($this->user)
+ ->get(route('app.calendar', ['view' => 'week', 'tz' => ['Asia/Tokyo']]))
+ ->assertOk();
+});
diff --git a/tests/Feature/Resources/PostCardResourceTest.php b/tests/Feature/Resources/PostCardResourceTest.php
new file mode 100644
index 000000000..4f7c5942c
--- /dev/null
+++ b/tests/Feature/Resources/PostCardResourceTest.php
@@ -0,0 +1,76 @@
+<?php
+
+declare(strict_types=1);
+
+use App\Actions\Post\BuildPublishPageProps;
+use App\Http\Resources\App\PostCardResource;
+use App\Models\Post;
+use App\Models\SocialAccount;
+use App\Models\User;
+use App\Models\Workspace;
+use App\Models\WorkspaceLabel;
+
+beforeEach(function () {
+ $this->user = User::factory()->create();
+ $this->workspace = Workspace::factory()->create(['account_id' => $this->user->account_id, 'user_id' => $this->user->id]);
+ $this->workspace->members()->attach($this->user->id, membershipPivot('admin'));
+ $this->channel = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id]);
+ $this->actingAs($this->user);
+});
+
+/**
+ * @return array<string, mixed>
+ */
+function postCardAsBefore(Post $post): array
+{
+ $card = [
+ ...$post->toArray(),
+ 'failure' => $post->error_context === null ? null : [
+ 'category' => data_get($post->error_context, 'category'),
+ 'failed_at' => data_get($post->error_context, 'failed_at'),
+ ],
+ ];
+
+ $card['user'] = $post->user === null ? null : [
+ 'id' => $post->user->id,
+ 'name' => $post->user->name,
+ 'photo_url' => $post->user->photo_url,
+ ];
+
+ return $card;
+}
+
+test('a card keeps the shape of the post with its channel, labels and a short author', function () {
+ $label = WorkspaceLabel::factory()->create(['workspace_id' => $this->workspace->id]);
+ $first = Post::factory()->forAccount($this->channel)->scheduled()->create(['user_id' => $this->user->id]);
+ $second = Post::factory()->forAccount($this->channel)->failed()->create([
+ 'user_id' => $this->user->id,
+ 'error_context' => ['category' => 'auth', 'failed_at' => now()->toIso8601String()],
+ ]);
+ $first->labels()->attach($label);
+
+ $posts = Post::query()->whereKey([$first->id, $second->id])
+ ->with(['socialAccount', 'user.avatarMedia', 'labels'])
+ ->withCount(['notes', 'groupPosts'])
+ ->orderBy('id')
+ ->get();
+ BuildPublishPageProps::decorate($posts);
+
+ $cards = PostCardResource::cards($posts);
+
+ expect($cards)->toEqual($posts->map(fn (Post $post): array => postCardAsBefore($post))->all())
+ ->and(data_get($cards, '0.social_account.id'))->toBe($this->channel->id)
+ ->and(data_get($cards, '1.social_account'))->toEqual(data_get($cards, '0.social_account'))
+ ->and(data_get($cards, '0.user'))->toBe(['id' => $this->user->id, 'name' => $this->user->name, 'photo_url' => $this->user->photo_url])
+ ->and(data_get($cards, '1.failure.category'))->toBe('auth')
+ ->and($posts->first()->getHidden())->not->toContain('user', 'socialAccount');
+});
+
+test('a card without its relations loaded leaves them out', function () {
+ $post = Post::factory()->forAccount($this->channel)->draft()->create(['user_id' => $this->user->id]);
+
+ $card = PostCardResource::make($post->fresh())->resolve();
+
+ expect($card)->not->toHaveKeys(['social_account', 'user', 'labels'])
+ ->and($card)->toEqual([...$post->fresh()->toArray(), 'failure' => null]);
+});
diff --git a/tests/Feature/Settings/UserTimezoneTest.php b/tests/Feature/Settings/UserTimezoneTest.php
index 57f399844..86355df3a 100644
--- a/tests/Feature/Settings/UserTimezoneTest.php
+++ b/tests/Feature/Settings/UserTimezoneTest.php
@@ -154,3 +154,16 @@ test('timezone normalize and options', function () {
expect($saoPaulo)->toMatchArray(['value' => 'America/Sao_Paulo', 'label' => 'Sao Paulo'])
->and($saoPaulo['offset'])->toStartWith('GMT');
});
+
+test('a time zone option writes its offset at the given instant as GMT, GMT-3 or GMT+5:30', function () {
+ $winter = now('UTC')->startOfYear()->addDays(14);
+ $summer = $winter->addMonths(6);
+
+ expect(Timezone::option('UTC', $winter))->toBe(['value' => 'UTC', 'label' => 'UTC', 'offset' => 'GMT'])
+ ->and(Timezone::option('Asia/Kolkata', $winter))->toBe(['value' => 'Asia/Kolkata', 'label' => 'Kolkata', 'offset' => 'GMT+5:30'])
+ ->and(Timezone::option('Asia/Kathmandu', $winter)['offset'])->toBe('GMT+5:45')
+ ->and(Timezone::option('America/St_Johns', $winter)['offset'])->toBe('GMT-3:30')
+ ->and(Timezone::option('America/New_York', $winter)['offset'])->toBe('GMT-5')
+ ->and(Timezone::option('America/New_York', $summer)['offset'])->toBe('GMT-4')
+ ->and(Timezone::option('America/Argentina/Buenos_Aires', $winter)['label'])->toBe('Buenos Aires');
+});
diff --git a/tests/Feature/SocialControllerTest.php b/tests/Feature/SocialControllerTest.php
index daa888248..0f9d01a93 100644
--- a/tests/Feature/SocialControllerTest.php
+++ b/tests/Feature/SocialControllerTest.php
@@ -8,7 +8,9 @@ use App\Models\Post;
use App\Models\SocialAccount;
use App\Models\User;
use App\Models\Workspace;
+use App\Support\PostingSchedule;
use App\Support\Social\GoogleBusinessDerivativeCleaner;
+use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Facades\Storage;
@@ -37,7 +39,7 @@ test('accounts index shows platforms and connected accounts', function () {
$response->assertOk();
$response->assertInertia(fn ($page) => $page
->component('settings/workspace/Channels', false)
- ->has('connectedChannels', 1)
+ ->has('connectedChannels.data', 1)
);
});
@@ -60,12 +62,175 @@ test('accounts index lists every account of the same network', function () {
$response->assertOk();
$response->assertInertia(fn ($page) => $page
->component('settings/workspace/Channels', false)
- ->has('connectedChannels', 2)
- ->where('connectedChannels', fn ($accounts): bool => collect($accounts)->pluck('id')->contains($first->id)
+ ->has('connectedChannels.data', 2)
+ ->where('connectedChannels.data', fn ($accounts): bool => collect($accounts)->pluck('id')->contains($first->id)
&& collect($accounts)->pluck('id')->contains($second->id))
);
});
+test('accounts index sends each channel time zone, posting times per week, posting goal and where this week stands', function () {
+ $this->travelTo(now('UTC')->next('Wednesday')->setTime(12, 0));
+
+ $withGoal = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::LinkedIn,
+ 'timezone' => 'UTC',
+ 'posting_goal' => 5,
+ 'posting_schedule' => PostingSchedule::empty()->withTime(1, '09:00')->withTime(1, '15:00')->withTime(3, '09:00'),
+ ]);
+ $withoutGoal = SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::X,
+ 'timezone' => 'UTC',
+ 'posting_goal' => null,
+ ]);
+
+ Post::factory()->forAccount($withGoal)->published()->create(['published_at' => now()->subHour()]);
+ Post::factory()->forAccount($withGoal)->scheduled()->create(['scheduled_at' => now()->addHour()]);
+ Post::factory()->forAccount($withoutGoal)->published()->create(['published_at' => now()->subHour()]);
+
+ $response = $this->actingAs($this->user)->get(route('app.workspace.channels'));
+
+ $response->assertOk();
+ $response->assertInertia(fn ($page) => $page
+ ->component('settings/workspace/Channels', false)
+ ->where('connectedChannels.data', function ($accounts) use ($withGoal, $withoutGoal): bool {
+ $byId = collect($accounts)->keyBy('id');
+
+ expect(data_get($byId, "{$withGoal->id}.posting_goal"))->toBe(5)
+ ->and(data_get($byId, "{$withGoal->id}.sent_this_week"))->toBe(1)
+ ->and(data_get($byId, "{$withGoal->id}.scheduled_this_week"))->toBe(1)
+ ->and(data_get($byId, "{$withoutGoal->id}.posting_goal"))->toBeNull()
+ ->and(data_get($byId, "{$withoutGoal->id}.sent_this_week"))->toBe(0)
+ ->and(data_get($byId, "{$withGoal->id}.posting_times_per_week"))->toBe(3)
+ ->and(data_get($byId, "{$withoutGoal->id}.posting_times_per_week"))->toBe(0)
+ ->and(data_get($byId, "{$withGoal->id}.timezone_option"))->toBe(['value' => 'UTC', 'label' => 'UTC', 'offset' => 'GMT']);
+
+ return true;
+ })
+ );
+});
+
+test('accounts index counts the week of every channel with a goal in the same number of queries', function () {
+ $queriesFor = function (): int {
+ DB::flushQueryLog();
+ DB::enableQueryLog();
+ $this->actingAs($this->user)->get(route('app.workspace.channels'))->assertOk();
+ DB::disableQueryLog();
+
+ return count(DB::getQueryLog());
+ };
+
+ SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::LinkedIn, 'posting_goal' => 3]);
+ $queriesFor();
+ $withOneGoal = $queriesFor();
+
+ SocialAccount::factory()->count(3)->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'posting_goal' => 5]);
+
+ expect($queriesFor())->toBe($withOneGoal);
+});
+
+test('accounts index pages the channels at the config page size and counts every channel in the title', function () {
+ config(['app.pagination.default' => 2]);
+ $channels = collect(range(0, 2))->map(fn (int $position) => SocialAccount::factory()->create([
+ 'workspace_id' => $this->workspace->id,
+ 'platform' => Platform::X,
+ 'position' => $position,
+ ]));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels'))
+ ->assertInertia(fn ($page) => $page
+ ->where('total', 3)
+ ->has('connectedChannels.data', 2)
+ ->where('connectedChannels.data.0.id', $channels[0]->id)
+ ->where('connectedChannels.data.1.id', $channels[1]->id));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['page' => 2]))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $channels[2]->id));
+});
+
+test('accounts index searches every word in the channel name or username', function () {
+ $acme = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'display_name' => 'Acme Store', 'username' => 'acmestore']);
+ $beta = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'display_name' => 'Beta Labs', 'username' => 'betalabs']);
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => 'ACME']))
+ ->assertInertia(fn ($page) => $page
+ ->where('filters.search', 'ACME')
+ ->where('total', 2)
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $acme->id));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => 'labs betalabs']))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $beta->id));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => 'acme labs']))
+ ->assertInertia(fn ($page) => $page->has('connectedChannels.data', 0));
+});
+
+test('accounts index finds a username searched with a leading @', function () {
+ $acme = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'display_name' => 'Acme Store', 'username' => 'acmestore']);
+ SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'display_name' => 'Beta Labs', 'username' => 'betalabs']);
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => '@acmestore']))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $acme->id));
+});
+
+test('accounts index finds the channels of a network searched by its name', function () {
+ $youtube = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::YouTube, 'display_name' => 'Acme Videos', 'username' => 'acmevideos']);
+ $x = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'display_name' => 'Acme Store', 'username' => 'acmestore']);
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => 'YouTube']))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $youtube->id));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => 'acme youtube']))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $youtube->id));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['search' => 'store']))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $x->id));
+});
+
+test('accounts index drops a network filter the workspace no longer has a channel on', function () {
+ $x = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X]);
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['networks' => ['linkedin']]))
+ ->assertInertia(fn ($page) => $page
+ ->where('filters.networks', [])
+ ->where('networks', ['x'])
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $x->id));
+});
+
+test('accounts index filters by network, Instagram through Facebook included, and lists the workspace networks', function () {
+ $x = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X, 'position' => 0]);
+ $instagram = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::Instagram, 'position' => 1]);
+ $viaFacebook = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::InstagramFacebook, 'position' => 2]);
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['networks' => ['instagram', 'not-a-network']]))
+ ->assertInertia(fn ($page) => $page
+ ->where('filters.networks', ['instagram'])
+ ->where('networks', ['x', 'instagram'])
+ ->has('connectedChannels.data', 2)
+ ->where('connectedChannels.data.0.id', $instagram->id)
+ ->where('connectedChannels.data.1.id', $viaFacebook->id));
+
+ $this->actingAs($this->user)->get(route('app.workspace.channels', ['networks' => ['x']]))
+ ->assertInertia(fn ($page) => $page
+ ->has('connectedChannels.data', 1)
+ ->where('connectedChannels.data.0.id', $x->id));
+});
+
test('a connected linkedin page account is still returned so it surfaces under the linkedin card', function () {
SocialAccount::factory()->linkedinPage()->create([
'workspace_id' => $this->workspace->id,
@@ -78,8 +243,8 @@ test('a connected linkedin page account is still returned so it surfaces under t
// must report network=linkedin to surface under the single LinkedIn card.
$response->assertInertia(fn ($page) => $page
->component('settings/workspace/Channels', false)
- ->where('connectedChannels.0.platform', Platform::LinkedInPage->value)
- ->where('connectedChannels.0.network', 'linkedin')
+ ->where('connectedChannels.data.0.platform', Platform::LinkedInPage->value)
+ ->where('connectedChannels.data.0.network', 'linkedin')
);
});
@@ -95,8 +260,8 @@ test('a connected instagram-facebook account is still returned so it surfaces un
$response->assertOk();
$response->assertInertia(fn ($page) => $page
->component('settings/workspace/Channels', false)
- ->where('connectedChannels.0.platform', Platform::InstagramFacebook->value)
- ->where('connectedChannels.0.network', 'instagram')
+ ->where('connectedChannels.data.0.platform', Platform::InstagramFacebook->value)
+ ->where('connectedChannels.data.0.network', 'instagram')
);
});
@@ -215,3 +380,23 @@ test('a member who needs approval cannot disconnect a channel or its posts', fun
expect(SocialAccount::find($account->id))->not->toBeNull()
->and(Post::find($post->id))->not->toBeNull();
});
+
+test('accounts index merges the next page of channels by id', function () {
+ SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::X]);
+
+ $page = $this->actingAs($this->user)->get(route('app.workspace.channels'))->viewData('page');
+
+ expect(data_get($page, 'matchPropsOn'))->toContain('connectedChannels.data.id');
+});
+
+test('accounts index shows a channel whose stored time zone php does not know in utc instead of failing', function () {
+ $channel = SocialAccount::factory()->create(['workspace_id' => $this->workspace->id, 'platform' => Platform::LinkedIn]);
+ $channel->forceFill(['timezone' => 'Gone/Zone'])->saveQuietly();
+
+ $this->actingAs($this->user)
+ ->get(route('app.workspace.channels'))
+ ->assertOk()
+ ->assertInertia(fn ($page) => $page
+ ->where('connectedChannels.data.0.timezone_option', ['value' => 'UTC', 'label' => 'UTC', 'offset' => 'GMT'])
+ ->etc());
+});
diff --git a/tests/Unit/LabelColorTest.php b/tests/Unit/LabelColorTest.php
new file mode 100644
index 000000000..6ec842106
--- /dev/null
+++ b/tests/Unit/LabelColorTest.php
@@ -0,0 +1,42 @@
+<?php
+
+declare(strict_types=1);
+
+use Symfony\Component\Process\ExecutableFinder;
+use Symfony\Component\Process\Process;
+
+test('a label chip reads in white on its color while white still contrasts, near black on a light one, and takes no color from anything else', function () {
+ $node = (new ExecutableFinder)->find('node');
+
+ if ($node === null) {
+ $this->markTestSkipped('node is unavailable');
+ }
+
+ $cases = [
+ '#000000' => '#ffffff',
+ '#16a34a' => '#ffffff',
+ '#7c3aed' => '#ffffff',
+ '#dc2626' => '#ffffff',
+ '#808080' => '#ffffff',
+ '#ffffff' => '#0a0a0a',
+ '#d1d5db' => '#0a0a0a',
+ '#facc15' => '#0a0a0a',
+ '#F97316' => '#0a0a0a',
+ '#FDFD96' => '#0a0a0a',
+ 'blue' => null,
+ '#abc' => null,
+ '#12345g' => null,
+ ' #16a34a' => null,
+ '' => null,
+ ];
+
+ $process = (new Process([
+ $node,
+ base_path('tests/fixtures/label-color-harness.ts'),
+ resource_path('js/lib/labelColor.ts'),
+ ...array_map('strval', array_keys($cases)),
+ ]))->mustRun();
+
+ expect(array_combine(array_map('strval', array_keys($cases)), json_decode($process->getOutput(), true, flags: JSON_THROW_ON_ERROR)))
+ ->toBe(array_combine(array_map('strval', array_keys($cases)), array_values($cases)));
+});
diff --git a/tests/fixtures/label-color-harness.ts b/tests/fixtures/label-color-harness.ts
new file mode 100644
index 000000000..d6ef899b4
--- /dev/null
+++ b/tests/fixtures/label-color-harness.ts
@@ -0,0 +1,13 @@
+/**
+ * Runs `labelTextColor()` of `resources/js/lib/labelColor.ts` over a list of
+ * colors and prints the answers as JSON, so `LabelColorTest.php` can check
+ * them. Node strips the types, so the source is loaded as-is.
+ */
+import path from 'node:path';
+import { pathToFileURL } from 'node:url';
+
+const [sourceFile, ...colors] = process.argv.slice(2);
+
+const { labelTextColor } = await import(pathToFileURL(path.resolve(sourceFile)).href);
+
+console.log(JSON.stringify(colors.map((color) => labelTextColor(color) ?? null)));
diff --git a/tests/fixtures/single-line-copy.php b/tests/fixtures/single-line-copy.php
index 7c8f4be74..583cce428 100644
--- a/tests/fixtures/single-line-copy.php
+++ b/tests/fixtures/single-line-copy.php
@@ -10,6 +10,17 @@ declare(strict_types=1);
*/
return [
+ 'posts.status.draft' => 9,
+ 'posts.status.pending_approval' => 13,
+ 'posts.status.scheduled' => 16,
+ 'posts.status.publishing' => 20,
+ 'posts.status.retrying' => 18,
+ 'posts.status.published' => 14,
+ 'posts.status.failed' => 14,
+ 'posts.status.pending_review' => 28,
+ 'posts.status.deleted_on_network' => 10,
+ 'labels.actions.view_insights' => 20,
+ 'labels.meta.posts' => 18,
'accounts.connect.actions.back' => 8,
'accounts.connect.actions.connect_again' => 17,
'accounts.connect.actions.start_again' => 16,
@@ -75,9 +86,20 @@ return [
'channels.description' => 43,
'channels.goal_dialog.description' => 57,
'channels.link_facebook_page' => 35,
+ 'channels.list.columns.channel' => 7,
+ 'channels.list.connection_lost' => 40,
+ 'channels.list.columns.posting_times' => 13,
+ 'channels.list.columns.this_week' => 17,
+ 'channels.list.columns.timezone' => 15,
+ 'channels.list.more_actions' => 22,
+ 'channels.list.networks' => 9,
+ 'channels.list.posting_times_per_week' => 15,
+ 'channels.list.no_posting_times' => 17,
+ 'channels.list.settings' => 13,
'channels.grid.title' => 10,
'channels.settings_page.cancel' => 9,
'channels.settings_page.timezone_confirm' => 22,
+ 'channels.set_goal' => 37,
'common.unsaved_changes.discard' => 17,
'create.tabs.feeds' => 10,
'create.tabs.ideas' => 8,
@@ -96,6 +118,18 @@ return [
'posts.approvals.reject' => 9,
'posts.approvals.revert' => 32,
'posts.approvals.schedule' => 15,
+ 'posts.board.columns.approvals' => 13,
+ 'posts.board.columns.draft' => 9,
+ 'posts.board.columns.failed' => 14,
+ 'posts.board.columns.no_channel' => 13,
+ 'posts.board.columns.published' => 14,
+ 'posts.board.columns.scheduled' => 16,
+ 'posts.board.columns.untagged' => 15,
+ 'posts.board.group_by' => 16,
+ 'posts.board.groups.channel' => 7,
+ 'posts.board.groups.status' => 9,
+ 'posts.board.groups.tag' => 9,
+ 'posts.board.view' => 7,
'posts.composer.deselect_all' => 23,
'posts.composer.edit_view' => 11,
'posts.composer.hashtags_remaining' => 16,