-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: onboarding flow, chat deleted user handling, and navigation improvements #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9bbcac7
9b8c80e
9e6ca3f
397c88b
512db87
437f4a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Schema; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| */ | ||
| public function up(): void | ||
| { | ||
| Schema::table('chat_messages', function (Blueprint $table) { | ||
| $table->dropForeign(['user_id']); | ||
| $table->foreignId('user_id')->nullable()->change(); | ||
| $table->foreign('user_id')->references('id')->on('users')->nullOnDelete(); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| */ | ||
| public function down(): void | ||
| { | ||
| // Delete orphaned messages without an author before restoring NOT NULL | ||
| DB::table('chat_messages')->whereNull('user_id')->delete(); | ||
|
|
||
| Schema::table('chat_messages', function (Blueprint $table) { | ||
| $table->dropForeign(['user_id']); | ||
| $table->foreignId('user_id')->nullable(false)->change(); | ||
| $table->foreign('user_id')->references('id')->on('users')->cascadeOnDelete(); | ||
| }); | ||
| } | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -841,13 +841,40 @@ export const SiteBottomNav = defineComponent({ | |
| name: 'SiteBottomNav', | ||
| setup() { | ||
| const page = usePage(); | ||
| const user = computed( | ||
| () => page.props.auth?.user as AuthedUser | undefined, | ||
| ); | ||
| const currentUrl = computed(() => String(page.url)); | ||
| const bottomNavItems = computed(() => | ||
| primaryNavItems.filter((i) => i.showInBottom !== false), | ||
| ); | ||
|
|
||
| const homeHref = computed(() => preferredHomeHref(currentUrl.value)); | ||
|
|
||
| const authItemHref = computed(() => { | ||
| if (!user.value) { | ||
| return '/login'; | ||
| } | ||
|
|
||
| return user.value.username | ||
| ? `/u/${user.value.username}` | ||
| : '/profile'; | ||
| }); | ||
|
|
||
| const isAuthItemActive = computed(() => { | ||
| if (user.value) { | ||
| return ( | ||
| currentUrl.value.startsWith('/profile') || | ||
| currentUrl.value.startsWith('/u/') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Match the current user's profile, not every user profile. When Alice visits 🤖 Prompt for AI Agents |
||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| currentUrl.value.startsWith('/login') || | ||
| currentUrl.value.startsWith('/register') | ||
| ); | ||
| }); | ||
|
|
||
| const isActive = (href: string, match?: (url: string) => boolean) => { | ||
| if (match) { | ||
| return match(currentUrl.value); | ||
|
|
@@ -899,6 +926,38 @@ export const SiteBottomNav = defineComponent({ | |
| </span> | ||
| </Link> | ||
| ))} | ||
|
|
||
| <Link | ||
| href={authItemHref.value} | ||
| class={[ | ||
| 'flex min-w-0 flex-1 flex-col items-center gap-1 rounded-xl px-2 py-2 transition-all duration-150 ease-out', | ||
| isAuthItemActive.value | ||
| ? 'text-slate-900 dark:text-white' | ||
| : 'text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200', | ||
| ]} | ||
| > | ||
| <MaterialIcon | ||
| name={user.value ? 'person' : 'login'} | ||
| size={26} | ||
| filled={isAuthItemActive.value} | ||
| weight={400} | ||
| class={`shrink-0 transition-transform duration-150 ${ | ||
| isAuthItemActive.value | ||
| ? 'scale-[1.02] text-slate-900 dark:text-white' | ||
| : 'text-slate-500 dark:text-slate-400' | ||
| }`} | ||
| /> | ||
| <span | ||
| class={[ | ||
| 'text-[10px] leading-none tracking-wide antialiased', | ||
| isAuthItemActive.value | ||
| ? 'font-bold' | ||
| : 'font-medium', | ||
| ]} | ||
| > | ||
| {user.value ? 'Profile' : 'Login'} | ||
| </span> | ||
| </Link> | ||
| </div> | ||
| </nav> | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.