Skip to content

Commit 65118fe

Browse files
authored
Fix promo code input styles (#395)
1 parent 13d2284 commit 65118fe

File tree

7 files changed

+36
-61
lines changed

7 files changed

+36
-61
lines changed

backend/app/Http/Actions/Auth/LoginAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function __invoke(LoginRequest $request): JsonResponse
2626
$loginResponse = $this->loginHandler->handle(new LoginCredentialsDTO(
2727
email: strtolower($request->validated('email')),
2828
password: $request->validated('password'),
29-
accountId: $request->validated('account_id'),
29+
accountId: (int)$request->validated('account_id'),
3030
));
3131
} catch (UnauthorizedException $e) {
3232
return $this->errorResponse(

backend/app/Http/Actions/Auth/RefreshTokenAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ class RefreshTokenAction extends BaseAuthAction
88
{
99
public function __invoke(): JsonResponse
1010
{
11-
return $this->respondWithToken(auth()->refresh(), auth()->user()->accounts);
11+
return $this->respondWithToken(auth()->refresh(), $this->getAuthenticatedUser()->accounts ?? collect());
1212
}
1313
}

backend/app/Http/Actions/Users/DeactivateUsersAction.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

backend/routes/api.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@
110110
use HiEvents\Http\Actions\Users\ConfirmEmailAddressAction;
111111
use HiEvents\Http\Actions\Users\ConfirmEmailChangeAction;
112112
use HiEvents\Http\Actions\Users\CreateUserAction;
113-
use HiEvents\Http\Actions\Users\DeactivateUsersAction;
114113
use HiEvents\Http\Actions\Users\DeleteInvitationAction;
115114
use HiEvents\Http\Actions\Users\GetMeAction;
116115
use HiEvents\Http\Actions\Users\GetUserAction;
@@ -164,7 +163,6 @@ function (Router $router): void {
164163
$router->get('/users', GetUsersAction::class);
165164
$router->get('/users/{user_id}', GetUserAction::class);
166165
$router->put('/users/{user_id}', UpdateUserAction::class);
167-
$router->delete('/users/{user_id}', DeactivateUsersAction::class);
168166
$router->post('/users/{user_id}/email-change/{token}', ConfirmEmailChangeAction::class);
169167
$router->post('/users/{user_id}/invitation', ResendInvitationAction::class);
170168
$router->delete('/users/{user_id}/invitation', DeleteInvitationAction::class);

backend/vapor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ environments:
44
production:
55
gateway-version: 2.0
66
domain: api.hi.events
7-
memory: 1408
7+
memory: 2048
88
cli-memory: 512
99
runtime: 'php-8.3:al2'
1010
warm: 3

frontend/src/components/routes/product-widget/SelectProducts/index.tsx

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -451,24 +451,34 @@ const SelectProducts = (props: SelectProductsProps) => {
451451
</ActionIcon>
452452
</div>
453453
)}
454+
455+
{(showPromoCodeInput && !form.values.promo_code) && (
456+
<Group className={'hi-promo-code-input-wrapper'} wrap={'nowrap'} gap={'20px'}>
457+
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
458+
{/*@ts-ignore*/}
459+
<TextInput autoFocus classNames={{input: 'hi-promo-code-input'}} onKeyDown={(event) => {
460+
if (event.key === 'Enter') {
461+
event.preventDefault();
462+
handleApplyPromoCode();
463+
}
464+
}} mb={0} ref={promoRef}/>
465+
<Button disabled={promoCodeEventRefetchMutation.isPending}
466+
className={'hi-apply-promo-code-button'} variant={'outline'}
467+
onClick={handleApplyPromoCode}>
468+
{t`Apply Promo Code`}
469+
</Button>
470+
<ActionIcon
471+
className={'hi-close-promo-code-input-button'}
472+
variant="transparent"
473+
aria-label={t`close`}
474+
title={t`Close`}
475+
onClick={() => setShowPromoCodeInput(false)}
476+
>
477+
<IconX stroke={1.5} size={20}/>
478+
</ActionIcon>
479+
</Group>
480+
)}
454481
</div>
455-
{(showPromoCodeInput && !form.values.promo_code) && (
456-
<Group className={'hi-promo-code-input-wrapper'} wrap={'nowrap'} gap={'20px'}>
457-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
458-
{/*@ts-ignore*/}
459-
<TextInput autoFocus classNames={{input: 'hi-promo-code-input'}} onKeyDown={(event) => {
460-
if (event.key === 'Enter') {
461-
event.preventDefault();
462-
handleApplyPromoCode();
463-
}
464-
}} mb={0} ref={promoRef}/>
465-
<Button disabled={promoCodeEventRefetchMutation.isPending}
466-
className={'hi-apply-promo-code-button'} variant={'outline'}
467-
onClick={handleApplyPromoCode}>
468-
{t`Apply Promo Code`}
469-
</Button>
470-
</Group>
471-
)}
472482
{
473483
/**
474484
* (c) Hi.Events Ltd 2025

frontend/src/styles/widget/default.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@
177177
border: none;
178178
}
179179

180+
.hi-close-promo-code-input-button {
181+
background-color: var(--widget-secondary-color, var(--tk-primary));
182+
color: var(--widget-secondary-text-color, var(--tk-color-white));
183+
border: none;
184+
}
185+
180186
.hi-promo-code-applied {
181187
display: flex;
182188
align-items: center;

0 commit comments

Comments
 (0)