+
diff --git a/resources/js/Components/PaginationComponent.vue b/resources/js/Components/PaginationComponent.vue
new file mode 100644
index 0000000..160f63d
--- /dev/null
+++ b/resources/js/Components/PaginationComponent.vue
@@ -0,0 +1,41 @@
+
+
+
+
+
+ Poprzednia
+
+ Strona {{ page }} z {{ lastPage }}
+
+ Następna
+
+
+
diff --git a/resources/js/Layouts/Layout.vue b/resources/js/Layouts/Layout.vue
index 6679b74..41390b5 100644
--- a/resources/js/Layouts/Layout.vue
+++ b/resources/js/Layouts/Layout.vue
@@ -1,6 +1,6 @@
diff --git a/resources/js/Pages/EventList.vue b/resources/js/Pages/EventList.vue
new file mode 100644
index 0000000..56fa569
--- /dev/null
+++ b/resources/js/Pages/EventList.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Szukaj
+
+
+
+
+ Przeglądaj wydarzenia
+
+
+
+
+
+
+
+
+
+
+ Brak wydarzeń do wyświetlenia.
+
+
+
+
+
+
+
+
+
diff --git a/resources/js/Pages/EventPage.vue b/resources/js/Pages/EventPage.vue
index 48fc725..3431616 100644
--- a/resources/js/Pages/EventPage.vue
+++ b/resources/js/Pages/EventPage.vue
@@ -1,10 +1,13 @@
-
-
+
+
-
-
+
+
- 12k osób weźmie udział
+ {{ participantsMessage }}
-
+
Invite
-
+
-
+
-
+
- {{ eventDate }}
+ {{ formatDate(event.start) }} - {{ formatTime(event.start) }}
- Płatny
+ {{ event.is_paid ? 'Płatny' : 'Darmowy' }}
-
{{ eventTitle }}
+
{{ event.title }}
-
+
-
{{ venueName }}
+ {{ event.location || 'Brak lokalizacji' }}
- Brak ograniczenia wiekowego
+ {{ event.age_category ?? 'Brak ograniczenia wiekowego' }}
-
-
-
+
+
+
Zainteresowany(a)
-
-
+
+
Wezmę udział
-
-
+
+
Zaproś
-
-
+
+
-
-
+
+
...
@@ -140,86 +142,54 @@ const isPaid = true
-
-
-
+
+
+
-
+
-
-
- Obserwuj
-
+
+ Obserwuj
-
Informacje
-
- Lorem ipsum dolor sit amet, consectetur adipiscing elit Lorem
- ipsum dolor sit amet, consectetur adipiscing elit Lorem ipsum
- dolor sit amet, consectetur adipiscing elit Lorem ipsum dolor
- sit amet, consectetur adipiscing elit Lorem ipsum dolor sit
- amet, consectetur adipiscing elit Lorem ipsum dolor sit amet,
- consectetur adipiscing elit Lorem ipsum dolor sit amet,
- consectetur adipiscing elit Lorem ipsum dolor sit amet,
- consectetur adipiscing elit Lorem ipsum dolor sit amet,
- consectetur adipiscing elit Lorem ipsum dolor sit amet,
- consectetur adipiscing elit Lorem ipsum dolor sit amet,
- consectetur adipiscing elit
-
+
Informacje
+
{{ event.description }}
-
-
-
-
+
+
-
+
Bilety
-
-
+
+
KUP BILET
@@ -227,19 +197,17 @@ const isPaid = true
-
-
-
+
+
+
-
{{ venueName }}
-
- {{ venueAddress }}
-
+
{{ event.location }}
+
{{ event.address }}
diff --git a/resources/js/Pages/HomePage.vue b/resources/js/Pages/HomePage.vue
index 4e4b0fb..b790269 100644
--- a/resources/js/Pages/HomePage.vue
+++ b/resources/js/Pages/HomePage.vue
@@ -1,17 +1,15 @@
@@ -103,7 +101,7 @@ const isLoggedIn = computed(() => !!authProps.value.auth.user)
class="flex flex-col items-center justify-center text-center text-white space-y-16 max-sm:space-y-8"
>
- Bądź na bieżaco
+ Bądź na bieżąco
dołącz do LetsEvent
!!authProps.value.auth.user)
Dodawaj własne wydarzenia
Bierz udział w wydarzeniach
diff --git a/resources/js/Pages/ProfilePage.vue b/resources/js/Pages/ProfilePage.vue
index 4efd371..3be5ea5 100644
--- a/resources/js/Pages/ProfilePage.vue
+++ b/resources/js/Pages/ProfilePage.vue
@@ -1,39 +1,125 @@
-
-
profile
+
+
+
+
+
-
-
Imie: {{ user.first_name }}
-
Nazwisko: {{ user.last_name }}
-
E-mail: {{ user.email }}
-
+
+
+
+ {{ user?.first_name ?? '' }} {{ user?.last_name ?? '' }}
+
+
+
+
{{ user?.followers_count ?? 0 }} Obserwujący
+
{{ user?.events_count ?? 0 }} Wydarzenia
+
-
- Wyloguj się
-
+
+
+ Edytuj profil
+
+
+
+ {{ isFollowing ? 'Odobserwuj' : 'Obserwuj' }}
+
+
+
Wydarzenia
+
+
+
+ Brak wydarzeń do wyświetlenia.
+
+
+
+
+
+ Wyloguj się
+
+
+
+
+
ID: {{ user?.id ?? '' }}
+
E-mail: {{ user?.email ?? '' }}
+
+
+
+
diff --git a/resources/js/composables/useAuth.ts b/resources/js/composables/useAuth.ts
new file mode 100644
index 0000000..2ddd61a
--- /dev/null
+++ b/resources/js/composables/useAuth.ts
@@ -0,0 +1,27 @@
+import { computed } from 'vue'
+import { usePage, router } from '@inertiajs/vue3'
+import api from '@/services/api'
+import type { AuthProps } from '@/types/types'
+
+export function useAuth() {
+ const page = usePage()
+ const props = page.props as unknown as AuthProps
+
+ const authUser = computed(() => props.auth.user)
+ const authUserId = computed(() => props.auth.user?.id)
+
+ const isLoggedIn = computed(() => !!authUser.value)
+
+ async function logout() {
+ try {
+ await api.post('/auth/logout')
+ sessionStorage.removeItem('token')
+ } catch (error) {
+ alert('Wystąpił problem podczas wylogowania')
+ } finally {
+ router.visit('/login', { method: 'get' })
+ }
+ }
+
+ return { authUser, authUserId, isLoggedIn, logout }
+}
diff --git a/resources/js/composables/useEvents.ts b/resources/js/composables/useEvents.ts
new file mode 100644
index 0000000..aab2164
--- /dev/null
+++ b/resources/js/composables/useEvents.ts
@@ -0,0 +1,42 @@
+import { ref, watch } from 'vue'
+import api from '@/services/api'
+import type { RawEvent } from '@/types/events'
+
+export function useEvents() {
+ const events = ref
([])
+ const search = ref(null)
+ const page = ref(1)
+ const meta = ref<{ current_page: number, last_page: number }>({ current_page: 1, last_page: 1 })
+
+ async function fetchEvents() {
+ try {
+ const res = await api.get('/events', {
+ params: { search: search.value, page: page.value },
+ })
+ events.value = res.data.data
+ meta.value.current_page = res.data.meta.current_page
+ meta.value.last_page = res.data.meta.last_page
+ } catch (error) {
+ alert('useEvents fetchEvents error')
+ }
+ }
+
+ watch([search, page], fetchEvents, { immediate: true })
+
+ function prevPage() {
+ if (page.value > 1) page.value--
+ }
+
+ function nextPage() {
+ if (page.value < meta.value.last_page) page.value++
+ }
+
+ return {
+ events,
+ search,
+ page,
+ meta,
+ prevPage,
+ nextPage,
+ }
+}
diff --git a/resources/js/composables/useInteractions.ts b/resources/js/composables/useInteractions.ts
new file mode 100644
index 0000000..7f64d18
--- /dev/null
+++ b/resources/js/composables/useInteractions.ts
@@ -0,0 +1,17 @@
+import { ref } from 'vue'
+import api from '@/services/api'
+
+export function useInteractions() {
+ const isFollowing = ref(false)
+
+ async function followUser(userId: number) {
+ try {
+ await api.post(`/follow/user/${userId}`)
+ isFollowing.value = true
+ } catch (error) {
+ alert('Błąd podczas obserwowania użytkownika')
+ }
+ }
+
+ return { isFollowing, followUser }
+}
diff --git a/resources/js/composables/useLogout.ts b/resources/js/composables/useLogout.ts
deleted file mode 100644
index e2b5768..0000000
--- a/resources/js/composables/useLogout.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { router } from '@inertiajs/vue3'
-import api from '@/services/api'
-
-export function useLogout() {
- async function logout() {
- try {
- await api.post('/auth/logout')
- } catch (e) {
- console.error('Błąd przy wylogowaniu:', e)
- } finally {
- sessionStorage.removeItem('token')
- router.visit('/login', { method: 'get' })
- }
- }
-
- return { logout }
-}
diff --git a/resources/js/types/events.ts b/resources/js/types/events.ts
new file mode 100644
index 0000000..6ff5764
--- /dev/null
+++ b/resources/js/types/events.ts
@@ -0,0 +1,44 @@
+export interface RawEvent {
+ id: number
+ title: string
+ description: string | null
+ start: string | null
+ end: string | null
+ location: string | null
+ address: string | null
+ latitude: number | null
+ longitude: number | null
+ image_url: string | null
+ is_paid: boolean
+ price: number
+ status: string
+ age_category: string | null
+ participants: unknown[]
+
+ owner_type: string
+ owner_id: number
+ owner: {
+ id: number | null
+ first_name?: string | null
+ last_name?: string | null
+ name?: string
+ avatar_url?: string
+ group_url?: string
+ users?: any[]
+ } | null
+
+ created_at: string
+ updated_at: string
+}
+
+export interface EventMarker {
+ id: number
+ title: string
+ start: string
+ latitude: number
+ longitude: number
+ image_url: string | null
+ location: string | null
+ is_paid: boolean
+ age_category: string | null
+}
diff --git a/resources/js/utilities/formatDate.ts b/resources/js/utilities/formatDate.ts
new file mode 100644
index 0000000..450cb27
--- /dev/null
+++ b/resources/js/utilities/formatDate.ts
@@ -0,0 +1,36 @@
+function formatFullDateTime(
+ dateString: string | null | undefined,
+ locale = 'pl-PL',
+ options: Intl.DateTimeFormatOptions = {
+ weekday: 'long',
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ hour: '2-digit',
+ minute: '2-digit',
+ },
+): string {
+ if (!dateString) return 'Brak daty'
+ const date = new Date(dateString)
+ if (isNaN(date.getTime())) return 'Brak daty'
+ return new Intl.DateTimeFormat(locale, options).format(date)
+}
+
+export function formatDay(dateString: string | null | undefined): string {
+ return formatFullDateTime(dateString, 'pl-PL', { weekday: 'long' })
+}
+
+export function formatDate(dateString: string | null | undefined): string {
+ return formatFullDateTime(dateString, 'pl-PL', {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric',
+ })
+}
+
+export function formatTime(dateString: string | null | undefined): string {
+ return formatFullDateTime(dateString, 'pl-PL', {
+ hour: '2-digit',
+ minute: '2-digit',
+ })
+}
diff --git a/routes/web.php b/routes/web.php
index 2ccd113..295558d 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -12,6 +12,13 @@
Route::get("/register", fn(): Response => inertia("Auth/RegisterPage"));
Route::get("/forgot-password", fn(): Response => inertia("Auth/ForgotPasswordPage"));
-Route::get("/event", fn(): Response => inertia("EventPage"));
+Route::get("/event/{id}", fn(int $id): Response => inertia("EventPage", [
+ "eventId" => $id,
+]));
-Route::middleware(["auth:sanctum"])->get("/profile", fn(): Response => Inertia::render("ProfilePage"))->name("profile");
+Route::get("/event", fn(): Response => inertia("EventList"));
+
+Route::middleware(["auth:sanctum"])->group(function (): void {
+ Route::get("/profile", fn(): Response => Inertia::render("ProfilePage"))->name("profile");
+ Route::get("/profile/{userId}", fn(int $userId): Response => Inertia::render("ProfilePage", ["userId" => $userId]))->name("profile.show");
+});