This commit is contained in:
red 2025-12-05 10:11:21 +00:00
parent 4e2c14275b
commit 97aaaf1b85
7 changed files with 669 additions and 17 deletions

View File

@ -4,6 +4,8 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Facades\Log;
class Participant extends Model
@ -20,12 +22,12 @@ class Participant extends Model
protected $appends = ['desperate'];
public function receiver()
public function receiver() : belongsTo
{
return $this->belongsTo(Participant::class, 'giving_id');
}
public function giver()
public function giver(): hasOne
{
return $this->hasOne(Participant::class, 'giving_id', 'id');
}
@ -75,5 +77,8 @@ class Participant extends Model
return ($gives && !$gets) || (!$gives && $gets);
}
public function withdraw(): bool
{
return false;
}
}

View File

@ -18,6 +18,8 @@
"ext-curl": "*"
},
"require-dev": {
"ext-curl": "*",
"barryvdh/laravel-ide-helper": "^3.6",
"fakerphp/faker": "^1.23",
"laravel/pail": "^1.2.2",
"laravel/pint": "^1.24",
@ -25,8 +27,7 @@
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.6",
"pestphp/pest": "^4.1",
"pestphp/pest-plugin-laravel": "^4.0",
"ext-curl": "*"
"pestphp/pest-plugin-laravel": "^4.0"
},
"autoload": {
"psr-4": {

298
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c78bcab45d4b86c31ecc79b40f1a12ad",
"content-hash": "10384b5e2e1414abcd436d205f0114a6",
"packages": [
{
"name": "bacon/bacon-qr-code",
@ -6496,6 +6496,152 @@
}
],
"packages-dev": [
{
"name": "barryvdh/laravel-ide-helper",
"version": "v3.6.0",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/laravel-ide-helper.git",
"reference": "8d00250cba25728373e92c1d8dcebcbf64623d29"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/8d00250cba25728373e92c1d8dcebcbf64623d29",
"reference": "8d00250cba25728373e92c1d8dcebcbf64623d29",
"shasum": ""
},
"require": {
"barryvdh/reflection-docblock": "^2.4",
"composer/class-map-generator": "^1.0",
"ext-json": "*",
"illuminate/console": "^11.15 || ^12",
"illuminate/database": "^11.15 || ^12",
"illuminate/filesystem": "^11.15 || ^12",
"illuminate/support": "^11.15 || ^12",
"php": "^8.2"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"friendsofphp/php-cs-fixer": "^3",
"illuminate/config": "^11.15 || ^12",
"illuminate/view": "^11.15 || ^12",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^9.2 || ^10",
"phpunit/phpunit": "^10.5 || ^11.5.3",
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
"vimeo/psalm": "^5.4",
"vlucas/phpdotenv": "^5"
},
"suggest": {
"illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10|^11)."
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider"
]
},
"branch-alias": {
"dev-master": "3.5-dev"
}
},
"autoload": {
"psr-4": {
"Barryvdh\\LaravelIdeHelper\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Barry vd. Heuvel",
"email": "barryvdh@gmail.com"
}
],
"description": "Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.",
"keywords": [
"autocomplete",
"codeintel",
"dev",
"helper",
"ide",
"laravel",
"netbeans",
"phpdoc",
"phpstorm",
"sublime"
],
"support": {
"issues": "https://github.com/barryvdh/laravel-ide-helper/issues",
"source": "https://github.com/barryvdh/laravel-ide-helper/tree/v3.6.0"
},
"funding": [
{
"url": "https://fruitcake.nl",
"type": "custom"
},
{
"url": "https://github.com/barryvdh",
"type": "github"
}
],
"time": "2025-07-17T20:11:57+00:00"
},
{
"name": "barryvdh/reflection-docblock",
"version": "v2.4.0",
"source": {
"type": "git",
"url": "https://github.com/barryvdh/ReflectionDocBlock.git",
"reference": "d103774cbe7e94ddee7e4870f97f727b43fe7201"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/barryvdh/ReflectionDocBlock/zipball/d103774cbe7e94ddee7e4870f97f727b43fe7201",
"reference": "d103774cbe7e94ddee7e4870f97f727b43fe7201",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "^8.5.14|^9"
},
"suggest": {
"dflydev/markdown": "~1.0",
"erusev/parsedown": "~1.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
}
},
"autoload": {
"psr-0": {
"Barryvdh": [
"src/"
]
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mike van Riel",
"email": "mike.vanriel@naenius.com"
}
],
"support": {
"source": "https://github.com/barryvdh/ReflectionDocBlock/tree/v2.4.0"
},
"time": "2025-07-17T06:07:30+00:00"
},
{
"name": "brianium/paratest",
"version": "v7.15.0",
@ -6589,6 +6735,154 @@
],
"time": "2025-11-30T08:08:11+00:00"
},
{
"name": "composer/class-map-generator",
"version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/composer/class-map-generator.git",
"reference": "2373419b7709815ed323ebf18c3c72d03ff4a8a6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/class-map-generator/zipball/2373419b7709815ed323ebf18c3c72d03ff4a8a6",
"reference": "2373419b7709815ed323ebf18c3c72d03ff4a8a6",
"shasum": ""
},
"require": {
"composer/pcre": "^2.1 || ^3.1",
"php": "^7.2 || ^8.0",
"symfony/finder": "^4.4 || ^5.3 || ^6 || ^7 || ^8"
},
"require-dev": {
"phpstan/phpstan": "^1.12 || ^2",
"phpstan/phpstan-deprecation-rules": "^1 || ^2",
"phpstan/phpstan-phpunit": "^1 || ^2",
"phpstan/phpstan-strict-rules": "^1.1 || ^2",
"phpunit/phpunit": "^8",
"symfony/filesystem": "^5.4 || ^6 || ^7 || ^8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\ClassMapGenerator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "https://seld.be"
}
],
"description": "Utilities to scan PHP code and generate class maps.",
"keywords": [
"classmap"
],
"support": {
"issues": "https://github.com/composer/class-map-generator/issues",
"source": "https://github.com/composer/class-map-generator/tree/1.7.0"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
}
],
"time": "2025-11-19T10:41:15+00:00"
},
{
"name": "composer/pcre",
"version": "3.3.2",
"source": {
"type": "git",
"url": "https://github.com/composer/pcre.git",
"reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e",
"reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0"
},
"conflict": {
"phpstan/phpstan": "<1.11.10"
},
"require-dev": {
"phpstan/phpstan": "^1.12 || ^2",
"phpstan/phpstan-strict-rules": "^1 || ^2",
"phpunit/phpunit": "^8 || ^9"
},
"type": "library",
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
},
"branch-alias": {
"dev-main": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Composer\\Pcre\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"description": "PCRE wrapping library that offers type-safe preg_* replacements.",
"keywords": [
"PCRE",
"preg",
"regex",
"regular expression"
],
"support": {
"issues": "https://github.com/composer/pcre/issues",
"source": "https://github.com/composer/pcre/tree/3.3.2"
},
"funding": [
{
"url": "https://packagist.com",
"type": "custom"
},
{
"url": "https://github.com/composer",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/composer/composer",
"type": "tidelift"
}
],
"time": "2024-11-12T16:29:46+00:00"
},
{
"name": "doctrine/deprecations",
"version": "1.1.5",
@ -9840,5 +10134,5 @@
"platform-dev": {
"ext-curl": "*"
},
"plugin-api-version": "2.6.0"
"plugin-api-version": "2.9.0"
}

3
need
View File

@ -1,3 +0,0 @@
bot gens api token
api token with link to access the page

View File

@ -27,7 +27,8 @@ rules([
],
]);
mount(function ($token) {
mount(function ($token): null
{
$this->token = $token;
if ($this->token) {
$this->participant = Participant::findByToken($this->token);
@ -50,7 +51,8 @@ mount(function ($token) {
}
});
$saveEditingPrompt = function () {
$saveEditingPrompt = function (): null
{
if ($this->participant) {
$this->validate();
@ -60,12 +62,14 @@ $saveEditingPrompt = function () {
}
};
$cancelEditingPrompt = function () {
$cancelEditingPrompt = function (): null
{
$this->prompt = $this->participant->prompt ?? '';
$this->isEditingPrompt = false;
};
$saveEditingSubmission = function () {
$saveEditingSubmission = function (): null
{
if ($this->participant) {
$this->validate();
@ -75,7 +79,8 @@ $saveEditingSubmission = function () {
}
};
$cancelEditingSubmission = function () {
$cancelEditingSubmission = function (): null
{
$this->submissionUrl = $this->participant->submission_url ?? '';
$this->isEditingSubmission = false;
};
@ -206,7 +211,7 @@ $cancelEditingSubmission = function () {
@endif
</div>
<a
href="/withdraw"
href="/withdraw/{{$token}}"
>
Withdraw from Secret Sketchers...
</a>

View File

@ -1 +1,351 @@
<?php
use App\Models\Participant;
use App\Services\PostService;
use Illuminate\Support\Facades\Log;
use function Livewire\Volt\{state, mount, rules};
state(['token']);
state([
'participant' => null,
]);
mount(function ($token): null
{
$this->token = $token;
if ($this->token) {
$this->participant = Participant::findByToken($this->token);
}
});
$confirmWithdrawal = function (): null
{
$this->js(<<<'JS'
if (confirm('Are you sure you want to withdraw from the event? This action cannot be undone.')) {
$wire.call('withdraw');
}
JS);
};
$withdraw = function (): mixed
{
if($this->participant->withdraw()) {
$this->js('alert("Withdrawal complete")');
return $this->redirect('/', navigate: true);
}
else {
$this->js('alert("Something went wrong")');
return null;
}
};
?>
<div>
<h1>Withdraw from the event?</h1>
<button
wire:click="confirmWithdrawal"
class=""
>
Withdraw
</button>
<style>
.user-profile {
display: flex;
align-items: center;
padding: 15px;
background-color: rgba(0,0,0,0.3);
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
max-width: 100%;
margin: 15px;
}
.other-content {
display: block;
padding: 15px;
background-color: rgba(0,0,0,0.3);
border-radius: 12px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
max-width: 100%;
margin: 15px;
}
/* Add spacing below the main prompt text */
.prompt-content {
margin-bottom: 10px;
}
/* Reset H2 margin for better spacing */
.prompt-content h2 {
margin-top: 5px;
margin-bottom: 5px;
}
.avatar-container {
width: 60px;
height: 60px;
border-radius: 50%;
overflow: hidden;
margin-right: 15px;
background-color: #ccc;
flex-shrink: 0;
}
.avatar-container img {
width: 100%;
height: 100%;
object-fit: cover;
}
.username-container {
flex-grow: 1;
min-width: 0;
}
.username-container h1 {
margin: 0;
font-size: 1.2em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
body {
background-color: #222;
margin: 10pt;
font-family: sans-serif;
color: white;
overflow: hidden;
}
#viewer {
width: 100vw;
height: 100vh;
background-color: #222;
background-image: url("image/su.png");
background-repeat: no-repeat;
background-size: 400px;
background-position: center;
image-rendering: pixelated;
}
.r6o-editor {
z-index: 3;
height: auto;
}
.r6o-widget.comment {
font-size: 1.5em;
background-color: #333
}
.r6o-editor .r6o-arrow:after {
background-color: #333;
border: 3px white solid;
}
.r6o-editor .r6o-editor-inner .r6o-widget {
border: 3px white solid;
}
.r6o-editor .r6o-editor-inner {
background-color: transparent !important;
}
.r6o-footer {
display: none;
}
div {
color: white;
}
a {
color: white;
font-weight: bold;
}
#here-now {
position: fixed;
bottom: 0;
left: 0;
font-size: 1.5vh;
color: white;
padding: 15px;
z-index: 2;
background-color:#333;
border-radius: 1rem;
border: 3px solid white;
margin: 5pt;
}
#question {
font-size: 3vh;
width: 3vh;
height: 3vh;
position: fixed;
bottom: 0;
right: 0;
background-color: #333;
color: #fff;
border: 3px solid white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
padding: 15px;
margin: 10px;
}
#question img {
max-width: 100%;
height: auto;
display: block;
}
#modal-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 3;
}
#banner {
max-width: 100%;
}
#modal {
display: none;
font-size: 18pt;
position: fixed;
top: 50%;
opacity: 0;
transition: opacity 0.3s ease-in-out;
left: 50%;
transform: translate(-50%, -50%);
justify-content: center;
border-radius: 1rem;
box-shadow: 0 0 10px 10px #000;
background-color: #333;
align-items: center;
z-index: 4;
width: 80%;
height: 80%;
overflow-y: auto;
}
#modal-content {
position: relative;
padding: 33px;
text-align: center;
max-height: 100%;
font-size: 15pt;
}
@keyframes animateBg {
0% {
background-position: 0 0;
}
100% {
background-position: 100% 0;
}
}
.rainbow {
background: linear-gradient(90deg, #f1672b, #fea419, #efd515, #89d842, #35c2f9, #9b5fe0, #ff68cf, #f1672b, #fea419, #efd515, #89d842, #35c2f9, #9b5fe0, #ff68cf, #f1672b, #fea419, #efd515, #89d842, #35c2f9, #9b5fe0, #ff68cf, #f1672b);
background-size: 300% 100%;
-webkit-background-clip: text;
animation: animateBg 5s infinite linear;
background-clip: text;
color: transparent;
}
.profile-container {
display:flex;
align-items: center;
}
.profileimg {
flex: 0 0 20%; /* 10% of the container's width, not flexible, not growing, not shrinking */
max-height: 100%;
}
.profileimg img {
width: 100%; /* Make sure the image fills its container */
height: auto; /* Maintain aspect ratio */
border-radius: 50%;
}
.profile {
flex: 1; /* Take up remaining space */
padding-left: 1rem; /* Add some space between image and text */
}
#close-button {
position: absolute;
font-size: 3rem;
top: 15px;
right: 30px;
cursor: pointer;
width: 3vh;
height: 3vh;
background-color: #333;
color: #fff;
border: 3px solid white;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
padding: 15px;
margin: 10px;
}
#open-button {
cursor: pointer;
}
#mobile-banner {
display:none;
}
@media screen and (max-width: 1081px) and (-webkit-min-device-pixel-ratio: 2) {
#viewer {
width: 100vw;
height: 66vh;
border-bottom: 3px white solid;
}
#modal-content {
font-size: 20pt;
}
#container {
display: flex;
height: 100vh;
align-items: center;
justify-content: center;
}
#mobile-banner {
display: flex;
justify-content: center;
align-items: center;
box-sizing: border-box;
height: 27vh;
overflow: hidden;
background-color: #444;
}
#mobile-banner img {
max-width: 90%;
max-height: 100%;
}
}</style>
</div>

View File

@ -10,4 +10,4 @@ Route::get('/', function () {
Volt::route('start', 'pages.start')->name('start');
Volt::route('table', 'pages.table')->name('table');
Volt::route('profile/{token}', 'pages.profile')->name('profile');
Volt::route('withdraw', 'pages.withdraw')->name('withdraw');
Volt::route('withdraw/{token}', 'pages.withdraw')->name('withdraw');