Skip to content

Commit eea073f

Browse files
committed
Improve text & added new columns
1 parent 75c7438 commit eea073f

File tree

11 files changed

+219
-65
lines changed

11 files changed

+219
-65
lines changed

app/Http/Controllers/SantaController.php

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

33
namespace App\Http\Controllers;
44

5+
use App\Notifications\SimpleMessageNotification;
56
use Illuminate\Contracts\View\View;
67
use Illuminate\Http\RedirectResponse;
78
use Illuminate\Http\Request;
@@ -39,13 +40,13 @@ public function rules(): View
3940
/**
4041
* Показывает форму для регистрации.
4142
*/
42-
public function start(Request $request): View
43+
public function game(Request $request): View
4344
{
4445
$participant = $request->user()
4546
->secretSantaParticipant()
4647
->firstOrNew();
4748

48-
return view('santa.registration', [
49+
return view('santa.game', [
4950
'participant' => $participant,
5051
]);
5152
}
@@ -60,8 +61,10 @@ public function update(Request $request): RedirectResponse
6061
->firstOrNew();
6162

6263
$data = $request->validate([
63-
'address' => 'required|string',
64-
'about' => 'required|string',
64+
'telegram' => ['string', 'required_without:tracking_number'],
65+
'phone' => ['string', 'required_without:tracking_number'],
66+
'address' => ['string', 'required_without:tracking_number'],
67+
'about' => ['string', 'required_without:tracking_number'],
6568
'tracking_number' => [
6669
'nullable',
6770
'string',
@@ -73,6 +76,11 @@ public function update(Request $request): RedirectResponse
7376
->fill($data)
7477
->save();
7578

79+
$participant
80+
->receiver
81+
?->user
82+
?->notify(new SimpleMessageNotification('Получатель подарка "Тайного Санты" обновил информацию. Пожалуйста, проверьте.'));
83+
7684
Toast::success('Ваша заявка на участие в принята! Готовьтесь к сюрпризу.')
7785
->disableAutoHide();
7886

app/Notifications/SimpleMessageNotification.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Notifications\Channels\SiteMessage;
88
use Illuminate\Bus\Queueable;
99
use Illuminate\Contracts\Queue\ShouldQueue;
10+
use Illuminate\Notifications\Messages\MailMessage;
1011
use Illuminate\Notifications\Notification;
1112
use NotificationChannels\WebPush\WebPushChannel;
1213
use NotificationChannels\WebPush\WebPushMessage;
@@ -34,9 +35,26 @@ public function via(User $user)
3435
return [
3536
SiteChannel::class,
3637
WebPushChannel::class,
38+
'mail',
3739
];
3840
}
3941

42+
/**
43+
* Get the mail representation of the notification.
44+
*
45+
* @param User $user
46+
*
47+
* @throws \Throwable
48+
*
49+
* @return MailMessage
50+
*/
51+
public function toMail(User $user)
52+
{
53+
return (new MailMessage)
54+
->subject('Новое уведомление')
55+
->line($this->message);
56+
}
57+
4058
/**
4159
* Get the app representation of the notification.
4260
*

database/migrations/2024_12_08_212535_create_secret_santa_participants_table.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ public function up(): void
2222
$table->text('address')
2323
->comment('Адрес участника для отправки подарка');
2424

25+
$table->string('telegram')
26+
->nullable()
27+
->comment('Телеграм участника для связи');
28+
29+
$table->string('phone')
30+
->comment('Контактные данные участника для связи');
31+
2532
$table->text('about')
2633
->comment('Информация о пользователе, которую он предоставляет о себе для получателя');
2734

@@ -35,6 +42,10 @@ public function up(): void
3542
->comment('Номер отслеживания посылки')
3643
->nullable();
3744

45+
$table->string('status')
46+
->comment('Статус участника в Тайном Санте')
47+
->default('new');
48+
3849
$table->timestamps();
3950
$table->softDeletes();
4051
});

public/build/assets/app-C-qCo1Rq.css renamed to public/build/assets/app-8jhtCGii.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/assets/app-Ytyxm_8s.js renamed to public/build/assets/app-CDEY8pR7.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/build/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
"src": "public/img/ui/blockquote/warning.svg"
1717
},
1818
"resources/css/app.scss": {
19-
"file": "assets/app-C-qCo1Rq.css",
19+
"file": "assets/app-8jhtCGii.css",
2020
"src": "resources/css/app.scss",
2121
"isEntry": true
2222
},
2323
"resources/js/app.js": {
24-
"file": "assets/app-Ytyxm_8s.js",
24+
"file": "assets/app-CDEY8pR7.js",
2525
"name": "app",
2626
"src": "resources/js/app.js",
2727
"isEntry": true,

resources/css/santa.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
/* Контейнер снежинок */
22
.snowflake {
33
position: fixed;
4-
top: -10%;
4+
top: -10%; /* Начальная позиция снежинки */
55
width: var(--snowflake-size);
66
height: var(--snowflake-size);
7-
background-image: var(--snowflake-image);
87
background-size: contain;
98
background-repeat: no-repeat;
109
left: var(--snowflake-left);
11-
animation: fall var(--fall-duration) linear var(--fall-delay) infinite;
1210
pointer-events: none;
1311
z-index: -9999;
12+
13+
will-change: transform, opacity; /* Подготовка к анимации */
14+
animation: fall var(--fall-duration) linear var(--fall-delay) infinite;
1415
}
1516

17+
/* Анимация падения снежинок */
1618
@keyframes fall {
1719
0% {
1820
transform: translateY(0) rotate(0deg);

resources/js/controllers/santa_controller.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ export default class extends Controller {
66
}
77

88
disconnect() {
9-
this.clearSnowfall();
9+
this.snowflakes.forEach((snowflake) => {
10+
snowflake.remove();
11+
});
12+
13+
this.snowflakes = [];
1014
}
1115

1216
/**
@@ -20,11 +24,11 @@ export default class extends Controller {
2024
}
2125

2226
if (screenWidth < 768) {
23-
return 40; // Планшеты
27+
return 50; // Планшеты
2428
}
2529

2630
if (screenWidth < 1200) {
27-
return 60; // Небольшие экраны
31+
return 80; // Небольшие экраны
2832
}
2933

3034
return 100; // Большие экраны
@@ -34,6 +38,8 @@ export default class extends Controller {
3438
* Запускает снегопад, создавая снежинки на странице.
3539
*/
3640
startSnowfall() {
41+
this.snowflakes = [];
42+
3743
const snowflakeCount = this.getSnowflakeCount();
3844
const svgUrls = [
3945
'/img/ui/santa/snowflake-2.svg',
@@ -47,6 +53,7 @@ export default class extends Controller {
4753
for (let i = 0; i < snowflakeCount; i++) {
4854
const snowflake = this.createSnowflake(svgUrls);
4955
this.element.appendChild(snowflake);
56+
this.snowflakes.push(snowflake);
5057
}
5158
}
5259

0 commit comments

Comments
 (0)