Skip to content

Commit

Permalink
Merge pull request #402 from anodyne/public-story-pages
Browse files Browse the repository at this point in the history
Updates for public story pages
  • Loading branch information
agentphoenix authored Aug 26, 2024
2 parents b1bd89d + 6ec566b commit 1b86621
Show file tree
Hide file tree
Showing 37 changed files with 3,339 additions and 384 deletions.
1 change: 1 addition & 0 deletions nova/bootstrap/providers.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
// Nova\Navigation\Providers\NavigationServiceProvider::class,
Nova\Notes\Providers\NotesServiceProvider::class,
Nova\Pages\Providers\PageServiceProvider::class,
Nova\PublicSite\Providers\PublicSiteServiceProvider::class,
Nova\Ranks\Providers\RankServiceProvider::class,
Nova\Roles\Providers\RoleServiceProvider::class,
Nova\Settings\Providers\SettingsServiceProvider::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,21 @@ protected function populatePublicPages(): void
'updated_at' => now(),
],
[
'name' => 'Characters manifest',
'name' => 'Characters',
'uri' => 'characters',
'key' => 'public.characters',
'layout' => 'public',
'blocks' => '{"type":"doc","content":[{"type":"scribbleBlock","attrs":{"id":"b98eacc0-199f-48f7-a0a6-95dcbe887a01","type":"block","identifier":"manifest","values":{"heading":"Characters manifest","description":null,"headerOrientation":"left","bgOption":"transparent","dark":false,"spacingHorizontal":null,"spacingVertical":"none","layout":"cards","characterOptions":["avatar","position","rank-name","rank-image"],"cardOrientation":"center","showDepartments":false,"showAvailablePositions":false,"showCharacters":true,"characterStatus":"active","characterType":"primary-secondary"}}}]}',
'blocks' => '{"type":"doc","content":[{"type":"scribbleBlock","attrs":{"id":"b98eacc0-199f-48f7-a0a6-95dcbe887a01","type":"block","identifier":"manifest","values":{"heading":"Characters","description":null,"headerOrientation":"left","bgOption":"transparent","dark":false,"spacingHorizontal":null,"spacingVertical":"none","layout":"cards","characterOptions":["avatar","position","rank-name","rank-image"],"cardOrientation":"center","showDepartments":false,"showAvailablePositions":false,"showCharacters":true,"characterStatus":"active","characterType":"primary-secondary"}}}]}',
'published_at' => now(),
'created_at' => now(),
'updated_at' => now(),
],
[
'name' => 'Stories',
'uri' => 'stories',
'key' => 'public.stories',
'layout' => 'public',
'blocks' => '{"type":"doc","content":[{"type":"scribbleBlock","attrs":{"id":"edf32b82-0680-4476-8480-d859c06db467","type":"block","identifier":"stories-timeline-block","values":{"heading":"Stories","description":null,"headerOrientation":"left","bgOption":"transparent","dark":false,"spacingHorizontal":null,"spacingVertical":"none","timelineSorting":"asc"}}}]}',
'published_at' => now(),
'created_at' => now(),
'updated_at' => now(),
Expand Down Expand Up @@ -266,6 +276,20 @@ protected function populatePublicPages(): void
'resource' => 'Nova\\PublicSite\\Controllers\\ShowCharacterBioController',
'layout' => 'public',
],
[
'name' => 'View story',
'uri' => 'story/{story}',
'key' => 'public.story',
'resource' => 'Nova\\PublicSite\\Controllers\\ShowStoryController',
'layout' => 'public',
],
[
'name' => 'View story post',
'uri' => 'story/{story}/post/{post}',
'key' => 'public.story-post',
'resource' => 'Nova\\PublicSite\\Controllers\\ShowStoryPostController',
'layout' => 'public',
],
];

collect($advancedPages)->each([Page::class, 'create']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function up(): void
$menu->items()->createMany([
['label' => 'Home', 'link_type' => LinkType::Page, 'page_id' => Page::key('home')->first()->id],
['label' => 'Characters', 'link_type' => LinkType::Page, 'page_id' => Page::key('public.characters')->first()->id],
['label' => 'Stories', 'link_type' => LinkType::Page, 'page_id' => Page::key('public.stories')->first()->id],
['label' => 'Join', 'link_type' => LinkType::Page, 'page_id' => Page::key('public.join')->first()->id],
['label' => 'Contact', 'link_type' => LinkType::Page, 'page_id' => Page::key('public.contact')->first()->id],
]);
Expand Down
1 change: 1 addition & 0 deletions nova/foundation/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ protected function registerBlocks(): void
Blocks\Content\FreeformContentBlock::make(),

Blocks\Stories\AlternatingStoriesBlock::make(),
Blocks\Stories\StoriesTimelineBlock::make(),

Blocks\Manifest\ManifestBlock::make(),

Expand Down
18 changes: 9 additions & 9 deletions nova/resources/views/components/badge.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
data-slot="badge"
{{
$attributes->class([
'inline-flex items-center font-medium tracking-normal ring-1 ring-inset',
'nv-badge inline-flex items-center font-medium tracking-normal ring-1 ring-inset',
'[&>[data-slot=icon]]:-mx-0.5 [&>[data-slot=icon]]:my-0.5 [&>[data-slot=icon]]:shrink-0 [&>[data-slot=icon]]:text-[--btn-icon] [&>[data-slot=icon]]:sm:my-1',
'[&>[data-slot=badge]]:bg-white dark:[&>[data-slot=badge]]:bg-gray-950',
match ($size) {
'sm' => 'gap-x-2.5 rounded-md px-1.5 py-0.5 text-xs/5 has-[[data-slot=badge]]:rounded-lg data-[pill]:rounded-full data-[pill]:px-2 [&>[data-slot=badge]]:-mx-0.5 [&>[data-slot=badge]]:my-0.5 data-[pill]:[&>[data-slot=badge]]:-mx-1',
'md' => 'gap-x-3 rounded-md px-2 py-0.5 text-sm/5 has-[[data-slot=badge]]:rounded-lg data-[pill]:rounded-full data-[pill]:px-2.5 [&>[data-slot=badge]]:-mx-1 [&>[data-slot=badge]]:my-0.5 data-[pill]:[&>[data-slot=badge]]:-mx-1.5',
'lg' => 'gap-x-3.5 rounded-lg px-2.5 py-1 text-sm/5 has-[[data-slot=badge]]:rounded-xl data-[pill]:rounded-full data-[pill]:px-3 [&>[data-slot=badge]]:-mx-1.5 data-[pill]:[&>[data-slot=badge]]:-mx-2',
'sm' => 'nv-badge-sm gap-x-2.5 rounded-md px-1.5 py-0.5 text-xs/5 has-[[data-slot=badge]]:rounded-lg data-[pill]:rounded-full data-[pill]:px-2 [&>[data-slot=badge]]:-mx-0.5 [&>[data-slot=badge]]:my-0.5 data-[pill]:[&>[data-slot=badge]]:-mx-1',
'md' => 'nv-badge-md gap-x-3 rounded-md px-2 py-0.5 text-sm/5 has-[[data-slot=badge]]:rounded-lg data-[pill]:rounded-full data-[pill]:px-2.5 [&>[data-slot=badge]]:-mx-1 [&>[data-slot=badge]]:my-0.5 data-[pill]:[&>[data-slot=badge]]:-mx-1.5',
'lg' => 'nv-badge-lg gap-x-3.5 rounded-lg px-2.5 py-1 text-sm/5 has-[[data-slot=badge]]:rounded-xl data-[pill]:rounded-full data-[pill]:px-3 [&>[data-slot=badge]]:-mx-1.5 data-[pill]:[&>[data-slot=badge]]:-mx-2',
},
match ($color) {
'danger' => 'bg-danger-50 text-danger-700 ring-danger-200 [--btn-icon:theme(colors.danger.600)] dark:bg-danger-950 dark:text-danger-300 dark:ring-danger-800 dark:[--btn-icon:theme(colors.danger.400)]',
'info' => 'bg-info-50 text-info-700 ring-info-200 [--btn-icon:theme(colors.info.600)] dark:bg-info-950 dark:text-info-300 dark:ring-info-800 dark:[--btn-icon:theme(colors.info.400)]',
'primary' => 'bg-primary-50 text-primary-700 ring-primary-200 [--btn-icon:theme(colors.primary.600)] dark:bg-primary-950 dark:text-primary-300 dark:ring-primary-800 dark:[--btn-icon:theme(colors.primary.400)]',
'success' => 'bg-success-50 text-success-700 ring-success-200 [--btn-icon:theme(colors.success.600)] dark:bg-success-950 dark:text-success-300 dark:ring-success-800 dark:[--btn-icon:theme(colors.success.400)]',
'warning' => 'bg-warning-50 text-warning-700 ring-warning-200 [--btn-icon:theme(colors.warning.600)] dark:bg-warning-950 dark:text-warning-300 dark:ring-warning-800 dark:[--btn-icon:theme(colors.warning.400)]',
'danger' => 'nv-badge-danger bg-danger-50 text-danger-700 ring-danger-200 [--btn-icon:theme(colors.danger.600)] dark:bg-danger-950 dark:text-danger-300 dark:ring-danger-800 dark:[--btn-icon:theme(colors.danger.400)]',
'info' => 'nv-badge-info bg-info-50 text-info-700 ring-info-200 [--btn-icon:theme(colors.info.600)] dark:bg-info-950 dark:text-info-300 dark:ring-info-800 dark:[--btn-icon:theme(colors.info.400)]',
'primary' => 'nv-badge-primary bg-primary-50 text-primary-700 ring-primary-200 [--btn-icon:theme(colors.primary.600)] dark:bg-primary-950 dark:text-primary-300 dark:ring-primary-800 dark:[--btn-icon:theme(colors.primary.400)]',
'success' => 'nv-badge-success bg-success-50 text-success-700 ring-success-200 [--btn-icon:theme(colors.success.600)] dark:bg-success-950 dark:text-success-300 dark:ring-success-800 dark:[--btn-icon:theme(colors.success.400)]',
'warning' => 'nv-badge-warning bg-warning-50 text-warning-700 ring-warning-200 [--btn-icon:theme(colors.warning.600)] dark:bg-warning-950 dark:text-warning-300 dark:ring-warning-800 dark:[--btn-icon:theme(colors.warning.400)]',
default => 'bg-gray-50 text-gray-700 ring-gray-200 [--btn-icon:theme(colors.gray.600)] dark:bg-gray-900 dark:text-gray-300 dark:ring-gray-700 dark:[--btn-icon:theme(colors.gray.400)]',
},
])
Expand Down
18 changes: 6 additions & 12 deletions nova/resources/views/components/stories/timeline.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,12 @@

@if ($story->children_count > 0)
<div class="shrink-0">
<x-icon
name="add"
size="md"
class="text-gray-400 dark:text-gray-500"
x-show="!expanded"
></x-icon>
<x-icon
name="remove"
size="md"
class="text-gray-400 dark:text-gray-500"
x-show="expanded"
></x-icon>
<span x-show="!expanded">
<x-icon name="add" size="md" class="text-gray-400 dark:text-gray-500"></x-icon>
</span>
<span x-show="expanded">
<x-icon name="remove" size="md" class="text-gray-400 dark:text-gray-500"></x-icon>
</span>
</div>
@endif
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<div @class([
'not-prose',
'dark' => $dark,
]) style="--bgColor: {{ $bgColor ?? 'transparent' }}">
<div class="mx-auto max-w-7xl bg-[--bgColor] px-8 py-8 font-[family-name:Flow_Circular]">
<x-timeline>
<div>
<x-timeline.item
:last="false"
:highlighted="false"
class="bg-gray-400 ring-white dark:bg-gray-500 dark:ring-gray-900"
>
<x-slot name="title">
<div class="flex w-full items-center justify-between">
<div class="flex items-center gap-x-6">
<x-public::preview.h2>Story title</x-public::preview.h2>

<x-badge color="gray">Status</x-badge>
</div>
</div>
</x-slot>

<div class="w-full">
<div
class="prose max-w-4xl dark:prose-invert prose-a:text-primary-500 hover:prose-a:text-primary-600 dark:hover:prose-a:text-primary-400"
>
Excepteur Lorem irure sunt cupidatat commodo commodo qui anim id. Ullamco officia elit
reprehenderit in dolore deserunt ea minim ex veniam Lorem do. Nisi fugiat Lorem eu voluptate
consequat. Voluptate ex reprehenderit magna aute consequat anim. Laborum veniam veniam amet
laborum eu duis amet amet Lorem nulla.
</div>

<div class="mt-8">
<x-public::preview.button href="#">Go to story &rarr;</x-public::preview.button>
</div>
</div>
</x-timeline.item>
</div>
<div>
<x-timeline.item :last="false" :highlighted="true" class="bg-primary-500 ring-primary-500">
<x-slot name="title">
<div class="flex w-full items-center justify-between">
<div class="flex items-center gap-x-6">
<x-public::preview.h2>Story title</x-public::preview.h2>

<x-badge color="primary">Status</x-badge>
</div>
</div>
</x-slot>

<div class="w-full">
<div
class="prose max-w-4xl dark:prose-invert prose-a:text-primary-500 hover:prose-a:text-primary-600 dark:hover:prose-a:text-primary-400"
>
Excepteur Lorem irure sunt cupidatat commodo commodo qui anim id. Ullamco officia elit
reprehenderit in dolore deserunt ea minim ex veniam Lorem do. Nisi fugiat Lorem eu voluptate
consequat. Voluptate ex reprehenderit magna aute consequat anim. Laborum veniam veniam amet
laborum eu duis amet amet Lorem nulla.
</div>

<div class="mt-8">
<x-public::preview.button href="#">Go to story &rarr;</x-public::preview.button>
</div>
</div>
</x-timeline.item>
</div>
<div>
<x-timeline.item :last="true" :highlighted="false" class="bg-info-500 ring-white dark:ring-gray-900">
<x-slot name="title">
<div class="flex w-full items-center justify-between">
<div class="flex items-center gap-x-6">
<x-public::preview.h2>Story title</x-public::preview.h2>

<x-badge color="info">Status</x-badge>
</div>
</div>
</x-slot>

<div class="w-full">
<div
class="prose max-w-4xl dark:prose-invert prose-a:text-primary-500 hover:prose-a:text-primary-600 dark:hover:prose-a:text-primary-400"
>
Excepteur Lorem irure sunt cupidatat commodo commodo qui anim id. Ullamco officia elit
reprehenderit in dolore deserunt ea minim ex veniam Lorem do. Nisi fugiat Lorem eu voluptate
consequat. Voluptate ex reprehenderit magna aute consequat anim. Laborum veniam veniam amet
laborum eu duis amet amet Lorem nulla.
</div>

<div class="mt-8">
<x-public::preview.button href="#">Go to story &rarr;</x-public::preview.button>
</div>
</div>
</x-timeline.item>
</div>
</x-timeline>
</div>
</div>
49 changes: 49 additions & 0 deletions nova/resources/views/pages/pages/blocks/stories/timeline.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<div
@class([
'@container',
'nv-stories nv-stories-timeline',
'dark' => $dark,
])
style="--bgColor: {{ $bgColor ?? 'transparent' }}"
>
<x-public::block.wrapper
:spacing-horizontal="$spacingHorizontal ?? null"
:spacing-vertical="$spacingVertical ?? null"
>
<div
@class([
'nv-stories-wrapper flex',
'content-end justify-end' => $headerOrientation === 'right',
])
>
<div
@class([
'nv-stories-intro max-w-2xl',
'mx-auto @lg:text-center' => $headerOrientation === 'center',
'@lg:text-right' => $headerOrientation === 'right',
])
>
@if (filled($heading))
<x-public::h1>
{{ $heading }}
</x-public::h1>
@endif

@if (filled($description))
<x-public::lead
@class([
'mt-6' => filled($heading),
])
markdown
>
{{ $description }}
</x-public::lead>
@endif
</div>
</div>

<div class="mt-12">
<livewire:public-stories-timeline :sort-direction="$timelineSorting" />
</div>
</x-public::block.wrapper>
</div>
18 changes: 18 additions & 0 deletions nova/resources/views/pages/pages/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@
>
<x-input.text :value="old('key')" data-cy="key" />
</x-fieldset.field>

<x-radio.group>
<x-radio.field>
<x-fieldset.label for="layout_public">Public page</x-fieldset.label>
<x-fieldset.description>
A page that is accessible to any site visitor
</x-fieldset.description>
<x-radio id="layout_public" name="layout" value="public"></x-radio>
</x-radio.field>

<x-radio.field>
<x-fieldset.label for="layout_admin">Admin page</x-fieldset.label>
<x-fieldset.description>
A page that is only accessible to authenticated users
</x-fieldset.description>
<x-radio id="layout_admin" name="layout" value="admin"></x-radio>
</x-radio.field>
</x-radio.group>
</x-fieldset.field-group>
</x-fieldset>

Expand Down
Loading

0 comments on commit 1b86621

Please sign in to comment.