Skip to content

Commit f08aa78

Browse files
committed
feat(content): adding content page
1 parent 6b46ec2 commit f08aa78

File tree

5 files changed

+75
-10
lines changed

5 files changed

+75
-10
lines changed

app/Http/Controllers/Auth/SocialitePlusController.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace App\Http\Controllers\Auth;
44

5+
use App\Http\Controllers\Controller;
56
use App\Models\User;
6-
use Illuminate\Http\Request;
77
use Blaspsoft\SocialitePlus\SocialitePlusFactory;
8+
use Illuminate\Http\Request;
89
use Illuminate\Support\Facades\Auth;
9-
use App\Http\Controllers\Controller;
1010

1111
class SocialitePlusController extends Controller
1212
{
@@ -19,8 +19,6 @@ class SocialitePlusController extends Controller
1919

2020
/**
2121
* Create a new SocialLoginController instance.
22-
*
23-
* @param SocialitePlusFactory $socialitePlus
2422
*/
2523
public function __construct(SocialitePlusFactory $socialitePlus)
2624
{
@@ -30,14 +28,12 @@ public function __construct(SocialitePlusFactory $socialitePlus)
3028
/**
3129
* Redirect to the social login page
3230
*
33-
* @param string $provider
3431
* @return \Illuminate\Http\RedirectResponse
3532
*/
3633
public function redirect(string $provider)
3734
{
3835
try {
3936
return $this->socialitePlus->build($provider)->redirect();
40-
4137
} catch (\Exception $e) {
4238

4339
return redirect()->route('login')->with('error', $e->getMessage());
@@ -47,20 +43,21 @@ public function redirect(string $provider)
4743
/**
4844
* Handle the social login callback
4945
*
50-
* @param string $provider
51-
* @param Request $request
5246
* @return \Illuminate\Http\RedirectResponse
5347
*/
5448
public function callback(string $provider, Request $request)
5549
{
56-
if (!$request->has('code')) return redirect()->route('login')->with('error', 'Invalid request');
50+
if (! $request->has('code')) {
51+
return redirect()->route('login')->with('error', 'Invalid request');
52+
}
5753

5854
$user = $this->socialitePlus->build($provider)->user();
5955

6056
$existingUser = User::where('email', $user->getEmail())->first();
6157

6258
if ($existingUser) {
6359
Auth::login($existingUser);
60+
6461
return redirect()->intended('/dashboard');
6562
}
6663

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
use Inertia\Inertia;
7+
8+
class ContentController extends Controller
9+
{
10+
public function index(Request $request)
11+
{
12+
$subscribed = $request->user()->subscribed();
13+
14+
return Inertia::render('content', [
15+
'subscribed' => $subscribed,
16+
]);
17+
}
18+
}

resources/js/components/app-sidebar.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from "@/components/ui/sidebar";
1313
import { type NavItem } from "@/types";
1414
import { Link } from "@inertiajs/react";
15-
import { BookOpen, Folder, LayoutGrid } from "lucide-react";
15+
import { BookOpen, Folder, LayoutGrid, FileText } from "lucide-react";
1616
import AppLogo from "./app-logo";
1717

1818
const mainNavItems: NavItem[] = [
@@ -21,6 +21,11 @@ const mainNavItems: NavItem[] = [
2121
href: "/dashboard",
2222
icon: LayoutGrid,
2323
},
24+
{
25+
title: "Content",
26+
href: "/content",
27+
icon: FileText,
28+
},
2429
];
2530

2631
const footerNavItems: NavItem[] = [

resources/js/pages/content.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { PlaceholderPattern } from "@/components/ui/placeholder-pattern";
2+
import AppLayout from "@/layouts/app-layout";
3+
import { type BreadcrumbItem } from "@/types";
4+
import { Head } from "@inertiajs/react";
5+
6+
const breadcrumbs: BreadcrumbItem[] = [
7+
{
8+
title: "Content",
9+
href: "/content",
10+
},
11+
];
12+
13+
interface ContentProps {
14+
subscribed: boolean;
15+
}
16+
17+
export default function Content({ subscribed }: ContentProps) {
18+
return (
19+
<AppLayout breadcrumbs={breadcrumbs}>
20+
<Head title="Content" />
21+
<div className="flex flex-col gap-4 rounded-xl p-4">
22+
<div className="border-sidebar-border/70 relative overflow-hidden rounded-xl border">
23+
<div className="p-6">
24+
<h1 className="text-2xl font-semibold text-gray-900">
25+
Content Page
26+
</h1>
27+
<p className="mt-2 text-gray-600 dark:text-gray-400">
28+
This is a placeholder for your content page.
29+
</p>
30+
</div>
31+
</div>
32+
<div className="border-sidebar-border/70 dark:border-sidebar-border relative overflow-hidden rounded-xl border">
33+
<PlaceholderPattern className="absolute inset-0 size-full stroke-neutral-900/20 dark:stroke-neutral-100/20" />
34+
<div className="p-6 min-h-[240px] flex items-center justify-center">
35+
<p className="text-gray-500 dark:text-gray-400">
36+
Your custom content will appear here
37+
</p>
38+
</div>
39+
</div>
40+
</div>
41+
</AppLayout>
42+
);
43+
}

routes/web.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use App\Http\Controllers\Auth\AuthenticatedSessionController;
44
use App\Http\Controllers\Auth\RegisteredUserController;
5+
use App\Http\Controllers\ContentController;
56
use App\Http\Controllers\DashboardController;
67
use App\Http\Controllers\StripeWebhookController;
78
use App\Http\Middleware\HandleSocialitePlusProviders;
@@ -15,6 +16,7 @@
1516

1617
Route::middleware(['auth', 'verified'])->group(function () {
1718
Route::get('dashboard', [DashboardController::class, 'index'])->name('dashboard');
19+
Route::get('content', [ContentController::class, 'index'])->name('content');
1820
});
1921

2022
// Custom Stripe webhook route - this will override Laravel Cashier's built-in route

0 commit comments

Comments
 (0)