mirror of
https://github.com/polaroi8d/cactoide.git
synced 2026-03-22 14:15:28 +00:00
Compare commits
74 Commits
fix/remove
...
fix/edit-e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7692f9d503 | ||
|
|
baf3fcd923 | ||
|
|
5468bc7cb2 | ||
|
|
0afe331cab | ||
|
|
fa9a79192c | ||
|
|
7275084ab9 | ||
|
|
02975a0abd | ||
|
|
aebe477f90 | ||
|
|
325237d414 | ||
|
|
24e9d8b626 | ||
|
|
05556eefdb | ||
|
|
2273ae50a4 | ||
|
|
e75c7e40dc | ||
|
|
2a96d3762c | ||
|
|
935042dd06 | ||
|
|
5809cb49ee | ||
|
|
93b0bac48a | ||
|
|
c9c78d0ea6 | ||
|
|
f6b51232a7 | ||
|
|
bb573c603a | ||
|
|
75fa7a9528 | ||
|
|
eb5543fb9b | ||
|
|
706e6cf712 | ||
|
|
c6decaa0d1 | ||
|
|
d193283b11 | ||
|
|
accfd540f0 | ||
|
|
9b1ef64618 | ||
|
|
c340088434 | ||
|
|
984c296725 | ||
|
|
9acfa08ea8 | ||
|
|
45cb95f6a8 | ||
|
|
8426bd5704 | ||
|
|
b9833db3bb | ||
|
|
b3572293ba | ||
|
|
c1752efe4b | ||
|
|
491d0020bd | ||
|
|
5c1182dc66 | ||
|
|
638b5ff1ca | ||
|
|
069ca11917 | ||
|
|
4675fa4623 | ||
|
|
af88d6462b | ||
|
|
ef6005e648 | ||
|
|
11875b4a1e | ||
|
|
22038f7779 | ||
|
|
de2cb07a15 | ||
|
|
ffc29b9c24 | ||
|
|
4860b9439c | ||
|
|
d10af13134 | ||
|
|
c98260efec | ||
|
|
a40b83c2b3 | ||
|
|
bfb76aa268 | ||
|
|
f8758d7b47 | ||
|
|
f51f89e35f | ||
|
|
26824eb3a8 | ||
|
|
d2024d31ba | ||
|
|
cc3c868f7d | ||
|
|
69a760d3f1 | ||
|
|
a59bc3601c | ||
|
|
b64d48a933 | ||
|
|
1a5eff4dbd | ||
|
|
1bbc4b590f | ||
|
|
a2dde83c57 | ||
|
|
f66fd03d70 | ||
|
|
8d01000ed4 | ||
|
|
02bec483af | ||
|
|
0567c5bfae | ||
|
|
b5df1479dd | ||
|
|
1d523c4b88 | ||
|
|
8176b2317f | ||
|
|
e20018735e | ||
|
|
bd9796a8d1 | ||
|
|
7d1991eb94 | ||
|
|
6020a78302 | ||
|
|
f8b122ed45 |
13
.env.docker.example
Normal file
13
.env.docker.example
Normal file
@@ -0,0 +1,13 @@
|
||||
# Postgres configuration
|
||||
POSTGRES_DB=cactoide_database
|
||||
POSTGRES_USER=cactoide
|
||||
POSTGRES_PASSWORD=cactoide_password
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
# Application configuration
|
||||
DATABASE_URL="postgres://cactoide:cactoide_password@postgres:5432/cactoide_database"
|
||||
APP_VERSION=latest
|
||||
PORT=5173
|
||||
HOSTNAME=0.0.0.0
|
||||
|
||||
PUBLIC_LANDING_INFO=true
|
||||
10
.env.example
10
.env.example
@@ -4,12 +4,10 @@ POSTGRES_USER=cactoide
|
||||
POSTGRES_PASSWORD=cactoide_password
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
# localhost
|
||||
DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoide_database"
|
||||
# docker
|
||||
# DATABASE_URL="postgres://cactoide:cactoide_password@postgres:5432/cactoide_database"
|
||||
|
||||
# Application configuration
|
||||
DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoide_database"
|
||||
APP_VERSION=latest
|
||||
PORT=3000
|
||||
PORT=5173
|
||||
HOSTNAME=0.0.0.0
|
||||
|
||||
PUBLIC_LANDING_INFO=true
|
||||
|
||||
4
.github/workflows/build-and-push.yml
vendored
4
.github/workflows/build-and-push.yml
vendored
@@ -60,6 +60,10 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
build-args: |
|
||||
PUBLIC_LANDING_INFO=${{ vars.PUBLIC_LANDING_INFO }}
|
||||
LOG_PRETTY=${{ vars.LOG_PRETTY }}
|
||||
LOG_LEVEL=${{ vars.LOG_LEVEL }}
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
|
||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@@ -28,6 +28,10 @@ jobs:
|
||||
|
||||
- name: Build application
|
||||
run: npm run build
|
||||
env:
|
||||
PUBLIC_LANDING_INFO: ${{ vars.PUBLIC_LANDING_INFO }}
|
||||
LOG_PRETTY: ${{ vars.LOG_PRETTY }}
|
||||
LOG_LEVEL: ${{ vars.LOG_LEVEL }}
|
||||
|
||||
- name: Test build output
|
||||
run: |
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -17,6 +17,7 @@ Thumbs.db
|
||||
.env.*
|
||||
!.env.example
|
||||
!.env.test
|
||||
!.env.docker.example
|
||||
|
||||
# Vite
|
||||
vite.config.js.timestamp-*
|
||||
|
||||
14
Dockerfile
14
Dockerfile
@@ -3,25 +3,33 @@ WORKDIR /app
|
||||
COPY package*.json .
|
||||
|
||||
RUN npm ci
|
||||
|
||||
ARG PUBLIC_LANDING_INFO
|
||||
ENV PUBLIC_LANDING_INFO=$PUBLIC_LANDING_INFO
|
||||
|
||||
ARG LOG_PRETTY
|
||||
ENV LOG_PRETTY=$LOG_PRETTY
|
||||
|
||||
ARG LOG_LEVEL
|
||||
ENV LOG_LEVEL=$LOG_LEVEL
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
|
||||
FROM node:20-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/build build/
|
||||
COPY --from=builder /app/node_modules node_modules/
|
||||
COPY package.json .
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT 3000
|
||||
ENV HOSTNAME "0.0.0.0"
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/healthz || exit 1
|
||||
|
||||
EXPOSE 3000
|
||||
CMD [ "node", "build" ]
|
||||
|
||||
674
LICENSE
674
LICENSE
@@ -1,21 +1,661 @@
|
||||
MIT License
|
||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (c) 2025 polaroi8d
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Preamble
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
90
Makefile
90
Makefile
@@ -1,21 +1,54 @@
|
||||
.PHONY: help build up db-only logs db-clean prune
|
||||
.PHONY: help build up down db-only logs db-clean prune i18n lint format migrate-up migrate-down
|
||||
|
||||
# Database connection variables
|
||||
DB_HOST ?= localhost
|
||||
DB_PORT ?= 5432
|
||||
DB_NAME ?= cactoide_database
|
||||
DB_USER ?= cactoide
|
||||
DB_PASSWORD ?= cactoide_password
|
||||
|
||||
# Migration variables
|
||||
MIGRATIONS_DIR = database/migrations
|
||||
|
||||
# Database connection string
|
||||
DB_URL = postgresql://$(DB_USER):$(DB_PASSWORD)@$(DB_HOST):$(DB_PORT)/$(DB_NAME)
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@echo "Cactoide Commands"
|
||||
@echo ""
|
||||
@echo "Main commands:"
|
||||
@echo " make build - Build the Docker images"
|
||||
@echo " make up - Start all services (database + app)"
|
||||
@echo ""
|
||||
@echo "Individual services:"
|
||||
@echo " make db-only - Start only the database"
|
||||
@echo ""
|
||||
@echo "Utility commands:"
|
||||
@echo " make logs - Show logs from all services"
|
||||
@echo " make db-clean - Stop & remove database container"
|
||||
@echo " make prune - Remove all containers, images, and volumes"
|
||||
@echo " make help - Show this help message"
|
||||
@echo "Available commands:"
|
||||
@echo " build - Docker build the application"
|
||||
@echo " up - Start all services"
|
||||
@echo " down - Stop all services"
|
||||
@echo " db-only - Start only the database"
|
||||
@echo " logs - Show logs from all services"
|
||||
@echo " db-clean - Clean up all Docker resources"
|
||||
@echo " prune - Clean up everything (containers, images, volumes)"
|
||||
@echo " i18n - Validate translation files"
|
||||
@echo " lint - Lint the project"
|
||||
@echo " format - Format the project"
|
||||
@echo " migrate-up - Apply invite-only events migration"
|
||||
@echo " migrate-down - Rollback invite-only events migration"
|
||||
|
||||
# Apply invite-only events migration
|
||||
migrate-up:
|
||||
@echo "Applying invite-only events migration..."
|
||||
@if [ -f "$(MIGRATIONS_DIR)/20241220_001_add_invite_only_events.sql" ]; then \
|
||||
psql "$(DB_URL)" -f "$(MIGRATIONS_DIR)/20241220_001_add_invite_only_events.sql" && \
|
||||
echo "Migration applied successfully!"; \
|
||||
else \
|
||||
echo "Migration file not found: $(MIGRATIONS_DIR)/20241220_001_add_invite_only_events.sql"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Rollback invite-only events migration
|
||||
migrate-down:
|
||||
@echo "Rolling back invite-only events migration..."
|
||||
@if [ -f "$(MIGRATIONS_DIR)/20241220_001_add_invite_only_events_rollback.sql" ]; then \
|
||||
psql "$(DB_URL)" -f "$(MIGRATIONS_DIR)/20241220_001_add_invite_only_events_rollback.sql" && \
|
||||
echo "Migration rolled back successfully!"; \
|
||||
else \
|
||||
echo "Rollback file not found: $(MIGRATIONS_DIR)/20241220_001_add_invite_only_events_rollback.sql"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Build the Docker images
|
||||
build:
|
||||
@@ -27,6 +60,14 @@ up:
|
||||
@echo "Starting all services..."
|
||||
docker compose up -d
|
||||
|
||||
down:
|
||||
@echo "Stopping all services..."
|
||||
docker compose down
|
||||
|
||||
db-clean:
|
||||
@echo "Cleaning up all Docker resources..."
|
||||
docker stop cactoide-db && docker rm cactoide-db && docker volume prune -f && docker network prune -f
|
||||
|
||||
# Start only the database
|
||||
db-only:
|
||||
@echo "Starting only the database..."
|
||||
@@ -37,9 +78,7 @@ logs:
|
||||
@echo "Showing logs from all services..."
|
||||
docker compose logs -f
|
||||
|
||||
db-clean:
|
||||
@echo "Cleaning up all Docker resources..."
|
||||
docker stop cactoide-db && docker rm cactoide-db && docker volume prune -f && docker network prune -f
|
||||
|
||||
|
||||
# Clean up everything (containers, images, volumes)
|
||||
prune:
|
||||
@@ -47,3 +86,16 @@ prune:
|
||||
docker compose down -v --rmi all
|
||||
|
||||
|
||||
lint:
|
||||
@echo "Linting the project..."
|
||||
npm run lint
|
||||
|
||||
format:
|
||||
@echo "Formatting the project..."
|
||||
npm run format
|
||||
|
||||
#TODO: not working yet
|
||||
i18n:
|
||||
@echo "Validating translation files..."
|
||||
@if [ -n "$(FILE)" ]; then \
|
||||
./scripts/i18n-check.sh $(FILE); \
|
||||
|
||||
49
README.md
49
README.md
@@ -21,6 +21,7 @@ A mobile-first event RSVP platform that lets you create events, share unique URL
|
||||
- **🎯 Instant Event Creation** - Create events in seconds with our streamlined form. No accounts, no waiting, just pure efficiency.
|
||||
- **🔗 One-Click Sharing** - Each event gets a unique, memorable URL. Share instantly via any platform or messaging app.
|
||||
- **🔍 All-in-One Clarity** - No more scrolling through endless chats and reactions. See everyone's availability and responses neatly in one place.
|
||||
- **📅 iCal Integration** - One-tap add-to-calendar via ICS/webcal links. Works with Apple Calendar, Google Calendar, and Outlook, with automatic time zone handling.
|
||||
- **👤 No Hassle, No Sign-Ups** - Skip registrations and endless forms. Unlike other event platforms, you create and share instantly — no accounts, no barriers.
|
||||
- **🛡️ Smart Limits** - Choose between unlimited RSVPs or set a limited capacity. Perfect for any event size.
|
||||
- **✨ Effortless Simplicity** - Designed to be instantly clear and easy. No learning curve — just open, create, and go.
|
||||
@@ -29,14 +30,14 @@ A mobile-first event RSVP platform that lets you create events, share unique URL
|
||||
|
||||
#### Requirements
|
||||
|
||||
`git, docker, docker-compose, node at least suggested 20.19.0`
|
||||
`git`, `docker`, `docker-compose`, `node` at least suggested 20.19.0
|
||||
|
||||
Uses the [`docker-compose.yml`](docker-compose.yml) file to setup the application with the database. You can define all ENV variables in the [`.env`](.env.example) file from the `.env.example`.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/polaroi8d/cactoide/
|
||||
cd cactoide
|
||||
cp env.example .env
|
||||
cp .env.docker.example .env
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
@@ -45,7 +46,7 @@ docker compose up -d
|
||||
```bash
|
||||
git clone https://github.com/polaroi8d/cactoide/
|
||||
cd cactoide
|
||||
cp env.example .env
|
||||
cp .env.example .env
|
||||
make db-only
|
||||
npm run dev -- --open
|
||||
```
|
||||
@@ -54,8 +55,48 @@ Your app will be available at `http://localhost:5173`. You can use the Makefile
|
||||
|
||||
Use the `database/seed.sql` if you want to populate your database with dummy data.
|
||||
|
||||
### Options
|
||||
|
||||
#### 1. Landing page option
|
||||
|
||||
Supports a conditional landing page display based on the `PUBLIC_LANDING_INFO` environment variable. If you don't want to show your users the cactoide landing page, just use the `PUBLIC_LANDING_INFO=false` variable. This will automatically remove the landing home page and redirect users to the `/discover` page.
|
||||
|
||||
This is useful for:
|
||||
|
||||
- Creating a minimal discovery-focused experience
|
||||
- Customizing the user journey based on deployment environment
|
||||
|
||||
#### 2. i18n
|
||||
|
||||
There is no proper i18n implemented, we have an `/i18n` folder with specific languages. To use an existing translation, just rename the language code JSON file to `messages.json` and you are ready to go. If you would like to add a new translation (which is really appreciated), just create a new `<language_code>.json` file and add the translations from the `messages.json`.
|
||||
|
||||
The project includes a translation validation script to ensure all translation files are complete and up-to-date with the source `messages.json` file.
|
||||
|
||||
```bash
|
||||
# Validate all translation files
|
||||
make i18n
|
||||
```
|
||||
|
||||
```bash
|
||||
# Validate a specific translation file
|
||||
make i18n FILE=src/lib/i18n/it.json
|
||||
```
|
||||
|
||||
### Support
|
||||
|
||||
Cactoide is an open-source project licensed under `AGPL-3.0`. Its growth and development are possible thanks to the amazing support of the community. This project is the result of many late nights, weekends, and after-hours work.
|
||||
|
||||
It isn’t backed by a big company. Development depends on the support and generosity of people like you. With your help, I can focus more on making Cactoide even better and building tools that make coding more enjoyable.
|
||||
|
||||
You can support in a few ways:
|
||||
|
||||
- Send a one-time donation via [paypal.me/zenoazurben](paypal.me/zenoazurben)
|
||||
- Reach me directly: leventeorb[@]gmail.com
|
||||
|
||||
If you enjoy using Cactoide, or if your business depends on it, please consider sponsoring its development. Your support keeps the project alive, improves it for everyone, and helps create educational content like blog posts and videos for the whole Cactoide community.
|
||||
|
||||
### License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
||||
This project is licensed under the `AGPL-3.0 License` - see the [LICENSE](./LICENSE) file for details.
|
||||
|
||||
**Made with ❤️ by @polaroi8d**
|
||||
|
||||
@@ -14,6 +14,8 @@ CREATE TABLE IF NOT EXISTS events (
|
||||
date DATE NOT NULL,
|
||||
time TIME NOT NULL,
|
||||
location VARCHAR(200) NOT NULL,
|
||||
location_type VARCHAR(20) NOT NULL DEFAULT 'none' CHECK (location_type IN ('none','text','maps')),
|
||||
location_url VARCHAR(500),
|
||||
type VARCHAR(20) NOT NULL CHECK (type IN ('limited','unlimited')),
|
||||
attendee_limit INTEGER CHECK (attendee_limit > 0),
|
||||
user_id VARCHAR(100) NOT NULL,
|
||||
@@ -37,24 +39,8 @@ CREATE TABLE IF NOT EXISTS rsvps (
|
||||
-- =======================================
|
||||
CREATE INDEX IF NOT EXISTS idx_events_user_id ON events(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_events_date ON events(date);
|
||||
CREATE INDEX IF NOT EXISTS idx_events_location_type ON events(location_type);
|
||||
CREATE INDEX IF NOT EXISTS idx_rsvps_event_id ON rsvps(event_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_rsvps_user_id ON rsvps(user_id);
|
||||
|
||||
-- =======================================
|
||||
-- Triggers (updated_at maintenance)
|
||||
-- =======================================
|
||||
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = NOW();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
DROP TRIGGER IF EXISTS update_events_updated_at ON events;
|
||||
CREATE TRIGGER update_events_updated_at
|
||||
BEFORE UPDATE ON events
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_updated_at_column();
|
||||
|
||||
COMMIT;
|
||||
25
database/migrations/20241220_001_add_invite_only_events.sql
Normal file
25
database/migrations/20241220_001_add_invite_only_events.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- Migration: Add invite-only events feature
|
||||
-- Created: 2024-12-20
|
||||
-- Description: Adds invite-only visibility option and invite tokens table
|
||||
|
||||
-- Add 'invite-only' to the visibility enum
|
||||
ALTER TABLE events
|
||||
DROP CONSTRAINT IF EXISTS events_visibility_check;
|
||||
|
||||
ALTER TABLE events
|
||||
ADD CONSTRAINT events_visibility_check
|
||||
CHECK (visibility IN ('public', 'private', 'invite-only'));
|
||||
|
||||
-- Create invite_tokens table
|
||||
CREATE TABLE IF NOT EXISTS invite_tokens (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
event_id VARCHAR(8) NOT NULL REFERENCES events(id) ON DELETE CASCADE,
|
||||
token VARCHAR(32) NOT NULL UNIQUE,
|
||||
expires_at TIMESTAMPTZ NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Create indexes for invite_tokens table
|
||||
CREATE INDEX IF NOT EXISTS idx_invite_tokens_event_id ON invite_tokens(event_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_invite_tokens_token ON invite_tokens(token);
|
||||
CREATE INDEX IF NOT EXISTS idx_invite_tokens_expires_at ON invite_tokens(expires_at);
|
||||
@@ -0,0 +1,17 @@
|
||||
-- Rollback Migration: Remove invite-only events feature
|
||||
-- Created: 2024-12-20
|
||||
-- Description: Removes invite-only visibility option and invite tokens table
|
||||
|
||||
-- Drop invite_tokens table and its indexes
|
||||
DROP INDEX IF EXISTS idx_invite_tokens_expires_at;
|
||||
DROP INDEX IF EXISTS idx_invite_tokens_token;
|
||||
DROP INDEX IF EXISTS idx_invite_tokens_event_id;
|
||||
DROP TABLE IF EXISTS invite_tokens;
|
||||
|
||||
-- Revert visibility enum to original values
|
||||
ALTER TABLE events
|
||||
DROP CONSTRAINT IF EXISTS events_visibility_check;
|
||||
|
||||
ALTER TABLE events
|
||||
ADD CONSTRAINT events_visibility_check
|
||||
CHECK (visibility IN ('public', 'private'));
|
||||
431
package-lock.json
generated
431
package-lock.json
generated
@@ -1,16 +1,18 @@
|
||||
{
|
||||
"name": "event-cactus",
|
||||
"version": "0.0.1",
|
||||
"name": "cactoide",
|
||||
"version": "0.1.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "event-cactus",
|
||||
"version": "0.0.1",
|
||||
"name": "cactoide",
|
||||
"version": "0.1.1",
|
||||
"dependencies": {
|
||||
"@sveltejs/adapter-node": "^5.3.1",
|
||||
"drizzle-orm": "^0.44.5",
|
||||
"fuse.js": "^7.1.0",
|
||||
"pino": "^10.1.0",
|
||||
"pino-pretty": "^13.1.2",
|
||||
"postgres": "^3.4.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -22,7 +24,12 @@
|
||||
"@tailwindcss/forms": "^0.5.9",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
<<<<<<< HEAD
|
||||
"drizzle-kit": "^0.31.5",
|
||||
=======
|
||||
"@types/node": "^24.9.1",
|
||||
"drizzle-kit": "^0.31.4",
|
||||
>>>>>>> 222c2ee (feat: add pino logger for serverside)
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
"eslint-plugin-svelte": "^3.0.0",
|
||||
@@ -35,7 +42,7 @@
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"vite": "^7.0.4"
|
||||
"vite": "^7.1.11"
|
||||
}
|
||||
},
|
||||
"node_modules/@drizzle-team/brocli": {
|
||||
@@ -1231,6 +1238,12 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@pinojs/redact": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",
|
||||
"integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@polka/url": {
|
||||
"version": "1.0.0-next.29",
|
||||
"resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.29.tgz",
|
||||
@@ -1643,6 +1656,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.30.1.tgz",
|
||||
"integrity": "sha512-LyRpQmokZdMK4QOlGBbLX12c37IRnvC3rE6ysA4gLmBWMx5mheeEEjkZZXhtIL9Lze0BgMttaALFoROTx+kbEw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@standard-schema/spec": "^1.0.0",
|
||||
"@sveltejs/acorn-typescript": "^1.0.5",
|
||||
@@ -1675,6 +1689,7 @@
|
||||
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-6.1.2.tgz",
|
||||
"integrity": "sha512-7v+7OkUYelC2dhhYDAgX1qO2LcGscZ18Hi5kKzJQq7tQeXpH215dd0+J/HnX2zM5B3QKcIrTVqCGkZXAy5awYw==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@sveltejs/vite-plugin-svelte-inspector": "^5.0.0",
|
||||
"debug": "^4.4.1",
|
||||
@@ -1949,6 +1964,66 @@
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/core": {
|
||||
"version": "1.4.5",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.0.4",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/runtime": {
|
||||
"version": "1.4.5",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.0.4",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "0.2.12",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@emnapi/core": "^1.4.3",
|
||||
"@emnapi/runtime": "^1.4.3",
|
||||
"@tybys/wasm-util": "^0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/@tybys/wasm-util": {
|
||||
"version": "0.10.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-wasm32-wasi/node_modules/tslib": {
|
||||
"version": "2.8.0",
|
||||
"dev": true,
|
||||
"inBundle": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/@tailwindcss/oxide-win32-arm64-msvc": {
|
||||
"version": "4.1.12",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.1.12.tgz",
|
||||
@@ -2033,17 +2108,20 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz",
|
||||
"integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==",
|
||||
"version": "24.9.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.9.1.tgz",
|
||||
"integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==",
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.10.0"
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
},
|
||||
>>>>>>> 222c2ee (feat: add pino logger for serverside)
|
||||
"node_modules/@types/resolve": {
|
||||
"version": "1.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
|
||||
@@ -2096,6 +2174,7 @@
|
||||
"integrity": "sha512-pUXGCuHnnKw6PyYq93lLRiZm3vjuslIy7tus1lIQTYVK9bL8XBgJnCWm8a0KcTtHC84Yya1Q6rtll+duSMj0dg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "8.39.1",
|
||||
"@typescript-eslint/types": "8.39.1",
|
||||
@@ -2313,6 +2392,7 @@
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
|
||||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
@@ -2379,6 +2459,15 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/atomic-sleep": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
|
||||
"integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/axobject-query": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz",
|
||||
@@ -2508,6 +2597,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/colorette": {
|
||||
"version": "2.0.20",
|
||||
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
|
||||
"integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/commondir": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
|
||||
@@ -2558,6 +2653,15 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/dateformat": {
|
||||
"version": "4.6.3",
|
||||
"resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz",
|
||||
"integrity": "sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz",
|
||||
@@ -2602,15 +2706,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/devalue": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/devalue/-/devalue-5.1.1.tgz",
|
||||
"integrity": "sha512-maua5KUiapvEwiEAe+XnlZ3Rh0GD+qI1J/nb9vrJc3muPXvcF/8gXYTWF76+5DAqHyDUtOIImEuo0YKE9mshVw==",
|
||||
"version": "5.4.1",
|
||||
"resolved": "https://registry.npmjs.org/devalue/-/devalue-5.4.1.tgz",
|
||||
"integrity": "sha512-YtoaOfsqjbZQKGIMRYDWKjUmSB4VJ/RElB+bXZawQAQYAo4xu08GKTMVlsZDTF6R2MbAgjcAQRPI5eIyRAT2OQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/drizzle-kit": {
|
||||
"version": "0.31.4",
|
||||
"resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.4.tgz",
|
||||
"integrity": "sha512-tCPWVZWZqWVx2XUsVpJRnH9Mx0ClVOf5YUHerZ5so1OKSlqww4zy1R5ksEdGRcO3tM3zj0PYN6V48TbQCL1RfA==",
|
||||
"version": "0.31.5",
|
||||
"resolved": "https://registry.npmjs.org/drizzle-kit/-/drizzle-kit-0.31.5.tgz",
|
||||
"integrity": "sha512-+CHgPFzuoTQTt7cOYCV6MOw2w8vqEn/ap1yv4bpZOWL03u7rlVRQhUY0WYT3rHsgVTXwYQDZaSUJSQrMBUKuWg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -2748,6 +2852,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
|
||||
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/enhanced-resolve": {
|
||||
"version": "5.18.3",
|
||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.18.3.tgz",
|
||||
@@ -2768,6 +2881,7 @@
|
||||
"integrity": "sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
@@ -2835,6 +2949,7 @@
|
||||
"integrity": "sha512-TS9bTNIryDzStCpJN93aC5VRSW3uTx9sClUn4B87pwiCaJh220otoI0X8mJKr+VcPtniMdN8GKjlwgWGUv5ZKA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.12.1",
|
||||
@@ -3055,6 +3170,12 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-copy": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz",
|
||||
"integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
@@ -3106,6 +3227,12 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fast-safe-stringify": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
|
||||
"integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fastq": {
|
||||
"version": "1.19.1",
|
||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz",
|
||||
@@ -3304,6 +3431,12 @@
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/help-me": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz",
|
||||
"integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/ignore": {
|
||||
"version": "5.3.2",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
|
||||
@@ -3421,6 +3554,15 @@
|
||||
"jiti": "lib/jiti-cli.mjs"
|
||||
}
|
||||
},
|
||||
"node_modules/joycon": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz",
|
||||
"integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
@@ -3846,6 +3988,15 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
@@ -3934,6 +4085,24 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/on-exit-leak-free": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz",
|
||||
"integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/optionator": {
|
||||
"version": "0.9.4",
|
||||
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
|
||||
@@ -4041,6 +4210,79 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/pino": {
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/pino/-/pino-10.1.0.tgz",
|
||||
"integrity": "sha512-0zZC2ygfdqvqK8zJIr1e+wT1T/L+LF6qvqvbzEQ6tiMAoTqEVK9a1K3YRu8HEUvGEvNqZyPJTtb2sNIoTkB83w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pinojs/redact": "^0.4.0",
|
||||
"atomic-sleep": "^1.0.0",
|
||||
"on-exit-leak-free": "^2.1.0",
|
||||
"pino-abstract-transport": "^2.0.0",
|
||||
"pino-std-serializers": "^7.0.0",
|
||||
"process-warning": "^5.0.0",
|
||||
"quick-format-unescaped": "^4.0.3",
|
||||
"real-require": "^0.2.0",
|
||||
"safe-stable-stringify": "^2.3.1",
|
||||
"sonic-boom": "^4.0.1",
|
||||
"thread-stream": "^3.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"pino": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/pino-abstract-transport": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz",
|
||||
"integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"split2": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pino-pretty": {
|
||||
"version": "13.1.2",
|
||||
"resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-13.1.2.tgz",
|
||||
"integrity": "sha512-3cN0tCakkT4f3zo9RXDIhy6GTvtYD6bK4CRBLN9j3E/ePqN1tugAXD5rGVfoChW6s0hiek+eyYlLNqc/BG7vBQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"colorette": "^2.0.7",
|
||||
"dateformat": "^4.6.3",
|
||||
"fast-copy": "^3.0.2",
|
||||
"fast-safe-stringify": "^2.1.1",
|
||||
"help-me": "^5.0.0",
|
||||
"joycon": "^3.1.1",
|
||||
"minimist": "^1.2.6",
|
||||
"on-exit-leak-free": "^2.1.0",
|
||||
"pino-abstract-transport": "^2.0.0",
|
||||
"pump": "^3.0.0",
|
||||
"secure-json-parse": "^4.0.0",
|
||||
"sonic-boom": "^4.0.1",
|
||||
"strip-json-comments": "^5.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"pino-pretty": "bin.js"
|
||||
}
|
||||
},
|
||||
"node_modules/pino-pretty/node_modules/strip-json-comments": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.3.tgz",
|
||||
"integrity": "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/pino-std-serializers": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz",
|
||||
"integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.6",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz",
|
||||
@@ -4060,6 +4302,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -4182,6 +4425,7 @@
|
||||
"resolved": "https://registry.npmjs.org/postgres/-/postgres-3.4.7.tgz",
|
||||
"integrity": "sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw==",
|
||||
"license": "Unlicense",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -4206,6 +4450,7 @@
|
||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
@@ -4222,6 +4467,7 @@
|
||||
"integrity": "sha512-pn1ra/0mPObzqoIQn/vUTR3ZZI6UuZ0sHqMK5x2jMLGrs53h0sXhkVuDcrlssHwIMk7FYrMjHBPoUSyyEEDlBQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"peerDependencies": {
|
||||
"prettier": "^3.0.0",
|
||||
"svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0"
|
||||
@@ -4314,6 +4560,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/process-warning": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",
|
||||
"integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fastify"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fastify"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/pump": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz",
|
||||
"integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/punycode": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||
@@ -4345,6 +4617,12 @@
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/quick-format-unescaped": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz",
|
||||
"integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/readdirp": {
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
|
||||
@@ -4359,6 +4637,15 @@
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
},
|
||||
"node_modules/real-require": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",
|
||||
"integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.10",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz",
|
||||
@@ -4415,6 +4702,7 @@
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.46.2.tgz",
|
||||
"integrity": "sha512-WMmLFI+Boh6xbop+OAGo9cQ3OgX9MIg7xOQjn+pTCwOkk+FNDAeAemXkJ3HzDJrVXleLOFVa1ipuc1AmEx1Dwg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/estree": "1.0.8"
|
||||
},
|
||||
@@ -4485,6 +4773,31 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-stable-stringify": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
|
||||
"integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/secure-json-parse": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-4.1.0.tgz",
|
||||
"integrity": "sha512-l4KnYfEyqYJxDwlNVyRfO2E4NTHfMKAWdUuA8J0yve2Dz/E/PdBepY03RvyJpssIpRFwJoCD55wA+mEDs6ByWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/fastify"
|
||||
},
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/fastify"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.7.2",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
|
||||
@@ -4541,6 +4854,15 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/sonic-boom": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz",
|
||||
"integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"atomic-sleep": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
@@ -4571,6 +4893,15 @@
|
||||
"source-map": "^0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/split2": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
|
||||
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-json-comments": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
|
||||
@@ -4614,6 +4945,7 @@
|
||||
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.38.1.tgz",
|
||||
"integrity": "sha512-fO6CLDfJYWHgfo6lQwkQU2vhCiHc2MBl6s3vEhK+sSZru17YL4R5s1v14ndRpqKAIkq8nCz6MTk1yZbESZWeyQ==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/remapping": "^2.3.4",
|
||||
"@jridgewell/sourcemap-codec": "^1.5.0",
|
||||
@@ -4706,7 +5038,8 @@
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.1.12.tgz",
|
||||
"integrity": "sha512-DzFtxOi+7NsFf7DBtI3BJsynR+0Yp6etH+nRPTbpWnS2pZBaSksv/JGctNwSWzbFjp0vxSqknaUylseZqMDGrA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/tapable": {
|
||||
"version": "2.2.2",
|
||||
@@ -4736,14 +5069,23 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.14",
|
||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz",
|
||||
"integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==",
|
||||
"node_modules/thread-stream": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz",
|
||||
"integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fdir": "^6.4.4",
|
||||
"picomatch": "^4.0.2"
|
||||
"real-require": "^0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.15",
|
||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
||||
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fdir": "^6.5.0",
|
||||
"picomatch": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
@@ -4806,6 +5148,7 @@
|
||||
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -4839,12 +5182,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.10.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
|
||||
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
||||
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/uri-js": {
|
||||
"version": "4.4.1",
|
||||
@@ -4864,17 +5206,18 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.2.tgz",
|
||||
"integrity": "sha512-J0SQBPlQiEXAF7tajiH+rUooJPo0l8KQgyg4/aMunNtrOa7bwuZJsJbDWzeljqQpgftxuq5yNJxQ91O9ts29UQ==",
|
||||
"version": "7.1.11",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-7.1.11.tgz",
|
||||
"integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.25.0",
|
||||
"fdir": "^6.4.6",
|
||||
"fdir": "^6.5.0",
|
||||
"picomatch": "^4.0.3",
|
||||
"postcss": "^8.5.6",
|
||||
"rollup": "^4.43.0",
|
||||
"tinyglobby": "^0.2.14"
|
||||
"tinyglobby": "^0.2.15"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
@@ -4982,6 +5325,12 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
||||
@@ -4992,20 +5341,6 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz",
|
||||
"integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==",
|
||||
"license": "ISC",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"yaml": "bin.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14.6"
|
||||
}
|
||||
},
|
||||
"node_modules/yocto-queue": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cactoide",
|
||||
"private": true,
|
||||
"version": "0.0.3",
|
||||
"version": "0.1.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
@@ -22,6 +22,7 @@
|
||||
"@tailwindcss/forms": "^0.5.9",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@types/node": "^24.9.1",
|
||||
"drizzle-kit": "^0.31.4",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
@@ -35,12 +36,14 @@
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "^5.0.0",
|
||||
"typescript-eslint": "^8.20.0",
|
||||
"vite": "^7.0.4"
|
||||
"vite": "^7.1.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sveltejs/adapter-node": "^5.3.1",
|
||||
"drizzle-orm": "^0.44.5",
|
||||
"fuse.js": "^7.1.0",
|
||||
"pino": "^10.1.0",
|
||||
"pino-pretty": "^13.1.2",
|
||||
"postgres": "^3.4.7"
|
||||
}
|
||||
}
|
||||
|
||||
191
scripts/i18n-check.sh
Executable file
191
scripts/i18n-check.sh
Executable file
@@ -0,0 +1,191 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Translation validation script
|
||||
# Compares a translation file against the source messages.json to find missing keys
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Default paths
|
||||
SOURCE_FILE="src/lib/i18n/messages.json"
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# Function to show usage
|
||||
show_usage() {
|
||||
echo "Usage: $0 [LANGUAGE_FILE]"
|
||||
echo ""
|
||||
echo "Validates a translation file against the source messages.json"
|
||||
echo ""
|
||||
echo "Arguments:"
|
||||
echo " LANGUAGE_FILE Path to the translation file to validate (e.g., src/lib/i18n/it.json)"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " $0 src/lib/i18n/it.json"
|
||||
echo " $0 src/lib/i18n/fr.json"
|
||||
echo ""
|
||||
echo "If no file is provided, it will check all .json files in src/lib/i18n/ except messages.json"
|
||||
}
|
||||
|
||||
# Function to get all keys from a JSON file recursively
|
||||
get_keys() {
|
||||
local file="$1"
|
||||
local prefix="$2"
|
||||
|
||||
# Use jq to extract all keys recursively
|
||||
jq -r 'paths(scalars) as $p | $p | join(".")' "$file" | while read -r key; do
|
||||
if [ -n "$prefix" ]; then
|
||||
echo "${prefix}.${key}"
|
||||
else
|
||||
echo "$key"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Function to validate a single translation file
|
||||
validate_file() {
|
||||
local translation_file="$1"
|
||||
local source_file="$2"
|
||||
|
||||
echo -e "${YELLOW}Validating: $translation_file${NC}"
|
||||
echo "----------------------------------------"
|
||||
|
||||
# Check if files exist
|
||||
if [ ! -f "$source_file" ]; then
|
||||
echo -e "${RED}Error: Source file $source_file not found${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$translation_file" ]; then
|
||||
echo -e "${RED}Error: Translation file $translation_file not found${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get all keys from source file
|
||||
local source_keys
|
||||
source_keys=$(get_keys "$source_file")
|
||||
|
||||
# Get all keys from translation file
|
||||
local translation_keys
|
||||
translation_keys=$(get_keys "$translation_file")
|
||||
|
||||
# Find missing keys
|
||||
local missing_keys
|
||||
missing_keys=$(comm -23 <(echo "$source_keys" | sort) <(echo "$translation_keys" | sort))
|
||||
|
||||
# Find extra keys (in translation but not in source)
|
||||
local extra_keys
|
||||
extra_keys=$(comm -13 <(echo "$source_keys" | sort) <(echo "$translation_keys" | sort))
|
||||
|
||||
# Count missing and extra keys
|
||||
local missing_count
|
||||
if [ -z "$missing_keys" ]; then
|
||||
missing_count=0
|
||||
else
|
||||
missing_count=$(echo "$missing_keys" | wc -l | tr -d ' ')
|
||||
fi
|
||||
|
||||
local extra_count
|
||||
if [ -z "$extra_keys" ]; then
|
||||
extra_count=0
|
||||
else
|
||||
extra_count=$(echo "$extra_keys" | wc -l | tr -d ' ')
|
||||
fi
|
||||
|
||||
# Report results
|
||||
if [ "$missing_count" -eq 0 ] && [ "$extra_count" -eq 0 ]; then
|
||||
echo -e "${GREEN} Perfect! All keys match.${NC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$missing_count" -gt 0 ]; then
|
||||
echo -e "${RED} Missing $missing_count key(s) in translation:${NC}"
|
||||
echo "$missing_keys" | while read -r key; do
|
||||
echo -e " ${RED}• $key${NC}"
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ "$extra_count" -gt 0 ]; then
|
||||
echo -e "${YELLOW} Extra $extra_count key(s) in translation (not in source):${NC}"
|
||||
echo "$extra_keys" | while read -r key; do
|
||||
echo -e " ${YELLOW}• $key${NC}"
|
||||
done
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Return error code if there are missing keys
|
||||
if [ "$missing_count" -gt 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
local translation_file="$1"
|
||||
local source_file="$PROJECT_ROOT/$SOURCE_FILE"
|
||||
local exit_code=0
|
||||
|
||||
# Change to project root directory
|
||||
cd "$PROJECT_ROOT"
|
||||
|
||||
# If no file specified, check all translation files
|
||||
if [ -z "$translation_file" ]; then
|
||||
echo -e "${YELLOW}No file specified. Checking all translation files...${NC}"
|
||||
echo ""
|
||||
|
||||
# Find all .json files in i18n directory except messages.json
|
||||
local files
|
||||
files=$(find src/lib/i18n -name "*.json" -not -name "messages.json" 2>/dev/null || true)
|
||||
|
||||
if [ -z "$files" ]; then
|
||||
echo -e "${YELLOW}No translation files found in src/lib/i18n/${NC}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Validate each file
|
||||
echo "$files" | while read -r file; do
|
||||
if [ -n "$file" ]; then
|
||||
if ! validate_file "$file" "$source_file"; then
|
||||
exit_code=1
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
return $exit_code
|
||||
fi
|
||||
|
||||
# Validate the specified file
|
||||
if ! validate_file "$translation_file" "$source_file"; then
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
# Check if jq is installed
|
||||
if ! command -v jq &> /dev/null; then
|
||||
echo -e "${RED}Error: jq is required but not installed.${NC}"
|
||||
echo "Please install jq:"
|
||||
echo " macOS: brew install jq"
|
||||
echo " Ubuntu/Debian: sudo apt-get install jq"
|
||||
echo " CentOS/RHEL: sudo yum install jq"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Handle help flag
|
||||
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
||||
show_usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run main function
|
||||
main "$1"
|
||||
44
src/hooks.server.ts
Normal file
44
src/hooks.server.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// src/hooks.server.ts
|
||||
import type { Handle } from '@sveltejs/kit';
|
||||
import { generateUserId } from '$lib/generateUserId.js';
|
||||
import { ensureDatabaseConnection } from '$lib/database/healthCheck';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
// Global flag to track if database health check has been performed
|
||||
let dbHealthCheckPerformed = false;
|
||||
|
||||
export const handle: Handle = async ({ event, resolve }) => {
|
||||
// Perform database health check only once during application startup
|
||||
if (!dbHealthCheckPerformed) {
|
||||
try {
|
||||
await ensureDatabaseConnection({
|
||||
maxRetries: 3,
|
||||
baseDelay: 1000,
|
||||
maxDelay: 10000,
|
||||
timeout: 5000
|
||||
});
|
||||
dbHealthCheckPerformed = true;
|
||||
} catch (error) {
|
||||
logger.error({ error }, 'Database health check failed');
|
||||
// The ensureDatabaseConnection function will exit the process
|
||||
// if the database is unavailable, so this catch is just for safety
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
const cactoideUserId = event.cookies.get('cactoideUserId');
|
||||
const userId = generateUserId();
|
||||
|
||||
const DAYS = 400; // practical upper bound in many browsers for cookies
|
||||
const MAX_AGE = 60 * 60 * 24 * DAYS;
|
||||
const PATH = '/';
|
||||
|
||||
if (!cactoideUserId) {
|
||||
logger.debug({ userId }, 'No cactoideUserId cookie found, generating new one');
|
||||
event.cookies.set('cactoideUserId', userId, { path: PATH, maxAge: MAX_AGE });
|
||||
} else {
|
||||
logger.debug({ cactoideUserId }, 'cactoideUserId cookie found, using existing one');
|
||||
}
|
||||
|
||||
return resolve(event);
|
||||
};
|
||||
121
src/lib/calendarHelpers.ts
Normal file
121
src/lib/calendarHelpers.ts
Normal file
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* Calendar integration utilities for iCal generation and calendar service links
|
||||
*/
|
||||
|
||||
export interface CalendarEvent {
|
||||
name: string;
|
||||
date: string;
|
||||
time: string;
|
||||
location: string;
|
||||
description?: string;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a date and time string for iCal format (UTC)
|
||||
*/
|
||||
export const formatDateForICal = (date: string, time: string): string => {
|
||||
// Parse date and time as local timezone to avoid timezone issues
|
||||
const [year, month, day] = date.split('-').map(Number);
|
||||
const [hours, minutes, seconds] = time.split(':').map(Number);
|
||||
const eventDate = new Date(year, month - 1, day, hours, minutes, seconds || 0);
|
||||
return eventDate.toISOString().replace(/[-:]/g, '').split('.')[0] + 'Z';
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates iCal content for an event
|
||||
*/
|
||||
export const generateICalContent = (event: CalendarEvent, eventId: string): string => {
|
||||
const startDate = formatDateForICal(event.date, event.time);
|
||||
const endDate = formatDateForICal(event.date, event.time); // You might want to add duration logic here
|
||||
const eventUrl = event.url || '';
|
||||
|
||||
return `BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//Cactoide//Event Calendar//EN
|
||||
BEGIN:VEVENT
|
||||
UID:${eventId}@cactoide.com
|
||||
DTSTAMP:${new Date().toISOString().replace(/[-:]/g, '').split('.')[0]}Z
|
||||
DTSTART:${startDate}
|
||||
DTEND:${endDate}
|
||||
SUMMARY:${event.name}
|
||||
DESCRIPTION:${event.description || `Event URL: ${eventUrl}`}
|
||||
LOCATION:${event.location}
|
||||
URL:${eventUrl}
|
||||
END:VEVENT
|
||||
END:VCALENDAR`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Downloads an iCal file for the given event
|
||||
*/
|
||||
export const downloadICalFile = (
|
||||
event: CalendarEvent,
|
||||
eventId: string,
|
||||
filename?: string
|
||||
): void => {
|
||||
const icalContent = generateICalContent(event, eventId);
|
||||
const blob = new Blob([icalContent], { type: 'text/calendar;charset=utf-8' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = filename || `${event.name.replace(/[^a-z0-9]/gi, '_').toLowerCase()}.ics`;
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates Google Calendar URL for adding an event
|
||||
*/
|
||||
export const getGoogleCalendarUrl = (
|
||||
event: CalendarEvent,
|
||||
eventId: string,
|
||||
baseUrl: string
|
||||
): string => {
|
||||
const eventUrl = event.url || `${baseUrl}/event/${eventId}`;
|
||||
const startDate = formatDateForICal(event.date, event.time);
|
||||
const endDate = formatDateForICal(event.date, event.time);
|
||||
|
||||
return `https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(event.name)}&dates=${startDate}/${endDate}&details=${encodeURIComponent(event.description || `Event URL: ${eventUrl}`)}&location=${encodeURIComponent(event.location)}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Generates Microsoft Outlook URL for adding an event
|
||||
*/
|
||||
export const getOutlookCalendarUrl = (
|
||||
event: CalendarEvent,
|
||||
eventId: string,
|
||||
baseUrl: string
|
||||
): string => {
|
||||
const eventUrl = event.url || `${baseUrl}/event/${eventId}`;
|
||||
const startDate = formatDateForICal(event.date, event.time);
|
||||
const endDate = formatDateForICal(event.date, event.time);
|
||||
|
||||
return `https://outlook.live.com/calendar/0/deeplink/compose?subject=${encodeURIComponent(event.name)}&startdt=${startDate}&enddt=${endDate}&body=${encodeURIComponent(event.description || `Event URL: ${eventUrl}`)}&location=${encodeURIComponent(event.location)}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens Google Calendar in a new tab
|
||||
*/
|
||||
export const addToGoogleCalendar = (
|
||||
event: CalendarEvent,
|
||||
eventId: string,
|
||||
baseUrl: string
|
||||
): void => {
|
||||
const url = getGoogleCalendarUrl(event, eventId, baseUrl);
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
|
||||
/**
|
||||
* Opens Microsoft Outlook in a new tab
|
||||
*/
|
||||
export const addToOutlookCalendar = (
|
||||
event: CalendarEvent,
|
||||
eventId: string,
|
||||
baseUrl: string
|
||||
): void => {
|
||||
const url = getOutlookCalendarUrl(event, eventId, baseUrl);
|
||||
window.open(url, '_blank');
|
||||
};
|
||||
170
src/lib/components/CalendarModal.svelte
Normal file
170
src/lib/components/CalendarModal.svelte
Normal file
@@ -0,0 +1,170 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import type { CalendarEvent } from '../calendarHelpers.js';
|
||||
import {
|
||||
addToGoogleCalendar,
|
||||
addToOutlookCalendar,
|
||||
downloadICalFile
|
||||
} from '../calendarHelpers.js';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
export let isOpen: boolean = false;
|
||||
export let event: CalendarEvent;
|
||||
export let eventId: string;
|
||||
export let baseUrl: string = '';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
const closeModal = () => {
|
||||
dispatch('close');
|
||||
};
|
||||
|
||||
const handleModalClick = (event: MouseEvent) => {
|
||||
if (event.target === event.currentTarget) {
|
||||
closeModal();
|
||||
}
|
||||
};
|
||||
|
||||
const handleKeydown = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') {
|
||||
closeModal();
|
||||
}
|
||||
};
|
||||
|
||||
const handleGoogleCalendar = () => {
|
||||
addToGoogleCalendar(event, eventId, baseUrl);
|
||||
closeModal();
|
||||
};
|
||||
|
||||
const handleOutlookCalendar = () => {
|
||||
addToOutlookCalendar(event, eventId, baseUrl);
|
||||
closeModal();
|
||||
};
|
||||
|
||||
const handleDownloadICal = () => {
|
||||
downloadICalFile(event, eventId);
|
||||
closeModal();
|
||||
};
|
||||
|
||||
// Focus the first button when modal opens
|
||||
$: if (isOpen) {
|
||||
setTimeout(() => {
|
||||
const firstButton = document.querySelector('[data-calendar-option]') as HTMLButtonElement;
|
||||
firstButton?.focus();
|
||||
}, 100);
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if isOpen}
|
||||
<div
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm"
|
||||
on:click={handleModalClick}
|
||||
on:keydown={handleKeydown}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="calendar-modal-title"
|
||||
tabindex="-1"
|
||||
>
|
||||
<div class="mx-4 w-full max-w-md rounded-sm border border-white/20 bg-slate-900 p-6 shadow-2xl">
|
||||
<div class="mb-6 flex items-center justify-between">
|
||||
<h3 id="calendar-modal-title" class="text-xl font-bold text-white">
|
||||
{t('calendar.addToCalendarTitle')}
|
||||
</h3>
|
||||
<button
|
||||
on:click={closeModal}
|
||||
class="text-slate-400 transition-colors duration-200 hover:text-white"
|
||||
aria-label={t('common.closeModal')}
|
||||
>
|
||||
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M6 18L18 6M6 6l12 12"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<button
|
||||
on:click={handleGoogleCalendar}
|
||||
data-calendar-option
|
||||
class="w-full rounded-sm border border-white/20 bg-white/5 px-4 py-3 text-left transition-all duration-200 hover:scale-105 hover:bg-white/10"
|
||||
>
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-sm bg-blue-500/20">
|
||||
<svg class="h-4 w-4 text-blue-400" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path
|
||||
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
||||
/>
|
||||
<path
|
||||
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
||||
/>
|
||||
<path
|
||||
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.84.81-.62z"
|
||||
/>
|
||||
<path
|
||||
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-semibold text-white">{t('calendar.googleCalendarTitle')}</p>
|
||||
<p class="text-sm text-slate-400">{t('calendar.googleCalendarDescription')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={handleOutlookCalendar}
|
||||
class="w-full rounded-sm border border-white/20 bg-white/5 px-4 py-3 text-left transition-all duration-200 hover:scale-105 hover:bg-white/10"
|
||||
>
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-sm bg-blue-600/20">
|
||||
<svg class="h-4 w-4 text-blue-400" viewBox="0 0 24 24" fill="currentColor">
|
||||
<path
|
||||
d="M7.462 2.573c-.2-.2-.4-.2-.6 0L.2 9.235c-.2.2-.2.4 0 .6l6.662 6.662c.2.2.4.2.6 0l6.662-6.662c.2-.2.2-.4 0-.6L7.462 2.573z"
|
||||
/>
|
||||
<path
|
||||
d="M23.8 9.235l-6.662-6.662c-.2-.2-.4-.2-.6 0L9.876 9.235c-.2.2-.2.4 0 .6l6.662 6.662c.2.2.4.2.6 0l6.662-6.662c.2-.2.2-.4 0-.6z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-semibold text-white">{t('calendar.microsoftOutlookTitle')}</p>
|
||||
<p class="text-sm text-slate-400">{t('calendar.microsoftOutlookDescription')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={handleDownloadICal}
|
||||
class="w-full rounded-sm border border-white/20 bg-white/5 px-4 py-3 text-left transition-all duration-200 hover:scale-105 hover:bg-white/10"
|
||||
>
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-sm bg-violet-500/20">
|
||||
<svg
|
||||
class="h-4 w-4 text-violet-400"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-semibold text-white">{t('calendar.downloadICalTitle')}</p>
|
||||
<p class="text-sm text-slate-400">{t('calendar.downloadICalDescription')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1,15 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
function navigateTo(path: string) {
|
||||
goto(path);
|
||||
}
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
import { PUBLIC_LANDING_INFO } from '$env/static/public';
|
||||
|
||||
// Check if current page is active
|
||||
function isActive(path: string): boolean {
|
||||
const isActive = (path: string): boolean => {
|
||||
return $page.url.pathname === path;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<nav class="relative z-50 backdrop-blur-md">
|
||||
@@ -18,7 +16,7 @@
|
||||
<!-- Logo/Brand -->
|
||||
<div class="flex items-center">
|
||||
<button
|
||||
on:click={() => navigateTo('/')}
|
||||
on:click={() => goto('/')}
|
||||
class="cursor-pointer text-2xl font-medium text-violet-400"
|
||||
>
|
||||
Cactoide
|
||||
@@ -27,32 +25,34 @@
|
||||
|
||||
<!-- Navigation -->
|
||||
<div class="md:flex md:items-center md:space-x-8">
|
||||
{#if PUBLIC_LANDING_INFO !== 'false'}
|
||||
<button
|
||||
on:click={() => navigateTo('/')}
|
||||
on:click={() => goto('/')}
|
||||
class={isActive('/') ? 'text-violet-400' : 'cursor-pointer'}
|
||||
>
|
||||
Home
|
||||
{t('navigation.home')}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click={() => navigateTo('/discover')}
|
||||
on:click={() => goto('/discover')}
|
||||
class={isActive('/discover') ? 'text-violet-400' : 'cursor-pointer'}
|
||||
>
|
||||
Discover
|
||||
{t('navigation.discover')}
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => navigateTo('/create')}
|
||||
on:click={() => goto('/create')}
|
||||
class={isActive('/create') ? 'text-violet-400' : 'cursor-pointer'}
|
||||
>
|
||||
Create
|
||||
{t('navigation.create')}
|
||||
</button>
|
||||
|
||||
<button
|
||||
on:click={() => navigateTo('/event')}
|
||||
on:click={() => goto('/event')}
|
||||
class={isActive('/event') ? 'text-violet-400' : 'cursor-pointer'}
|
||||
>
|
||||
My Events
|
||||
{t('navigation.myEvents')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
108
src/lib/database/healthCheck.ts
Normal file
108
src/lib/database/healthCheck.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
import postgres from 'postgres';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
interface HealthCheckOptions {
|
||||
maxRetries?: number;
|
||||
baseDelay?: number;
|
||||
maxDelay?: number;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
interface HealthCheckResult {
|
||||
success: boolean;
|
||||
error?: string;
|
||||
attempts: number;
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a database health check with retry logic and exponential backoff
|
||||
*/
|
||||
export async function checkDatabaseHealth(
|
||||
options: HealthCheckOptions = {}
|
||||
): Promise<HealthCheckResult> {
|
||||
const {
|
||||
maxRetries = 3,
|
||||
baseDelay = 1000, // 1 second
|
||||
maxDelay = 10000, // 10 seconds
|
||||
timeout = 5000 // 5 seconds
|
||||
} = options;
|
||||
|
||||
if (!env.DATABASE_URL) {
|
||||
logger.error('DATABASE_URL environment variable is not set');
|
||||
return {
|
||||
success: false,
|
||||
error: 'DATABASE_URL environment variable is not set',
|
||||
attempts: 0
|
||||
};
|
||||
}
|
||||
|
||||
let lastError: Error | null = null;
|
||||
|
||||
logger.info({ maxRetries }, 'Starting database health check');
|
||||
|
||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||
logger.debug({ attempt, maxRetries }, 'Testing database connection');
|
||||
|
||||
try {
|
||||
// Create a new connection for the health check
|
||||
const client = postgres(env.DATABASE_URL, {
|
||||
max: 1,
|
||||
idle_timeout: 20,
|
||||
connect_timeout: timeout / 1000, // Convert to seconds
|
||||
onnotice: () => {} // Suppress notices
|
||||
});
|
||||
|
||||
// Test the connection with a simple query
|
||||
await client`SELECT 1 as health_check`;
|
||||
await client.end();
|
||||
|
||||
logger.info({ attempt }, 'Database connection successful');
|
||||
|
||||
return {
|
||||
success: true,
|
||||
attempts: attempt
|
||||
};
|
||||
} catch (error) {
|
||||
lastError = error as Error;
|
||||
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
||||
logger.warn({ attempt, error: errorMessage }, 'Database connection failed');
|
||||
|
||||
// Don't wait after the last attempt
|
||||
if (attempt < maxRetries) {
|
||||
const delay = Math.min(baseDelay * Math.pow(2, attempt - 1), maxDelay);
|
||||
logger.debug({ delay }, 'Waiting before retry');
|
||||
await new Promise((resolve) => setTimeout(resolve, delay));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const finalError = lastError?.message || 'Unknown database connection error';
|
||||
|
||||
logger.error(
|
||||
{ attempts: maxRetries, error: finalError },
|
||||
'All database connection attempts failed'
|
||||
);
|
||||
|
||||
return {
|
||||
success: false,
|
||||
error: finalError,
|
||||
attempts: maxRetries
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs database health check and exits the process if it fails
|
||||
*/
|
||||
export async function ensureDatabaseConnection(options?: HealthCheckOptions): Promise<void> {
|
||||
const result = await checkDatabaseHealth(options);
|
||||
|
||||
if (!result.success) {
|
||||
logger.fatal(
|
||||
{ error: result.error, attempts: result.attempts },
|
||||
'Database connection failed after all retry attempts. Exiting application'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,8 @@ import type { InferInsertModel, InferSelectModel } from 'drizzle-orm';
|
||||
|
||||
// --- Enums (matching the SQL CHECK constraints)
|
||||
export const eventTypeEnum = pgEnum('event_type', ['limited', 'unlimited']);
|
||||
export const visibilityEnum = pgEnum('visibility', ['public', 'private']);
|
||||
export const visibilityEnum = pgEnum('visibility', ['public', 'private', 'invite-only']);
|
||||
export const locationTypeEnum = pgEnum('location_type', ['none', 'text', 'maps']);
|
||||
|
||||
// --- Events table
|
||||
export const events = pgTable(
|
||||
@@ -27,6 +28,8 @@ export const events = pgTable(
|
||||
date: date('date', { mode: 'string' }).notNull(), // ISO 'YYYY-MM-DD'
|
||||
time: time('time', { withTimezone: false }).notNull(), // 'HH:MM:SS'
|
||||
location: varchar('location', { length: 200 }).notNull(),
|
||||
locationType: locationTypeEnum('location_type').notNull().default('none'),
|
||||
locationUrl: varchar('location_url', { length: 500 }),
|
||||
type: eventTypeEnum('type').notNull(),
|
||||
attendeeLimit: integer('attendee_limit'), // nullable in SQL
|
||||
userId: varchar('user_id', { length: 100 }).notNull(),
|
||||
@@ -68,11 +71,31 @@ export const rsvps = pgTable(
|
||||
})
|
||||
);
|
||||
|
||||
// --- Invite Tokens table
|
||||
export const inviteTokens = pgTable(
|
||||
'invite_tokens',
|
||||
{
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
eventId: varchar('event_id', { length: 8 })
|
||||
.notNull()
|
||||
.references(() => events.id, { onDelete: 'cascade' }),
|
||||
token: varchar('token', { length: 32 }).notNull().unique(),
|
||||
expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow()
|
||||
},
|
||||
(t) => ({
|
||||
idxInviteTokensEventId: index('idx_invite_tokens_event_id').on(t.eventId),
|
||||
idxInviteTokensToken: index('idx_invite_tokens_token').on(t.token),
|
||||
idxInviteTokensExpiresAt: index('idx_invite_tokens_expires_at').on(t.expiresAt)
|
||||
})
|
||||
);
|
||||
|
||||
// --- Relations (optional but handy for type safety)
|
||||
import { relations } from 'drizzle-orm';
|
||||
|
||||
export const eventsRelations = relations(events, ({ many }) => ({
|
||||
rsvps: many(rsvps)
|
||||
rsvps: many(rsvps),
|
||||
inviteTokens: many(inviteTokens)
|
||||
}));
|
||||
|
||||
export const rsvpsRelations = relations(rsvps, ({ one }) => ({
|
||||
@@ -82,16 +105,30 @@ export const rsvpsRelations = relations(rsvps, ({ one }) => ({
|
||||
})
|
||||
}));
|
||||
|
||||
export const inviteTokensRelations = relations(inviteTokens, ({ one }) => ({
|
||||
event: one(events, {
|
||||
fields: [inviteTokens.eventId],
|
||||
references: [events.id]
|
||||
})
|
||||
}));
|
||||
|
||||
// --- Inferred types for use in the application
|
||||
export type Event = InferSelectModel<typeof events>;
|
||||
export type NewEvent = InferInsertModel<typeof events>;
|
||||
export type Rsvp = InferSelectModel<typeof rsvps>;
|
||||
export type NewRsvp = InferInsertModel<typeof rsvps>;
|
||||
export type InviteToken = InferSelectModel<typeof inviteTokens>;
|
||||
export type NewInviteToken = InferInsertModel<typeof inviteTokens>;
|
||||
|
||||
// --- Additional utility types
|
||||
export type EventWithRsvps = Event & {
|
||||
rsvps: Rsvp[];
|
||||
};
|
||||
|
||||
export type EventWithInviteTokens = Event & {
|
||||
inviteTokens: InviteToken[];
|
||||
};
|
||||
|
||||
export type CreateEventData = Omit<NewEvent, 'id' | 'createdAt' | 'updatedAt'>;
|
||||
export type CreateRsvpData = Omit<NewRsvp, 'id' | 'createdAt'>;
|
||||
export type CreateInviteTokenData = Omit<NewInviteToken, 'id' | 'createdAt'>;
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
export const formatDate = (dateString: string): string => {
|
||||
const date = new Date(dateString);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
return `${year}/${month}/${day}`;
|
||||
};
|
||||
|
||||
export const formatTime = (timeString: string): string => {
|
||||
const [hours, minutes] = timeString.split(':');
|
||||
return `${hours}:${minutes}`;
|
||||
};
|
||||
46
src/lib/dateHelpers.ts
Normal file
46
src/lib/dateHelpers.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import type { Event } from './types';
|
||||
|
||||
export const formatDate = (dateString: string): string => {
|
||||
// Parse the date string as local date to avoid timezone issues
|
||||
// Split the date string and create a Date object in local timezone
|
||||
const [year, month, day] = dateString.split('-').map(Number);
|
||||
const date = new Date(year, month - 1, day); // month is 0-indexed in Date constructor
|
||||
const formattedYear = date.getFullYear();
|
||||
const formattedMonth = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const formattedDay = String(date.getDate()).padStart(2, '0');
|
||||
return `${formattedYear}/${formattedMonth}/${formattedDay}`;
|
||||
};
|
||||
|
||||
export const formatTime = (timeString: string): string => {
|
||||
const [hours, minutes] = timeString.split(':');
|
||||
return `${hours}:${minutes}`;
|
||||
};
|
||||
|
||||
// Helper function to check if an event is within a time range
|
||||
export const isEventInTimeRange = (event: Event, timeFilter: string): boolean => {
|
||||
if (timeFilter === 'any') return true;
|
||||
|
||||
// Parse date and time as local timezone to avoid timezone issues
|
||||
const [year, month, day] = event.date.split('-').map(Number);
|
||||
const [hours, minutes, seconds] = event.time.split(':').map(Number);
|
||||
const eventDate = new Date(year, month - 1, day, hours, minutes, seconds || 0);
|
||||
const now = new Date();
|
||||
|
||||
// Handle temporal status filters
|
||||
if (timeFilter === 'upcoming') {
|
||||
return eventDate >= now;
|
||||
}
|
||||
|
||||
if (timeFilter === 'past') {
|
||||
return eventDate < now;
|
||||
}
|
||||
|
||||
// Handle time range filters
|
||||
const ranges: Record<string, Date> = {
|
||||
'next-week': new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000),
|
||||
'next-month': new Date(new Date(now).setMonth(now.getMonth() + 1))
|
||||
};
|
||||
|
||||
const endDate = ranges[timeFilter];
|
||||
return endDate ? eventDate >= now && eventDate <= endDate : true;
|
||||
};
|
||||
55
src/lib/i18n/i18n.ts
Normal file
55
src/lib/i18n/i18n.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import messages from './messages.json';
|
||||
|
||||
// Simple i18n utility for English-only text management
|
||||
// Get message by key with optional interpolation
|
||||
export function t(key: string, params?: Record<string, string | number>): string {
|
||||
// Navigate through nested keys (e.g., 'common.cancel')
|
||||
const keys = key.split('.');
|
||||
let value: unknown = messages;
|
||||
|
||||
for (const k of keys) {
|
||||
if (value && typeof value === 'object' && k in value) {
|
||||
value = (value as Record<string, unknown>)[k];
|
||||
} else {
|
||||
console.warn(`Translation key not found: ${key}`);
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
console.warn(`Translation value is not a string: ${key}`);
|
||||
return key;
|
||||
}
|
||||
|
||||
// Interpolate parameters
|
||||
if (params) {
|
||||
return value.replace(/\{(\w+)\}/g, (match, paramKey) => {
|
||||
return params[paramKey]?.toString() || match;
|
||||
});
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// Format plural forms (basic implementation)
|
||||
export function tp(key: string, count: number, params?: Record<string, string | number>): string {
|
||||
const baseKey = key;
|
||||
const pluralKey = `${key}_plural`;
|
||||
|
||||
// Try to get plural form first
|
||||
let message = t(pluralKey, { ...params, count });
|
||||
|
||||
// If plural form doesn't exist, use singular
|
||||
if (message === pluralKey) {
|
||||
message = t(baseKey, { ...params, count });
|
||||
}
|
||||
|
||||
// Replace {plural} with 's' if count > 1
|
||||
if (count !== 1) {
|
||||
message = message.replace('{plural}', 's');
|
||||
} else {
|
||||
message = message.replace('{plural}', '');
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
265
src/lib/i18n/it.json
Normal file
265
src/lib/i18n/it.json
Normal file
@@ -0,0 +1,265 @@
|
||||
{
|
||||
"common": {
|
||||
"required": "*",
|
||||
"cancel": "Annulla",
|
||||
"create": "Crea",
|
||||
"edit": "Modifica",
|
||||
"delete": "Elimina",
|
||||
"view": "Visualizza",
|
||||
"home": "Home",
|
||||
"loading": "Caricamento...",
|
||||
"error": "Errore",
|
||||
"success": "Successo",
|
||||
"name": "Nome",
|
||||
"date": "Data",
|
||||
"time": "Ora",
|
||||
"location": "Luogo",
|
||||
"locationType": "Tipo di Luogo",
|
||||
"locationNone": "Nessuno",
|
||||
"locationText": "Testo",
|
||||
"locationMaps": "Google Maps",
|
||||
"locationNoneDescription": "Nessun luogo specificato",
|
||||
"locationTextDescription": "Inserisci il luogo come testo semplice.",
|
||||
"locationMapsDescription": "Inserisci il link di Google Maps.",
|
||||
"googleMapsUrl": "URL di Google Maps",
|
||||
"googleMapsUrlPlaceholder": "https://maps.google.com/...",
|
||||
"type": "Tipo",
|
||||
"visibility": "Visibilità",
|
||||
"public": "Pubblico",
|
||||
"private": "Privato",
|
||||
"limited": "Limitato",
|
||||
"unlimited": "Illimitato",
|
||||
"capacity": "Capacità",
|
||||
"attendees": "Partecipanti",
|
||||
"attendeeLimit": "Limite di Partecipanti",
|
||||
"enterLimit": "Inserisci il limite",
|
||||
"enterEventName": "Inserisci il nome dell'evento",
|
||||
"enterLocation": "Inserisci il luogo",
|
||||
"enterYourName": "Inserisci il tuo nome",
|
||||
"enterNumberOfGuests": "Inserisci il numero di ospiti",
|
||||
"yourName": "Il tuo nome",
|
||||
"numberOfGuests": "Numero di Ospiti",
|
||||
"addGuests": "Aggiungi ospiti",
|
||||
"joinEvent": "Partecipa all'Evento",
|
||||
"addToCalendar": "Aggiungi al Calendario",
|
||||
"close": "Chiudi",
|
||||
"closeModal": "Chiudi finestra",
|
||||
"removeRSVP": "Rimuovi RSVP",
|
||||
"updating": "Aggiornamento...",
|
||||
"creating": "Creazione...",
|
||||
"adding": "Aggiunta...",
|
||||
"updateEvent": "Aggiorna Evento",
|
||||
"createEvent": "Crea Evento",
|
||||
"createNewEvent": "Crea Nuovo Evento",
|
||||
"createYourFirstEvent": "Crea il Tuo Primo Evento",
|
||||
"editEvent": "Modifica Evento",
|
||||
"deleteEvent": "Elimina Evento",
|
||||
"myEvents": "I Miei Eventi",
|
||||
"discover": "Scopri",
|
||||
"noEventsYet": "Ancora Nessun Evento",
|
||||
"noPublicEventsYet": "Ancora Nessun Evento Pubblico",
|
||||
"noAttendeesYet": "Ancora nessun partecipante",
|
||||
"beFirstToJoin": "Sii il primo a partecipare!",
|
||||
"eventNotFound": "Evento Non Trovato",
|
||||
"eventIsFull": "L'Evento è Pieno!",
|
||||
"maximumCapacityReached": "Raggiunta la capacità massima",
|
||||
"rsvpAddedSuccessfully": "RSVP aggiunto con successo!",
|
||||
"removedRsvpSuccessfully": "RSVP rimosso con successo.",
|
||||
"anUnexpectedErrorOccurred": "Si è verificato un errore inaspettato.",
|
||||
"somethingWentWrong": "Qualcosa è andato storto. Riprova.",
|
||||
"failedToAddRsvp": "Impossibile aggiungere RSVP",
|
||||
"failedToRemoveRsvp": "Impossibile rimuovere RSVP",
|
||||
"failedToDeleteEvent": "Impossibile eliminare l'evento",
|
||||
"youMayNotHavePermission": "Potresti non avere il permesso di eliminare questo evento.",
|
||||
"anErrorOccurredWhileDeleting": "Si è verificato un errore durante l'eliminazione dell'evento:",
|
||||
"databaseUnreachable": "Database non raggiungibile.",
|
||||
"eventIdNotFound": "EventId non trovato",
|
||||
"eventNotExists": "Evento non trovato",
|
||||
"failedToLoadEvent": "Impossibile caricare l'evento",
|
||||
"nameAndUserIdRequired": "Nome e ID utente sono obbligatori",
|
||||
"eventCapacityExceeded": "Capacità dell'evento superata. Stai cercando di aggiungere {guests} partecipanti (te compreso/a), ma rimangono solo {remaining} posti.",
|
||||
"nameAlreadyExists": "Il nome esiste già per questo evento",
|
||||
"missingOrEmptyFields": "Campi mancanti o vuoti: {fields}",
|
||||
"dateCannotBeInPast": "La data non può essere nel passato.",
|
||||
"limitMustBeAtLeast2": "Il limite deve essere almeno 2 per eventi limitati.",
|
||||
"unauthorized": "Non autorizzato",
|
||||
"youCanOnlyEditYourOwnEvents": "Puoi modificare solo i tuoi eventi",
|
||||
"youDoNotHavePermissionToDelete": "Non hai il permesso di eliminare questo evento",
|
||||
"eventIdAndUserIdRequired": "ID evento e ID utente sono obbligatori",
|
||||
"guestsWillBeAddedAs": "Gli ospiti verranno aggiunti come \"Ospite #1 di {name}\", \"Ospite #2 di {name}\", ecc.",
|
||||
"yourNamePlaceholder": "Il tuo nome",
|
||||
"atTime": "alle"
|
||||
},
|
||||
"navigation": {
|
||||
"home": "Home",
|
||||
"discover": "Scopri",
|
||||
"create": "Crea",
|
||||
"myEvents": "I Miei Eventi"
|
||||
},
|
||||
"home": {
|
||||
"title": "Cactoide - Il sito per gli RSVP",
|
||||
"description": "Crea e gestisci gli RSVP degli eventi. Nessuna registrazione richiesta, condivisione immediata.",
|
||||
"mainTitle": "Cactoide(ea)",
|
||||
"subtitle": "La Piattaforma Definitiva per gli RSVP",
|
||||
"tagline": "Crea, condividi e gestisci eventi senza intoppi.",
|
||||
"whyCactoideTitle": "Perché Cactoide(ae)? 🌵",
|
||||
"whyCactoideDescription": "Come il cactus, i grandi eventi fioriscono in ogni condizione se gestiti con cura. Cactoide(ae) ti aiuta a semplificare gli RSVP, coordinare in modo semplice e mantenere ogni dettaglio efficiente: così i tuoi incontri sono resilienti, vivaci e indimenticabili.",
|
||||
"createEventNow": "Crea Evento Ora",
|
||||
"discoverPublicEventsTitle": "Scopri Eventi Pubblici",
|
||||
"discoverPublicEventsDescription": "Guarda cosa stanno pianificando gli altri e lasciati ispirare",
|
||||
"browseAllPublicEvents": "Sfoglia Tutti gli Eventi Pubblici",
|
||||
"whyCactoideFeatureTitle": "Perché Cactoide?",
|
||||
"instantEventCreationTitle": "Creazione Istantanea di Eventi",
|
||||
"instantEventCreationDescription": "Crea eventi in pochi secondi con il nostro modulo semplificato. Nessun account, nessuna attesa, solo pura efficienza.",
|
||||
"oneClickSharingTitle": "Condivisione con un Clic",
|
||||
"oneClickSharingDescription": "Ogni evento ottiene un URL unico e memorabile. Condividi istantaneamente tramite qualsiasi piattaforma o app di messaggistica.",
|
||||
"allInOneClarityTitle": "Chiarezza Tutto-in-Uno",
|
||||
"allInOneClarityDescription": "Niente più scorrimento infinito tra chat e reazioni. Visualizza la disponibilità e le risposte di tutti in un unico posto.",
|
||||
"noHassleNoSignUpsTitle": "Nessun Problema, Nessuna Registrazione",
|
||||
"noHassleNoSignUpsDescription": "Salta le registrazioni e i moduli infiniti. A differenza di altre piattaforme di eventi, crei e condividi istantaneamente: nessun account, nessuna barriera.",
|
||||
"smartLimitsTitle": "Limiti Intelligenti",
|
||||
"smartLimitsDescription": "Scegli tra RSVP illimitati o imposta una capacità limitata. Perfetto per eventi di qualsiasi dimensione.",
|
||||
"effortlessSimplicityTitle": "Semplicità Senza Sforzo",
|
||||
"effortlessSimplicityDescription": "Progettato per essere immediatamente chiaro e facile. Nessuna curva di apprendimento: apri, crea e vai.",
|
||||
"howItWorksTitle": "Come Funziona",
|
||||
"step1Title": "Crea Evento",
|
||||
"step1Description": "Compila un semplice modulo con i dettagli dell'evento. Scegli tra capacità limitata o illimitata.",
|
||||
"step2Title": "Ottieni URL Unico",
|
||||
"step2Description": "Ricevi un URL casuale e memorabile per il tuo evento. Perfetto per la condivisione ovunque.",
|
||||
"step3Title": "Raccogli gli RSVP",
|
||||
"step3Description": "Le persone visitano il tuo link e partecipano solo con il loro nome. Nessun account necessario.",
|
||||
"ctaTitle": "Pronto a Creare il Tuo Primo Evento?",
|
||||
"ctaDescription": "Unisciti a migliaia di organizzatori di eventi che si fidano di Cactoide",
|
||||
"ctaButton": "Crea"
|
||||
},
|
||||
"create": {
|
||||
"title": "Crea Evento - Cactoide",
|
||||
"formTitle": "Crea Nuovo Evento",
|
||||
"eventNameLabel": "Nome",
|
||||
"eventNamePlaceholder": "Inserisci il nome dell'evento",
|
||||
"dateLabel": "Data",
|
||||
"timeLabel": "Ora",
|
||||
"locationLabel": "Luogo",
|
||||
"locationPlaceholder": "Inserisci il luogo",
|
||||
"locationTypeLabel": "Tipo di Luogo",
|
||||
"locationNoneOption": "Nessuno",
|
||||
"locationTextOption": "Testo Semplice",
|
||||
"locationMapsOption": "Google Maps",
|
||||
"locationNoneDescription": "Nessun luogo specificato.",
|
||||
"locationTextDescription": "Inserisci il luogo come testo semplice.",
|
||||
"locationMapsDescription": "Inserisci il link di Google Maps.",
|
||||
"googleMapsUrlLabel": "URL di Google Maps",
|
||||
"googleMapsUrlPlaceholder": "https://maps.google.com/...",
|
||||
"typeLabel": "Tipo",
|
||||
"unlimitedOption": "Illimitato",
|
||||
"limitedOption": "Limitato",
|
||||
"attendeeLimitLabel": "Limite di Partecipanti",
|
||||
"attendeeLimitPlaceholder": "Inserisci il limite",
|
||||
"visibilityLabel": "Visibilità",
|
||||
"publicOption": "🌍 Pubblico",
|
||||
"privateOption": "🔒 Privato",
|
||||
"publicDescription": "Gli eventi pubblici sono visibili a tutti e possono essere scoperti da altri.",
|
||||
"privateDescription": "Gli eventi privati sono visibili solo a te e alle persone con cui condividi il link.",
|
||||
"creatingEvent": "Creazione Evento...",
|
||||
"createEventButton": "Crea Evento"
|
||||
},
|
||||
"event": {
|
||||
"title": "{eventName} - Cactoide",
|
||||
"eventTitle": "Evento - Cactoide",
|
||||
"editTitle": "Modifica Evento - {eventName} - Cactoide",
|
||||
"myEventsTitle": "I Miei Eventi - Cactoide",
|
||||
"eventNotFoundTitle": "Evento Non Trovato",
|
||||
"eventNotFoundDescription": "L'evento che stai cercando non esiste o è stato rimosso.",
|
||||
"joinThisEvent": "Partecipa a Questo Evento",
|
||||
"eventIsFull": "L'Evento è Pieno!",
|
||||
"maximumCapacityReached": "Raggiunta la capacità massima",
|
||||
"yourNameLabel": "Il tuo nome",
|
||||
"yourNamePlaceholder": "Inserisci il tuo nome",
|
||||
"addGuestsLabel": "Aggiungi ospiti",
|
||||
"numberOfGuestsLabel": "Numero di Ospiti",
|
||||
"numberOfGuestsPlaceholder": "Inserisci il numero di ospiti",
|
||||
"guestsWillBeAddedAs": "Gli ospiti verranno aggiunti come \"Ospite #1 di {name}\", \"Ospite #2 di {name}\", ecc.",
|
||||
"joinEventButton": "Partecipa all'Evento",
|
||||
"joinEventWithGuests": "Partecipa all'Evento + {count} Ospite{plural}",
|
||||
"adding": "Aggiunta...",
|
||||
"attendeesTitle": "Partecipanti",
|
||||
"noAttendeesYet": "Ancora nessun partecipante",
|
||||
"beFirstToJoin": "Sii il primo a partecipare!",
|
||||
"copyLinkButton": "Copia Link",
|
||||
"copyInviteLinkButton": "Copia Link Invito",
|
||||
"addToCalendarButton": "Aggiungi al Calendario",
|
||||
"eventLinkCopied": "Link dell'evento copiato negli appunti!",
|
||||
"inviteLinkCopied": "Link invito copiato negli appunti!",
|
||||
"rsvpAddedSuccessfully": "RSVP aggiunto con successo!",
|
||||
"removedRsvpSuccessfully": "RSVP rimosso con successo.",
|
||||
"failedToAddRsvp": "Impossibile aggiungere RSVP",
|
||||
"failedToRemoveRsvp": "Impossibile rimuovere RSVP",
|
||||
"editEventTitle": "Modifica Evento",
|
||||
"editEventDescription": "Aggiorna i dettagli del tuo evento",
|
||||
"updatingEvent": "Aggiornamento...",
|
||||
"updateEventButton": "Aggiorna Evento",
|
||||
"myEventsDescription": "Gestisci i tuoi eventi creati",
|
||||
"noEventsYetTitle": "Ancora Nessun Evento",
|
||||
"noEventsYetDescription": "Non hai ancora creato nessun evento. Inizia creando il tuo primo evento!",
|
||||
"createYourFirstEventButton": "Crea il Tuo Primo Evento",
|
||||
"deleteEventTitle": "Elimina Evento",
|
||||
"deleteEventDescription": "Sei sicuro di voler eliminare \"{eventName}\"? Questa azione non può essere annullata e rimuoverà tutti gli RSVP.",
|
||||
"deleteButton": "Elimina",
|
||||
"viewEventAriaLabel": "Visualizza evento",
|
||||
"editEventAriaLabel": "Modifica evento",
|
||||
"deleteEventAriaLabel": "Elimina evento",
|
||||
"removeRsvpAriaLabel": "Rimuovi RSVP",
|
||||
"inviteLinkExpiresAt": "Questo link scade quando l'evento inizia: {time}"
|
||||
},
|
||||
"discover": {
|
||||
"title": "Scopri Eventi - Cactoide",
|
||||
"noPublicEventsTitle": "Ancora Nessun Evento Pubblico",
|
||||
"noPublicEventsDescription": "Al momento non ci sono eventi pubblici disponibili. Sii il primo a crearne uno!",
|
||||
"createButton": "Crea",
|
||||
"publicEventsTitle": "Eventi Pubblici ({count})",
|
||||
"publicEventsDescription": "Scopri eventi creati dalla comunità",
|
||||
"searchPlaceholder": "Cerca eventi per nome, luogo...",
|
||||
"searchInputAriaLabel": "Input di ricerca",
|
||||
"toggleFiltersAriaLabel": "Attiva/Disattiva filtri",
|
||||
"typeFilterLabel": "Tipo:",
|
||||
"typeFilterAll": "Tutti",
|
||||
"typeFilterLimited": "Limitati",
|
||||
"typeFilterUnlimited": "Illimitati",
|
||||
"statusFilterLabel": "Stato:",
|
||||
"statusFilterAll": "Tutti gli eventi",
|
||||
"statusFilterUpcoming": "Eventi imminenti",
|
||||
"statusFilterPast": "Eventi passati",
|
||||
"timeFilterLabel": "Orario:",
|
||||
"timeFilterAny": "Qualsiasi orario",
|
||||
"timeFilterNextWeek": "Prossima settimana",
|
||||
"timeFilterNextMonth": "Prossimo mese",
|
||||
"sortOrderLabel": "Ordina:",
|
||||
"sortOrderEarliest": "Prima i più vicini",
|
||||
"sortOrderLatest": "Prima i più recenti",
|
||||
"viewButton": "Visualizza",
|
||||
"noEventsFoundTitle": "Nessun evento trovato",
|
||||
"noEventsFoundDescription": "Prova a modificare i termini di ricerca o sfoglia tutti gli eventi"
|
||||
},
|
||||
"calendar": {
|
||||
"addToCalendarTitle": "Aggiungi al Calendario",
|
||||
"googleCalendarTitle": "Google Calendar",
|
||||
"googleCalendarDescription": "Aggiungi a Google Calendar",
|
||||
"microsoftOutlookTitle": "Microsoft Outlook",
|
||||
"microsoftOutlookDescription": "Aggiungi a Outlook Calendar",
|
||||
"downloadICalTitle": "Scarica File iCal",
|
||||
"downloadICalDescription": "Scarica file .ics per qualsiasi app di calendario"
|
||||
},
|
||||
"errors": {
|
||||
"title": "Errore - Cactoide",
|
||||
"errorTitle": "Errore",
|
||||
"anUnexpectedErrorOccurred": "Si è verificato un errore inaspettato.",
|
||||
"homeButton": "Home"
|
||||
},
|
||||
"layout": {
|
||||
"defaultTitle": "Cactoide -",
|
||||
"defaultDescription": "Crea e gestisci gli RSVP degli eventi",
|
||||
"userIdCookieText": "Il tuo UserID memorizzato come cookie:",
|
||||
"firstTimeVisiting": "Prima visita. Generazione di un nuovo UserID...",
|
||||
"copyright": "© 2025 Cactoide"
|
||||
}
|
||||
}
|
||||
275
src/lib/i18n/messages.json
Normal file
275
src/lib/i18n/messages.json
Normal file
@@ -0,0 +1,275 @@
|
||||
{
|
||||
"common": {
|
||||
"required": "*",
|
||||
"cancel": "Cancel",
|
||||
"create": "Create",
|
||||
"edit": "Edit",
|
||||
"delete": "Delete",
|
||||
"view": "View",
|
||||
"home": "Home",
|
||||
"loading": "Loading...",
|
||||
"error": "Error",
|
||||
"success": "Success",
|
||||
"name": "Name",
|
||||
"date": "Date",
|
||||
"time": "Time",
|
||||
"location": "Location",
|
||||
"locationType": "Location Type",
|
||||
"locationNone": "None",
|
||||
"locationText": "Text",
|
||||
"locationMaps": "Google Maps",
|
||||
"locationNoneDescription": "No location specified",
|
||||
"locationTextDescription": "Enter location as plain text.",
|
||||
"locationMapsDescription": "Enter Google Maps link.",
|
||||
"googleMapsUrl": "Google Maps URL",
|
||||
"googleMapsUrlPlaceholder": "https://maps.google.com/...",
|
||||
"type": "Type",
|
||||
"visibility": "Visibility",
|
||||
"public": "Public",
|
||||
"private": "Private",
|
||||
"inviteOnly": "Invite Only",
|
||||
"invite-only": "Invite Only",
|
||||
"limited": "Limited",
|
||||
"unlimited": "Unlimited",
|
||||
"capacity": "Capacity",
|
||||
"attendees": "Attendees",
|
||||
"attendeeLimit": "Attendee Limit",
|
||||
"enterLimit": "Enter limit",
|
||||
"enterEventName": "Enter event name",
|
||||
"enterLocation": "Enter location",
|
||||
"enterYourName": "Enter your name",
|
||||
"enterNumberOfGuests": "Enter number of guests",
|
||||
"yourName": "Your Name",
|
||||
"numberOfGuests": "Number of Guests",
|
||||
"addGuests": "Add guest users",
|
||||
"joinEvent": "Join Event",
|
||||
"addToCalendar": "Add to Calendar",
|
||||
"close": "Close",
|
||||
"closeModal": "Close modal",
|
||||
"removeRSVP": "Remove RSVP",
|
||||
"updating": "Updating...",
|
||||
"creating": "Creating...",
|
||||
"adding": "Adding...",
|
||||
"updateEvent": "Update Event",
|
||||
"createEvent": "Create Event",
|
||||
"createNewEvent": "Create New Event",
|
||||
"createYourFirstEvent": "Create Your First Event",
|
||||
"editEvent": "Edit Event",
|
||||
"deleteEvent": "Delete Event",
|
||||
"myEvents": "My Events",
|
||||
"discover": "Discover",
|
||||
"noEventsYet": "No Events Yet",
|
||||
"noPublicEventsYet": "No Public Events Yet",
|
||||
"noAttendeesYet": "No attendees yet",
|
||||
"beFirstToJoin": "Be the first to join!",
|
||||
"eventNotFound": "Event Not Found",
|
||||
"eventIsFull": "Event is Full!",
|
||||
"maximumCapacityReached": "Maximum capacity reached",
|
||||
"rsvpAddedSuccessfully": "RSVP added successfully!",
|
||||
"removedRsvpSuccessfully": "Removed RSVP successfully.",
|
||||
"inviteRequiredToDetails": "This event requires an invite link to see the details.",
|
||||
"invalidInviteToken": "Invalid invite token",
|
||||
"inviteTokenExpired": "Invite token has expired",
|
||||
"anUnexpectedErrorOccurred": "An unexpected error occurred.",
|
||||
"somethingWentWrong": "Something went wrong. Please try again.",
|
||||
"failedToAddRsvp": "Failed to add RSVP",
|
||||
"failedToRemoveRsvp": "Failed to remove RSVP",
|
||||
"failedToDeleteEvent": "Failed to delete event",
|
||||
"youMayNotHavePermission": "You may not have permission to delete this event.",
|
||||
"anErrorOccurredWhileDeleting": "An error occurred while deleting the event:",
|
||||
"databaseUnreachable": "Database unreachable.",
|
||||
"eventIdNotFound": "EventId not found",
|
||||
"eventNotExists": "Event not found",
|
||||
"failedToLoadEvent": "Failed to load event",
|
||||
"nameAndUserIdRequired": "Name and user ID are required",
|
||||
"eventCapacityExceeded": "Event capacity exceeded. You're trying to add {guests} attendees (including yourself), but only {remaining} spots remain.",
|
||||
"nameAlreadyExists": "Name already exists for this event",
|
||||
"missingOrEmptyFields": "Missing or empty fields: {fields}",
|
||||
"dateCannotBeInPast": "Date cannot be in the past.",
|
||||
"limitMustBeAtLeast2": "Limit must be at least 2 for limited events.",
|
||||
"unauthorized": "Unauthorized",
|
||||
"youCanOnlyEditYourOwnEvents": "You can only edit your own events",
|
||||
"youDoNotHavePermissionToDelete": "You do not have permission to delete this event",
|
||||
"eventIdAndUserIdRequired": "Event ID and User ID are required",
|
||||
"guestsWillBeAddedAs": "Guests will be added as \"{name}'s Guest #1\", \"{name}'s Guest #2\", etc.",
|
||||
"yourNamePlaceholder": "Your Name",
|
||||
"atTime": "at"
|
||||
},
|
||||
"navigation": {
|
||||
"home": "Home",
|
||||
"discover": "Discover",
|
||||
"create": "Create",
|
||||
"myEvents": "My Events"
|
||||
},
|
||||
"home": {
|
||||
"title": "Cactoide - The RSVP site",
|
||||
"description": "Create and manage event RSVPs. No registration required, instant sharing.",
|
||||
"mainTitle": "Cactoide(ea)",
|
||||
"subtitle": "The Ultimate RSVP Platform",
|
||||
"tagline": "Create, share, and manage events with zero friction.",
|
||||
"whyCactoideTitle": "Why Cactoide(ae)?🌵",
|
||||
"whyCactoideDescription": "Like the cactus, great events bloom under any condition when managed with care. Cactoide(ae) helps you streamline RSVPs, simplify coordination, and keep every detail efficient—so your gatherings are resilient, vibrant, and unforgettable.",
|
||||
"createEventNow": "Create Event Now",
|
||||
"discoverPublicEventsTitle": "Discover Public Events",
|
||||
"discoverPublicEventsDescription": "See what others are planning and get inspired",
|
||||
"browseAllPublicEvents": "Browse All Public Events",
|
||||
"whyCactoideFeatureTitle": "Why Cactoide?",
|
||||
"instantEventCreationTitle": "Instant Event Creation",
|
||||
"instantEventCreationDescription": "Create events in seconds with our streamlined form. No accounts, no waiting, just pure efficiency.",
|
||||
"oneClickSharingTitle": "One-Click Sharing",
|
||||
"oneClickSharingDescription": "Each event gets a unique, memorable URL. Share instantly via any platform or messaging app.",
|
||||
"allInOneClarityTitle": "All-in-One Clarity",
|
||||
"allInOneClarityDescription": "No more scrolling through endless chats and reactions. See everyone's availability and responses neatly in one place.",
|
||||
"noHassleNoSignUpsTitle": "No Hassle, No Sign-Ups",
|
||||
"noHassleNoSignUpsDescription": "Skip registrations and endless forms. Unlike other event platforms, you create and share instantly — no accounts, no barriers.",
|
||||
"smartLimitsTitle": "Smart Limits",
|
||||
"smartLimitsDescription": "Choose between unlimited RSVPs or set a limited capacity. Perfect for any event size.",
|
||||
"effortlessSimplicityTitle": "Effortless Simplicity",
|
||||
"effortlessSimplicityDescription": "Designed to be instantly clear and easy. No learning curve — just open, create, and go.",
|
||||
"howItWorksTitle": "How It Works",
|
||||
"step1Title": "Create Event",
|
||||
"step1Description": "Fill out a simple form with event details. Choose between limited or unlimited capacity.",
|
||||
"step2Title": "Get Unique URL",
|
||||
"step2Description": "Receive a random, memorable URL for your event. Perfect for sharing anywhere.",
|
||||
"step3Title": "Collect RSVPs",
|
||||
"step3Description": "People visit your link and join with just their name. No accounts needed.",
|
||||
"ctaTitle": "Ready to Create Your First Event?",
|
||||
"ctaDescription": "Join thousands of event organizers who trust Cactoide",
|
||||
"ctaButton": "Create"
|
||||
},
|
||||
"create": {
|
||||
"title": "Create Event - Cactoide",
|
||||
"formTitle": "Create New Event",
|
||||
"eventNameLabel": "Name",
|
||||
"eventNamePlaceholder": "Enter event name",
|
||||
"dateLabel": "Date",
|
||||
"timeLabel": "Time",
|
||||
"locationLabel": "Location",
|
||||
"locationPlaceholder": "Enter location",
|
||||
"locationTypeLabel": "Location Type",
|
||||
"locationNoneOption": "None",
|
||||
"locationTextOption": "Plain Text",
|
||||
"locationMapsOption": "Google Maps",
|
||||
"locationNoneDescription": "No location specified.",
|
||||
"locationTextDescription": "Enter location as plain text.",
|
||||
"locationMapsDescription": "Enter Google Maps link.",
|
||||
"googleMapsUrlLabel": "Google Maps URL",
|
||||
"googleMapsUrlPlaceholder": "https://maps.google.com/...",
|
||||
"typeLabel": "Type",
|
||||
"unlimitedOption": "Unlimited",
|
||||
"limitedOption": "Limited",
|
||||
"attendeeLimitLabel": "Attendee Limit",
|
||||
"attendeeLimitPlaceholder": "Enter limit",
|
||||
"visibilityLabel": "Visibility",
|
||||
"publicOption": "🌍 Public",
|
||||
"privateOption": "🔒 Private",
|
||||
"inviteOnlyOption": "🚧 Invite Only",
|
||||
"publicDescription": "Public events are visible to everyone and can be discovered by others.",
|
||||
"privateDescription": "Private events are only visible to you and people you share the link with.",
|
||||
"inviteOnlyDescription": "Event is public but requires a special invite link to attend.",
|
||||
"creatingEvent": "Creating Event...",
|
||||
"createEventButton": "Create Event"
|
||||
},
|
||||
"event": {
|
||||
"title": "{eventName} - Cactoide",
|
||||
"eventTitle": "Event - Cactoide",
|
||||
"editTitle": "Edit Event - {eventName} - Cactoide",
|
||||
"myEventsTitle": "My Events - Cactoide",
|
||||
"eventNotFoundTitle": "Event Not Found",
|
||||
"eventNotFoundDescription": "The event you're looking for doesn't exist or has been removed.",
|
||||
"joinThisEvent": "Join This Event",
|
||||
"eventIsFull": "Event is Full!",
|
||||
"maximumCapacityReached": "Maximum capacity reached",
|
||||
"yourNameLabel": "Your Name",
|
||||
"yourNamePlaceholder": "Enter your name",
|
||||
"addGuestsLabel": "Add guest users",
|
||||
"numberOfGuestsLabel": "Number of Guests",
|
||||
"numberOfGuestsPlaceholder": "Enter number of guests",
|
||||
"guestsWillBeAddedAs": "Guests will be added as \"{name}'s Guest #1\", \"{name}'s Guest #2\", etc.",
|
||||
"joinEventButton": "Join Event",
|
||||
"joinEventWithGuests": "Join Event + {count} Guest{plural}",
|
||||
"adding": "Adding...",
|
||||
"attendeesTitle": "Attendees",
|
||||
"noAttendeesYet": "No attendees yet",
|
||||
"beFirstToJoin": "Be the first to join!",
|
||||
"copyLinkButton": "Copy Link",
|
||||
"copyInviteLinkButton": "Copy Invite Link",
|
||||
"inviteOnlyBadge": "Invite Only",
|
||||
"inviteOnlyBannerTitle": "Invite Only Event",
|
||||
"inviteOnlyBannerSubtitle": "You're viewing this event through a special invite link",
|
||||
"addToCalendarButton": "Add to Calendar",
|
||||
"eventLinkCopied": "Event link copied to clipboard.",
|
||||
"inviteLinkCopied": "Invite link copied to clipboard.",
|
||||
"rsvpAddedSuccessfully": "RSVP added successfully.",
|
||||
"removedRsvpSuccessfully": "Removed RSVP successfully.",
|
||||
"failedToAddRsvp": "Failed to add RSVP",
|
||||
"failedToRemoveRsvp": "Failed to remove RSVP",
|
||||
"editEventTitle": "Edit Event",
|
||||
"editEventDescription": "Update your event details",
|
||||
"updatingEvent": "Updating...",
|
||||
"updateEventButton": "Update Event",
|
||||
"myEventsDescription": "Manage your created events",
|
||||
"noEventsYetTitle": "No Events Yet",
|
||||
"noEventsYetDescription": "You haven't created any events yet. Start by creating your first event!",
|
||||
"createYourFirstEventButton": "Create Your First Event",
|
||||
"deleteEventTitle": "Delete Event",
|
||||
"deleteEventDescription": "Are you sure you want to delete \"{eventName}\"? This action cannot be undone and will remove all RSVPs.",
|
||||
"deleteButton": "Delete",
|
||||
"viewEventAriaLabel": "View event",
|
||||
"editEventAriaLabel": "Edit event",
|
||||
"deleteEventAriaLabel": "Delete event",
|
||||
"removeRsvpAriaLabel": "Remove RSVP",
|
||||
"inviteLinkExpiresAt": "This link expires when the event starts: {time}"
|
||||
},
|
||||
"discover": {
|
||||
"title": "Discover Events - Cactoide",
|
||||
"noPublicEventsTitle": "No Public Events Yet",
|
||||
"noPublicEventsDescription": "There are no public events available at the moment. Be the first to create one!",
|
||||
"createButton": "Create",
|
||||
"publicEventsTitle": "Public Events ({count})",
|
||||
"publicEventsDescription": "Discover events created by the community",
|
||||
"searchPlaceholder": "Search events by name, location...",
|
||||
"searchInputAriaLabel": "Search input",
|
||||
"toggleFiltersAriaLabel": "Toggle filters",
|
||||
"typeFilterLabel": "Type:",
|
||||
"typeFilterAll": "All",
|
||||
"typeFilterLimited": "Limited",
|
||||
"typeFilterUnlimited": "Unlimited",
|
||||
"statusFilterLabel": "Status:",
|
||||
"statusFilterAll": "All events",
|
||||
"statusFilterUpcoming": "Upcoming events",
|
||||
"statusFilterPast": "Past events",
|
||||
"timeFilterLabel": "Time:",
|
||||
"timeFilterAny": "Any time",
|
||||
"timeFilterNextWeek": "Next week",
|
||||
"timeFilterNextMonth": "Next month",
|
||||
"sortOrderLabel": "Sort:",
|
||||
"sortOrderEarliest": "Earliest first",
|
||||
"sortOrderLatest": "Latest first",
|
||||
"viewButton": "View",
|
||||
"noEventsFoundTitle": "No events found",
|
||||
"noEventsFoundDescription": "Try adjusting your search terms or browse all events"
|
||||
},
|
||||
"calendar": {
|
||||
"addToCalendarTitle": "Add to Calendar",
|
||||
"googleCalendarTitle": "Google Calendar",
|
||||
"googleCalendarDescription": "Add to Google Calendar",
|
||||
"microsoftOutlookTitle": "Microsoft Outlook",
|
||||
"microsoftOutlookDescription": "Add to Outlook Calendar",
|
||||
"downloadICalTitle": "Download iCal File",
|
||||
"downloadICalDescription": "Download .ics file for any calendar app"
|
||||
},
|
||||
"errors": {
|
||||
"title": "Error - Cactoide",
|
||||
"errorTitle": "Error",
|
||||
"anUnexpectedErrorOccurred": "An unexpected error occurred.",
|
||||
"homeButton": "Home"
|
||||
},
|
||||
"layout": {
|
||||
"defaultTitle": "Cactoide -",
|
||||
"defaultDescription": "Create and manage event RSVPs",
|
||||
"userIdCookieText": "Your UserID stored as a cookie:",
|
||||
"firstTimeVisiting": "First time visiting. Generating new UserID...",
|
||||
"copyright": "© 2025 Cactoide"
|
||||
}
|
||||
}
|
||||
33
src/lib/inviteTokenHelpers.ts
Normal file
33
src/lib/inviteTokenHelpers.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
/**
|
||||
* Generates a secure random token for invite links
|
||||
* @param length - Length of the token (default: 32)
|
||||
* @returns A random hex string
|
||||
*/
|
||||
export function generateInviteToken(length: number = 32): string {
|
||||
return randomBytes(length / 2).toString('hex');
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the expiration time for an invite token
|
||||
* The token expires when the event starts
|
||||
* @param eventDate - The event date in YYYY-MM-DD format
|
||||
* @param eventTime - The event time in HH:MM:SS format
|
||||
* @returns ISO string of the expiration time
|
||||
*/
|
||||
export function calculateTokenExpiration(eventDate: string, eventTime: string): string {
|
||||
const eventDateTime = new Date(`${eventDate}T${eventTime}`);
|
||||
return eventDateTime.toISOString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if an invite token is still valid
|
||||
* @param expiresAt - The expiration time as ISO string
|
||||
* @returns true if token is still valid, false otherwise
|
||||
*/
|
||||
export function isTokenValid(expiresAt: string): boolean {
|
||||
const now = new Date();
|
||||
const expiration = new Date(expiresAt);
|
||||
return now < expiration;
|
||||
}
|
||||
22
src/lib/logger.ts
Normal file
22
src/lib/logger.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import pino from 'pino';
|
||||
import { LOG_PRETTY, LOG_LEVEL } from '$env/static/private';
|
||||
|
||||
const USE_PRETTY_LOGS = LOG_PRETTY === 'true';
|
||||
|
||||
const transport = USE_PRETTY_LOGS
|
||||
? {
|
||||
target: 'pino-pretty',
|
||||
options: {
|
||||
colorize: true,
|
||||
translateTime: 'SYS:standard',
|
||||
ignore: 'pid,hostname'
|
||||
}
|
||||
}
|
||||
: undefined;
|
||||
|
||||
export const logger = pino({
|
||||
level: LOG_LEVEL,
|
||||
transport
|
||||
});
|
||||
|
||||
export type Logger = typeof logger;
|
||||
@@ -1,6 +1,7 @@
|
||||
export type EventType = 'limited' | 'unlimited';
|
||||
export type EventVisibility = 'public' | 'private';
|
||||
export type EventVisibility = 'public' | 'private' | 'invite-only';
|
||||
export type ActionType = 'add' | 'remove';
|
||||
export type LocationType = 'none' | 'text' | 'maps';
|
||||
|
||||
export interface Event {
|
||||
id: string;
|
||||
@@ -8,6 +9,8 @@ export interface Event {
|
||||
date: string;
|
||||
time: string;
|
||||
location: string;
|
||||
location_type: LocationType;
|
||||
location_url?: string;
|
||||
type: EventType;
|
||||
attendee_limit?: number;
|
||||
visibility: EventVisibility;
|
||||
@@ -29,6 +32,8 @@ export interface CreateEventData {
|
||||
date: string;
|
||||
time: string;
|
||||
location: string;
|
||||
location_type: LocationType;
|
||||
location_url?: string;
|
||||
type: EventType;
|
||||
attendee_limit?: number;
|
||||
visibility: EventVisibility;
|
||||
@@ -40,6 +45,8 @@ export interface DatabaseEvent {
|
||||
date: string;
|
||||
time: string;
|
||||
location: string;
|
||||
location_type: LocationType;
|
||||
location_url?: string;
|
||||
type: EventType;
|
||||
attendee_limit?: number;
|
||||
visibility: EventVisibility;
|
||||
@@ -55,3 +62,11 @@ export interface DatabaseRSVP {
|
||||
user_id: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface InviteToken {
|
||||
id: string;
|
||||
event_id: string;
|
||||
token: string;
|
||||
expires_at: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
$: error = $page.error;
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Error - Cactoide</title>
|
||||
<title>{t('errors.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
<!-- Error Content -->
|
||||
<div class="container mx-auto flex-1 px-4 py-8">
|
||||
<div class="mx-auto max-w-md text-center">
|
||||
<div class="rounded-sm border border-red-500/30 bg-red-900/20 p-8">
|
||||
<div class="rounded-sm border border-red-500/30 bg-red-900 p-8">
|
||||
<div class="mb-4 text-6xl text-red-400">🚨</div>
|
||||
<h2 class="mb-4 text-2xl font-bold text-red-400">Error</h2>
|
||||
<h2 class="mb-4 text-2xl font-bold text-red-400">{t('errors.errorTitle')}</h2>
|
||||
|
||||
<p class=" mb-6">
|
||||
{error?.message || 'An unexpected error occurred.'}
|
||||
{error?.message || t('errors.anUnexpectedErrorOccurred')}
|
||||
</p>
|
||||
|
||||
<div class="space-y-3">
|
||||
@@ -26,7 +27,7 @@
|
||||
on:click={() => goto('/')}
|
||||
class="border-white-500 bg-white-400/20 mt-2 w-48 rounded-sm border px-6 py-3 font-semibold text-white duration-400 hover:scale-110 hover:bg-white/10"
|
||||
>
|
||||
Home
|
||||
{t('errors.homeButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,20 +1,5 @@
|
||||
import { generateUserId } from '$lib/generateUserId.js';
|
||||
|
||||
export function load({ cookies }) {
|
||||
const cactoideUserId = cookies.get('cactoideUserId');
|
||||
const userId = generateUserId();
|
||||
|
||||
const DAYS = 400; // practical upper bound in many browsers for cookies
|
||||
const MAX_AGE = 60 * 60 * 24 * DAYS;
|
||||
const PATH = '/';
|
||||
|
||||
if (!cactoideUserId) {
|
||||
console.debug(`There is no cactoideUserId cookie, generating new one...`);
|
||||
cookies.set('cactoideUserId', userId, { path: PATH, maxAge: MAX_AGE });
|
||||
} else {
|
||||
console.debug(`cactoideUserId: ${cactoideUserId}`);
|
||||
console.debug(`cactoideUserId cookie found, using existing one...`);
|
||||
}
|
||||
|
||||
return {
|
||||
cactoideUserId
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<script>
|
||||
import '../app.css';
|
||||
import Navbar from '$lib/components/Navbar.svelte';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
let { data } = $props();
|
||||
let { data, children } = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Cactoide -</title>
|
||||
<meta name="description" content="Create and manage event RSVPs" />
|
||||
<title>{t('layout.defaultTitle')}</title>
|
||||
<meta name="description" content={t('layout.defaultDescription')} />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
|
||||
@@ -20,7 +21,7 @@
|
||||
|
||||
<!-- Main content -->
|
||||
<main class="relative z-10">
|
||||
<slot />
|
||||
{@render children?.()}
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
@@ -28,13 +29,12 @@
|
||||
<div class="container mx-auto px-4 text-center">
|
||||
<div class="text-sm">
|
||||
<p class="mb-4 text-gray-100/80">
|
||||
Your UserID storated as a cookie: <span class="font-bold text-violet-400"
|
||||
>{data.cactoideUserId
|
||||
? data.cactoideUserId
|
||||
: 'First time visiting. Generating new UserID...'}</span
|
||||
{t('layout.userIdCookieText')}
|
||||
<span class="font-bold text-violet-400"
|
||||
>{data.cactoideUserId ? data.cactoideUserId : t('layout.firstTimeVisiting')}</span
|
||||
>
|
||||
</p>
|
||||
<p>© 2025 Cactoide</p>
|
||||
<p>{t('layout.copyright')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
11
src/routes/+page.server.ts
Normal file
11
src/routes/+page.server.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { PUBLIC_LANDING_INFO } from '$env/static/public';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
if (PUBLIC_LANDING_INFO === 'false') {
|
||||
throw redirect(302, '/discover');
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
@@ -1,45 +1,41 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Cactoide - The RSVP site</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Create and manage event RSVPs. No registration required, instant sharing."
|
||||
/>
|
||||
<title>{t('home.title')}</title>
|
||||
<meta name="description" content={t('home.description')} />
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
<section class="mx-auto w-full pt-20 pb-20 md:w-3/4">
|
||||
<div class="container mx-auto px-4 text-center">
|
||||
<h1 class="text-5xl font-bold md:text-7xl lg:text-8xl">
|
||||
Cactoide(ea)<span class="text-violet-400"
|
||||
{t('home.mainTitle')}<span class="text-violet-400"
|
||||
><a href="https://en.wikipedia.org/wiki/Cactoideae" target="_blank">*</a></span
|
||||
> 🌵
|
||||
</h1>
|
||||
|
||||
<h2 class="mt-6 text-xl md:text-2xl">The Ultimate RSVP Platform</h2>
|
||||
<h2 class="mt-6 text-xl md:text-2xl">{t('home.subtitle')}</h2>
|
||||
<p class="mt-4 text-lg italic md:text-xl">
|
||||
Create, share, and manage events with zero friction.
|
||||
{t('home.tagline')}
|
||||
</p>
|
||||
|
||||
<h2 class="mt-6 pt-8 text-xl md:text-2xl">
|
||||
Why Cactoide(ae)<span class="text-violet-400"
|
||||
{t('home.whyCactoideTitle')}<span class="text-violet-400"
|
||||
><a href="https://en.wikipedia.org/wiki/Cactoideae" target="_blank">*</a></span
|
||||
>?🌵
|
||||
>
|
||||
</h2>
|
||||
<p class="mt-4 text-lg md:text-xl">
|
||||
Like the cactus, great events bloom under any condition when managed with care. Cactoide(ae)
|
||||
helps you streamline RSVPs, simplify coordination, and keep every detail efficient—so your
|
||||
gatherings are resilient, vibrant, and unforgettable.
|
||||
{t('home.whyCactoideDescription')}
|
||||
</p>
|
||||
|
||||
<button
|
||||
on:click={() => goto('/create')}
|
||||
class="mt-8 rounded-sm border-2 border-violet-500 px-8 py-4 font-bold duration-400 hover:scale-110 hover:bg-violet-500/10"
|
||||
>
|
||||
Create Event Now
|
||||
{t('home.createEventNow')}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
@@ -48,8 +44,8 @@
|
||||
<section class="py-8">
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="mb-16 text-center">
|
||||
<h2 class="text-4xl font-bold text-white">Discover Public Events</h2>
|
||||
<p class="mt-4 text-xl text-slate-300">See what others are planning and get inspired</p>
|
||||
<h2 class="text-4xl font-bold text-white">{t('home.discoverPublicEventsTitle')}</h2>
|
||||
<p class="mt-4 text-xl text-slate-300">{t('home.discoverPublicEventsDescription')}</p>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
@@ -57,7 +53,7 @@
|
||||
on:click={() => goto('/discover')}
|
||||
class="rounded-sm border-2 border-violet-500 px-8 py-4 font-bold duration-400 hover:scale-110 hover:bg-violet-500/10"
|
||||
>
|
||||
Browse All Public Events
|
||||
{t('home.browseAllPublicEvents')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,7 +63,7 @@
|
||||
<section class="py-20">
|
||||
<div class="container mx-auto px-4">
|
||||
<h2 class=" mb-16 text-center text-4xl font-bold">
|
||||
Why <span class="text-violet-400">Cactoide?</span>
|
||||
{t('home.whyCactoideFeatureTitle')}
|
||||
</h2>
|
||||
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-3">
|
||||
<!-- Feature 1 -->
|
||||
@@ -75,10 +71,9 @@
|
||||
<div class="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full">
|
||||
<span class="text-4xl">🎯</span>
|
||||
</div>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">Instant Event Creation</h3>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">{t('home.instantEventCreationTitle')}</h3>
|
||||
<p class="">
|
||||
Create events in seconds with our streamlined form. No accounts, no waiting, just pure
|
||||
efficiency.
|
||||
{t('home.instantEventCreationDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -87,10 +82,9 @@
|
||||
<div class="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full">
|
||||
<span class="text-4xl">🔗</span>
|
||||
</div>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">One-Click Sharing</h3>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">{t('home.oneClickSharingTitle')}</h3>
|
||||
<p class="">
|
||||
Each event gets a unique, memorable URL. Share instantly via any platform or messaging
|
||||
app.
|
||||
{t('home.oneClickSharingDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -99,10 +93,9 @@
|
||||
<div class="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full">
|
||||
<span class="text-4xl">🔍</span>
|
||||
</div>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">All-in-One Clarity</h3>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">{t('home.allInOneClarityTitle')}</h3>
|
||||
<p class="">
|
||||
No more scrolling through endless chats and reactions. See everyone’s availability and
|
||||
responses neatly in one place.
|
||||
{t('home.allInOneClarityDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -111,10 +104,9 @@
|
||||
<div class="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full">
|
||||
<span class="text-4xl">👤</span>
|
||||
</div>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">No Hassle, No Sign-Ups</h3>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">{t('home.noHassleNoSignUpsTitle')}</h3>
|
||||
<p class="">
|
||||
Skip registrations and endless forms. Unlike other event platforms, you create and share
|
||||
instantly — no accounts, no barriers.
|
||||
{t('home.noHassleNoSignUpsDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -123,9 +115,9 @@
|
||||
<div class="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full">
|
||||
<span class="text-4xl">🛡️</span>
|
||||
</div>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">Smart Limits</h3>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">{t('home.smartLimitsTitle')}</h3>
|
||||
<p class="">
|
||||
Choose between unlimited RSVPs or set a limited capacity. Perfect for any event size.
|
||||
{t('home.smartLimitsDescription')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -134,9 +126,9 @@
|
||||
<div class="mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full">
|
||||
<span class="text-4xl">✨</span>
|
||||
</div>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">Effortless Simplicity</h3>
|
||||
<h3 class="mb-4 text-xl font-bold text-white">{t('home.effortlessSimplicityTitle')}</h3>
|
||||
<p class="">
|
||||
Designed to be instantly clear and easy. No learning curve — just open, create, and go.
|
||||
{t('home.effortlessSimplicityDescription')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,35 +138,38 @@
|
||||
<!-- How It Works Section -->
|
||||
<section class="py-20">
|
||||
<div class="container mx-auto px-4">
|
||||
<h2 class=" mb-16 text-center text-4xl font-bold">How It Works</h2>
|
||||
<h2 class=" mb-16 text-center text-4xl font-bold">{t('home.howItWorksTitle')}</h2>
|
||||
|
||||
<div class="grid gap-8 md:grid-cols-3">
|
||||
<!-- Step 1 -->
|
||||
<div class="text-center">
|
||||
<h3 class="mb-4 text-xl font-bold text-white">
|
||||
<span class="text-violet-400">1.</span> Create Event
|
||||
<span class="text-violet-400">1.</span>
|
||||
{t('home.step1Title')}
|
||||
</h3>
|
||||
<p class="">
|
||||
Fill out a simple form with event details. Choose between limited or unlimited capacity.
|
||||
{t('home.step1Description')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Step 2 -->
|
||||
<div class="text-center">
|
||||
<h3 class="mb-4 text-xl font-bold text-white">
|
||||
<span class="text-violet-400">2.</span> Get Unique URL
|
||||
<span class="text-violet-400">2.</span>
|
||||
{t('home.step2Title')}
|
||||
</h3>
|
||||
<p class="">
|
||||
Receive a random, memorable URL for your event. Perfect for sharing anywhere.
|
||||
{t('home.step2Description')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Step 3 -->
|
||||
<div class="text-center">
|
||||
<h3 class="mb-4 text-xl font-bold text-white">
|
||||
<span class="text-violet-400">3.</span> Collect RSVPs
|
||||
<span class="text-violet-400">3.</span>
|
||||
{t('home.step3Title')}
|
||||
</h3>
|
||||
<p class="">People visit your link and join with just their name. No accounts needed.</p>
|
||||
<p class="">{t('home.step3Description')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -184,14 +179,14 @@
|
||||
<section class="py-20">
|
||||
<div class="container mx-auto px-4 text-center">
|
||||
<h2 class="mb-6 text-4xl font-bold text-white">
|
||||
Ready to Create Your <span class="text-violet-400">First Event</span>?
|
||||
{t('home.ctaTitle')}
|
||||
</h2>
|
||||
<p class="mb-10 text-xl">Join thousands of event organizers who trust Cactoide</p>
|
||||
<p class="mb-10 text-xl">{t('home.ctaDescription')}</p>
|
||||
<button
|
||||
on:click={() => goto('/create')}
|
||||
class="rounded-sm border-2 border-violet-500 px-8 py-4 font-bold duration-400 hover:scale-110 hover:bg-violet-500/10"
|
||||
>
|
||||
Create
|
||||
{t('home.ctaButton')}
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { database } from '$lib/database/db';
|
||||
import { events } from '$lib/database/schema';
|
||||
import { events, inviteTokens } from '$lib/database/schema';
|
||||
import { fail, redirect } from '@sveltejs/kit';
|
||||
import type { Actions } from './$types';
|
||||
import { generateInviteToken, calculateTokenExpiration } from '$lib/inviteTokenHelpers.js';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
// Generate a random URL-friendly ID
|
||||
function generateEventId(): string {
|
||||
@@ -21,9 +23,11 @@ export const actions: Actions = {
|
||||
const date = formData.get('date') as string;
|
||||
const time = formData.get('time') as string;
|
||||
const location = formData.get('location') as string;
|
||||
const locationType = formData.get('location_type') as 'none' | 'text' | 'maps';
|
||||
const locationUrl = formData.get('location_url') as string;
|
||||
const type = formData.get('type') as 'limited' | 'unlimited';
|
||||
const attendeeLimit = formData.get('attendee_limit') as string;
|
||||
const visibility = formData.get('visibility') as 'public' | 'private';
|
||||
const visibility = formData.get('visibility') as 'public' | 'private' | 'invite-only';
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
// Validation
|
||||
@@ -32,7 +36,9 @@ export const actions: Actions = {
|
||||
if (!name?.trim()) missingFields.push('name');
|
||||
if (!date) missingFields.push('date');
|
||||
if (!time) missingFields.push('time');
|
||||
if (!location?.trim()) missingFields.push('location');
|
||||
if (!locationType) missingFields.push('location_type');
|
||||
if (locationType === 'text' && !location?.trim()) missingFields.push('location');
|
||||
if (locationType === 'maps' && !locationUrl?.trim()) missingFields.push('location_url');
|
||||
if (!userId) missingFields.push('userId');
|
||||
|
||||
if (missingFields.length > 0) {
|
||||
@@ -43,6 +49,8 @@ export const actions: Actions = {
|
||||
date,
|
||||
time,
|
||||
location,
|
||||
location_type: locationType,
|
||||
location_url: locationUrl,
|
||||
type,
|
||||
attendee_limit: attendeeLimit,
|
||||
visibility
|
||||
@@ -50,22 +58,49 @@ export const actions: Actions = {
|
||||
});
|
||||
}
|
||||
|
||||
if (new Date(date) < new Date()) {
|
||||
// Check if date is in the past using local timezone
|
||||
const [year, month, day] = date.split('-').map(Number);
|
||||
const eventDate = new Date(year, month - 1, day);
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
if (eventDate < today) {
|
||||
return fail(400, {
|
||||
error: 'Date cannot be in the past.',
|
||||
values: { name, date, time, location, type, attendee_limit: attendeeLimit, visibility }
|
||||
values: {
|
||||
name,
|
||||
date,
|
||||
time,
|
||||
location,
|
||||
location_type: locationType,
|
||||
location_url: locationUrl,
|
||||
type,
|
||||
attendee_limit: attendeeLimit,
|
||||
visibility
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (type === 'limited' && (!attendeeLimit || parseInt(attendeeLimit) < 2)) {
|
||||
return fail(400, {
|
||||
error: 'Limit must be at least 2 for limited events.',
|
||||
values: { name, date, time, location, type, attendee_limit: attendeeLimit, visibility }
|
||||
values: {
|
||||
name,
|
||||
date,
|
||||
time,
|
||||
location,
|
||||
location_type: locationType,
|
||||
location_url: locationUrl,
|
||||
type,
|
||||
attendee_limit: attendeeLimit,
|
||||
visibility
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const eventId = generateEventId();
|
||||
|
||||
// Create the event
|
||||
await database
|
||||
.insert(events)
|
||||
.values({
|
||||
@@ -73,17 +108,37 @@ export const actions: Actions = {
|
||||
name: name.trim(),
|
||||
date: date,
|
||||
time: time,
|
||||
location: location.trim(),
|
||||
location: location?.trim() || '',
|
||||
locationType: locationType,
|
||||
locationUrl: locationType === 'maps' ? locationUrl?.trim() : null,
|
||||
type: type,
|
||||
attendeeLimit: type === 'limited' ? parseInt(attendeeLimit) : null,
|
||||
visibility: visibility,
|
||||
userId: userId
|
||||
userId: userId!
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Unexpected error', error);
|
||||
logger.error({ error, eventId, userId }, 'Unexpected error creating event');
|
||||
throw error;
|
||||
});
|
||||
|
||||
// Generate invite token for invite-only events
|
||||
if (visibility === 'invite-only') {
|
||||
const token = generateInviteToken();
|
||||
const expiresAt = calculateTokenExpiration(date, time);
|
||||
|
||||
await database
|
||||
.insert(inviteTokens)
|
||||
.values({
|
||||
eventId: eventId,
|
||||
token: token,
|
||||
expiresAt: new Date(expiresAt)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error creating invite token', error);
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
throw redirect(303, `/event/${eventId}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script lang="ts">
|
||||
import type { CreateEventData, EventType } from '$lib/types';
|
||||
import type { CreateEventData, EventType, LocationType } from '$lib/types';
|
||||
import { enhance } from '$app/forms';
|
||||
import { goto } from '$app/navigation';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
export let form;
|
||||
|
||||
@@ -9,9 +11,11 @@
|
||||
date: '',
|
||||
time: '',
|
||||
location: '',
|
||||
location_type: 'none',
|
||||
location_url: '',
|
||||
type: 'unlimited',
|
||||
attendee_limit: undefined,
|
||||
visibility: 'public'
|
||||
visibility: 'public' as 'public' | 'private' | 'invite-only'
|
||||
};
|
||||
|
||||
let errors: Record<string, string> = {};
|
||||
@@ -37,25 +41,42 @@
|
||||
};
|
||||
}
|
||||
|
||||
function handleTypeChange(type: EventType) {
|
||||
const handleTypeChange = (type: EventType) => {
|
||||
eventData.type = type;
|
||||
if (type === 'unlimited') {
|
||||
eventData.attendee_limit = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const handleLocationTypeChange = (locationType: LocationType) => {
|
||||
eventData.location_type = locationType;
|
||||
if (locationType === 'none') {
|
||||
eventData.location = '';
|
||||
eventData.location_url = '';
|
||||
} else if (locationType === 'text') {
|
||||
eventData.location_url = '';
|
||||
eventData.location = '';
|
||||
} else {
|
||||
eventData.location = 'Google Maps';
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
goto(`/discover`);
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Create Event - Cactoide</title>
|
||||
<title>{t('create.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
<!-- Main Content -->
|
||||
<div class="container mx-auto flex-1 px-4 py-8">
|
||||
<div class="mx-auto max-w-md">
|
||||
<div class="mx-auto max-w-2xl">
|
||||
<!-- Event Creation Form -->
|
||||
<div class="rounded-sm border p-8">
|
||||
<h2 class="mb-8 text-center text-3xl font-bold text-violet-400">Create New Event</h2>
|
||||
<h2 class="mb-8 text-center text-3xl font-bold text-violet-400">{t('create.formTitle')}</h2>
|
||||
|
||||
<form
|
||||
method="POST"
|
||||
@@ -66,7 +87,7 @@
|
||||
if (result.type === 'failure') {
|
||||
// Handle validation errors
|
||||
if (result.data?.error) {
|
||||
errors.server = result.data.error;
|
||||
errors.server = String(result.data.error);
|
||||
}
|
||||
}
|
||||
update();
|
||||
@@ -77,6 +98,7 @@
|
||||
<input type="hidden" name="userId" value={currentUserId} />
|
||||
<input type="hidden" name="type" value={eventData.type} />
|
||||
<input type="hidden" name="visibility" value={eventData.visibility} />
|
||||
<input type="hidden" name="location_type" value={eventData.location_type} />
|
||||
|
||||
{#if errors.server}
|
||||
<div class="mb-6 rounded-sm border border-red-200 bg-red-50 p-4 text-red-700">
|
||||
@@ -87,7 +109,7 @@
|
||||
<!-- Event Name -->
|
||||
<div>
|
||||
<label for="name" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Name <span class="text-red-400">*</span>
|
||||
{t('create.eventNameLabel')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="name"
|
||||
@@ -95,7 +117,7 @@
|
||||
type="text"
|
||||
bind:value={eventData.name}
|
||||
class="border-dark-300 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm"
|
||||
placeholder="Enter event name"
|
||||
placeholder={t('create.eventNamePlaceholder')}
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
@@ -108,7 +130,7 @@
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="date" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Date <span class="text-red-400">*</span>
|
||||
{t('create.dateLabel')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="date"
|
||||
@@ -126,7 +148,7 @@
|
||||
|
||||
<div>
|
||||
<label for="time" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Time <span class="text-red-400">*</span>
|
||||
{t('create.timeLabel')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="time"
|
||||
@@ -142,31 +164,103 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location -->
|
||||
<!-- Location Type -->
|
||||
<div>
|
||||
<fieldset>
|
||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('create.locationTypeLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</legend>
|
||||
<div class="grid grid-cols-3 gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.location_type ===
|
||||
'none'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => handleLocationTypeChange('none')}
|
||||
>
|
||||
{t('create.locationNoneOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.location_type ===
|
||||
'text'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => handleLocationTypeChange('text')}
|
||||
>
|
||||
{t('create.locationTextOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.location_type ===
|
||||
'maps'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => handleLocationTypeChange('maps')}
|
||||
>
|
||||
{t('create.locationMapsOption')}
|
||||
</button>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-slate-400 italic">
|
||||
{eventData.location_type === 'none'
|
||||
? t('create.locationNoneDescription')
|
||||
: eventData.location_type === 'text'
|
||||
? t('create.locationTextDescription')
|
||||
: t('create.locationMapsDescription')}
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Location Input (only show when not 'none') -->
|
||||
{#if eventData.location_type !== 'none'}
|
||||
<div>
|
||||
<label for="location" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Location <span class="text-red-400">*</span>
|
||||
{eventData.location_type === 'text'
|
||||
? t('create.locationLabel')
|
||||
: t('create.googleMapsUrlLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
{#if eventData.location_type === 'text'}
|
||||
<input
|
||||
id="location"
|
||||
name="location"
|
||||
type="text"
|
||||
bind:value={eventData.location}
|
||||
class="border-dark-300 placeholder-dark-500 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm transition-all"
|
||||
placeholder="Enter location"
|
||||
placeholder={t('create.locationPlaceholder')}
|
||||
maxlength="200"
|
||||
required
|
||||
/>
|
||||
{:else}
|
||||
<input
|
||||
id="location_url"
|
||||
name="location_url"
|
||||
type="url"
|
||||
bind:value={eventData.location_url}
|
||||
class="border-dark-300 placeholder-dark-500 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm transition-all"
|
||||
placeholder={t('create.googleMapsUrlPlaceholder')}
|
||||
maxlength="500"
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
{#if errors.location}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.location}</p>
|
||||
{/if}
|
||||
{#if errors.location_url}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.location_url}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Event Type -->
|
||||
<div>
|
||||
<label class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Type <span class="text-red-400">*</span></label
|
||||
>
|
||||
<fieldset>
|
||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('create.typeLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</legend>
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<button
|
||||
type="button"
|
||||
@@ -176,7 +270,7 @@
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => handleTypeChange('unlimited')}
|
||||
>
|
||||
Unlimited
|
||||
{t('create.unlimitedOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -186,16 +280,18 @@
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => handleTypeChange('limited')}
|
||||
>
|
||||
Limited
|
||||
{t('create.limitedOption')}
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Limit (only for limited events) -->
|
||||
{#if eventData.type === 'limited'}
|
||||
<div>
|
||||
<label for="limit" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Attendee Limit *
|
||||
{t('create.attendeeLimitLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="attendee_limit"
|
||||
@@ -205,7 +301,7 @@
|
||||
min="1"
|
||||
max="1000"
|
||||
class="border-dark-300 w-full rounded-sm border-2 bg-white px-4 py-3 text-slate-900 shadow-sm transition-all duration-200"
|
||||
placeholder="Enter limit"
|
||||
placeholder={t('create.attendeeLimitPlaceholder')}
|
||||
required
|
||||
/>
|
||||
{#if errors.attendee_limit}
|
||||
@@ -216,19 +312,21 @@
|
||||
|
||||
<!-- Event Visibility -->
|
||||
<div>
|
||||
<label class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
Visibility <span class="text-red-400">*</span></label
|
||||
>
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<fieldset>
|
||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('create.visibilityLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</legend>
|
||||
<div class="grid grid-cols-3 gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.visibility ===
|
||||
'public'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => (eventData.visibility = 'public')}
|
||||
>
|
||||
🌍 Public
|
||||
{t('create.publicOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@@ -238,43 +336,55 @@
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => (eventData.visibility = 'private')}
|
||||
>
|
||||
🔒 Private
|
||||
{t('create.privateOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.visibility ===
|
||||
'invite-only'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => (eventData.visibility = 'invite-only')}
|
||||
>
|
||||
{t('create.inviteOnlyOption')}
|
||||
</button>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-slate-400">
|
||||
<p class="mt-2 text-xs text-slate-400 italic">
|
||||
{eventData.visibility === 'public'
|
||||
? 'Public events are visible to everyone and can be discovered by others'
|
||||
: 'Private events are only visible to you and people you share the link with'}
|
||||
? t('create.publicDescription')
|
||||
: eventData.visibility === 'private'
|
||||
? t('create.privateDescription')
|
||||
: 'Event is public but requires a special invite link to attend'}
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="flex space-x-3">
|
||||
<button
|
||||
type="button"
|
||||
on:click={handleCancel}
|
||||
class="flex-1 rounded-sm border-2 border-slate-300 bg-slate-200 px-4 py-3 font-semibold text-slate-700 transition-all duration-200 hover:bg-slate-400 hover:text-slate-200"
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<!-- Submit Button -->
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
class="hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
class="hover:bg-violet-400/70'l flex-2 rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
{#if isSubmitting}
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="mr-2 h-5 w-5 animate-spin rounded-full border-b-2 border-white"></div>
|
||||
Creating Event...
|
||||
{t('create.creatingEvent')}
|
||||
</div>
|
||||
{:else}
|
||||
Create Event
|
||||
{t('create.createEventButton')}
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Info Section -->
|
||||
<div class="mt-8 p-6 text-center">
|
||||
<p class="text-dark-100 font-medium">
|
||||
Share the generated link with others to collect RSVPs.
|
||||
</p>
|
||||
<p class="mt-2 text-sm text-violet-300">
|
||||
No registration required • Mobile optimized • Instant sharing
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import { database } from '$lib/database/db';
|
||||
import { eq, desc } from 'drizzle-orm';
|
||||
import { desc, inArray } from 'drizzle-orm';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { events } from '$lib/database/schema';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
try {
|
||||
// Fetch all public events ordered by creation date (newest first)
|
||||
// Fetch all non-private events (public and invite-only) ordered by creation date (newest first)
|
||||
const publicEvents = await database
|
||||
.select()
|
||||
.from(events)
|
||||
.where(eq(events.visibility, 'public'))
|
||||
.where(inArray(events.visibility, ['public', 'invite-only']))
|
||||
.orderBy(desc(events.createdAt));
|
||||
|
||||
// Transform the database events to match the expected Event interface
|
||||
@@ -19,6 +20,8 @@ export const load: PageServerLoad = async () => {
|
||||
date: event.date, // Already in 'YYYY-MM-DD' format
|
||||
time: event.time, // Already in 'HH:MM:SS' format
|
||||
location: event.location,
|
||||
location_type: event.locationType,
|
||||
location_url: event.locationUrl,
|
||||
type: event.type,
|
||||
attendee_limit: event.attendeeLimit, // Note: schema uses camelCase
|
||||
visibility: event.visibility,
|
||||
@@ -31,7 +34,7 @@ export const load: PageServerLoad = async () => {
|
||||
events: transformedEvents
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Error loading public events:', error);
|
||||
logger.error({ error }, 'Error loading public events');
|
||||
|
||||
// Return empty array on error to prevent page crash
|
||||
return {
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
<script lang="ts">
|
||||
import type { Event, EventType } from '$lib/types';
|
||||
import { goto } from '$app/navigation';
|
||||
import type { PageData } from '../$types';
|
||||
import { formatTime, formatDate } from '$lib/dateFormatter';
|
||||
import { formatTime, formatDate, isEventInTimeRange } from '$lib/dateHelpers';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
import Fuse from 'fuse.js';
|
||||
|
||||
type DiscoverPageData = {
|
||||
events: Event[];
|
||||
};
|
||||
|
||||
let publicEvents: Event[] = [];
|
||||
let error = '';
|
||||
let searchQuery = '';
|
||||
let selectedEventType: EventType | 'all' = 'all';
|
||||
let selectedTimeFilter: 'any' | 'next-week' | 'next-month' = 'any';
|
||||
let selectedTemporalStatus: 'all' | 'upcoming' | 'past' = 'all';
|
||||
let selectedSortOrder: 'asc' | 'desc' = 'asc';
|
||||
let showFilters = false;
|
||||
let fuse: Fuse<Event>;
|
||||
|
||||
export let data: PageData;
|
||||
export let data: DiscoverPageData;
|
||||
// Use the server-side data
|
||||
$: publicEvents = data.events;
|
||||
$: publicEvents = data?.events || [];
|
||||
|
||||
// Initialize Fuse.js with search options
|
||||
$: fuse = new Fuse(publicEvents, {
|
||||
@@ -26,7 +34,7 @@
|
||||
includeMatches: true
|
||||
});
|
||||
|
||||
// Filter events based on search query and event type using Fuse.js
|
||||
// Filter events based on search query, event type, time filter, and temporal status
|
||||
$: filteredEvents = (() => {
|
||||
let events = publicEvents;
|
||||
|
||||
@@ -35,21 +43,56 @@
|
||||
events = events.filter((event) => event.type === selectedEventType);
|
||||
}
|
||||
|
||||
// Then filter by temporal status (past/upcoming/all)
|
||||
if (selectedTemporalStatus !== 'all') {
|
||||
events = events.filter((event) => isEventInTimeRange(event, selectedTemporalStatus));
|
||||
}
|
||||
|
||||
// Then filter by time range
|
||||
if (selectedTimeFilter !== 'any') {
|
||||
events = events.filter((event) => isEventInTimeRange(event, selectedTimeFilter));
|
||||
}
|
||||
|
||||
// Then apply search query
|
||||
if (searchQuery.trim() !== '') {
|
||||
events = fuse.search(searchQuery).map((result) => result.item);
|
||||
// Re-apply type filter after search
|
||||
// Re-apply all filters after search
|
||||
if (selectedEventType !== 'all') {
|
||||
events = events.filter((event) => event.type === selectedEventType);
|
||||
}
|
||||
if (selectedTemporalStatus !== 'all') {
|
||||
events = events.filter((event) => isEventInTimeRange(event, selectedTemporalStatus));
|
||||
}
|
||||
if (selectedTimeFilter !== 'any') {
|
||||
events = events.filter((event) => isEventInTimeRange(event, selectedTimeFilter));
|
||||
}
|
||||
}
|
||||
|
||||
// Sort events by date and time
|
||||
events = events.sort((a, b) => {
|
||||
// Parse dates as local timezone to avoid timezone issues
|
||||
const parseEventDateTime = (event: Event) => {
|
||||
const [year, month, day] = event.date.split('-').map(Number);
|
||||
const [hours, minutes, seconds] = event.time.split(':').map(Number);
|
||||
return new Date(year, month - 1, day, hours, minutes, seconds || 0);
|
||||
};
|
||||
|
||||
const dateA = parseEventDateTime(a);
|
||||
const dateB = parseEventDateTime(b);
|
||||
|
||||
if (selectedSortOrder === 'asc') {
|
||||
return dateA.getTime() - dateB.getTime();
|
||||
} else {
|
||||
return dateB.getTime() - dateA.getTime();
|
||||
}
|
||||
});
|
||||
|
||||
return events;
|
||||
})();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Discover Events - Cactoide</title>
|
||||
<title>{t('discover.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
@@ -58,41 +101,43 @@
|
||||
{#if error}
|
||||
<div class="mx-auto max-w-2xl text-center">
|
||||
<div class="mb-4 text-4xl">⚠️</div>
|
||||
<p class="py-4">Something went wrong. Please try again.</p>
|
||||
<p class="py-4">{t('common.somethingWentWrong')}</p>
|
||||
<p class="text-red-600">{error}</p>
|
||||
<button
|
||||
on:click={() => goto('/')}
|
||||
class="rounded-sm border-2 border-violet-500 px-8 py-4 font-bold duration-400 hover:scale-110 hover:bg-violet-500/10"
|
||||
>
|
||||
Home
|
||||
{t('common.home')}
|
||||
</button>
|
||||
</div>
|
||||
{:else if publicEvents.length === 0}
|
||||
<div class="mx-auto max-w-2xl text-center">
|
||||
<div class="mb-4 animate-pulse text-6xl">🔍</div>
|
||||
<h2 class="mb-4 text-2xl font-bold">No Public Events Yet</h2>
|
||||
<h2 class="mb-4 text-2xl font-bold">{t('discover.noPublicEventsTitle')}</h2>
|
||||
<p class="text-white-600 mb-8">
|
||||
There are no public events available at the moment. Be the first to create one!
|
||||
{t('discover.noPublicEventsDescription')}
|
||||
</p>
|
||||
<button
|
||||
on:click={() => goto('/create')}
|
||||
class="rounded-sm border-2 border-violet-500 px-8 py-4 font-bold duration-400 hover:scale-110 hover:bg-violet-500/10"
|
||||
>
|
||||
Create
|
||||
{t('discover.createButton')}
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="mx-auto max-w-4xl">
|
||||
<div class="mb-6">
|
||||
<h2 class="text-2xl font-bold text-slate-300">Public Events ({filteredEvents.length})</h2>
|
||||
<p class="text-slate-500">Discover events created by the community</p>
|
||||
<h2 class="text-2xl font-bold text-slate-300">
|
||||
{t('discover.publicEventsTitle', { count: filteredEvents.length })}
|
||||
</h2>
|
||||
<p class="text-slate-500">{t('discover.publicEventsDescription')}</p>
|
||||
</div>
|
||||
|
||||
<!-- Search and Filter Section -->
|
||||
<div class="mb-8">
|
||||
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-center">
|
||||
<!-- Search Bar -->
|
||||
<div class="relative mx-auto max-w-md sm:mx-0">
|
||||
<div class="mb-8 max-h-screen">
|
||||
<!-- Search Bar and Filter Toggle -->
|
||||
<div class="mx-auto flex w-full items-center gap-3 md:w-2/3">
|
||||
<div class="relative flex-1">
|
||||
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
||||
<svg
|
||||
class="h-5 w-5 text-slate-400"
|
||||
@@ -111,13 +156,14 @@
|
||||
<input
|
||||
type="text"
|
||||
bind:value={searchQuery}
|
||||
placeholder="Search events by name, location..."
|
||||
class="w-full rounded-lg border border-slate-600 bg-slate-800 px-4 py-3 pl-10 text-white placeholder-slate-400 focus:border-violet-500 focus:ring-2 focus:ring-violet-500/20 focus:outline-none"
|
||||
placeholder={t('discover.searchPlaceholder')}
|
||||
class="w-full rounded-sm border border-slate-600 bg-slate-800 pl-10 text-white placeholder-slate-400 focus:border-violet-500 focus:ring-violet-500/20"
|
||||
/>
|
||||
{#if searchQuery}
|
||||
<button
|
||||
on:click={() => (searchQuery = '')}
|
||||
class="absolute inset-y-0 right-0 flex items-center pr-3 text-slate-400 hover:text-slate-300"
|
||||
aria-label={t('discover.searchInputAriaLabel')}
|
||||
>
|
||||
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
@@ -131,37 +177,92 @@
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Filter Toggle Button -->
|
||||
<button
|
||||
on:click={() => (showFilters = !showFilters)}
|
||||
class="flex items-center rounded-sm border p-3 font-semibold {showFilters
|
||||
? 'border-violet-500 bg-violet-400/20'
|
||||
: 'border-slate-600 bg-slate-800'}"
|
||||
aria-label={t('discover.toggleFiltersAriaLabel')}
|
||||
>
|
||||
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.207A1 1 0 013 6.5V4z"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Time Filter and Sort Controls -->
|
||||
{#if showFilters}
|
||||
<div
|
||||
class="mx-auto mt-4 flex flex-col items-center gap-4 sm:flex-row sm:justify-center"
|
||||
>
|
||||
<!-- Event Type Filter -->
|
||||
<div class="flex items-center justify-center gap-2">
|
||||
<button
|
||||
on:click={() => (selectedEventType = 'all')}
|
||||
class="rounded-sm border px-3 py-2 text-sm font-medium transition-colors {selectedEventType ===
|
||||
'all'
|
||||
? 'border-violet-500 bg-violet-500/20 text-violet-400'
|
||||
: 'border-slate-600 text-slate-400 hover:border-slate-500 hover:text-slate-300'}"
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="event-type-filter" class="text-sm font-medium text-slate-400"
|
||||
>{t('discover.typeFilterLabel')}</label
|
||||
>
|
||||
All
|
||||
</button>
|
||||
<button
|
||||
on:click={() => (selectedEventType = 'limited')}
|
||||
class="rounded-sm border px-3 py-2 text-sm font-medium transition-colors {selectedEventType ===
|
||||
'limited'
|
||||
? 'border-amber-600 bg-amber-600/20 text-amber-600'
|
||||
: 'border-slate-600 text-slate-400 hover:border-slate-500 hover:text-slate-300'}"
|
||||
<select
|
||||
id="event-type-filter"
|
||||
bind:value={selectedEventType}
|
||||
class="rounded-sm border border-slate-600 bg-slate-800 px-3 py-2 text-sm text-white focus:border-violet-500 focus:ring-2 focus:ring-violet-500/20"
|
||||
>
|
||||
Limited
|
||||
</button>
|
||||
<button
|
||||
on:click={() => (selectedEventType = 'unlimited')}
|
||||
class="rounded-sm border px-3 py-2 text-sm font-medium transition-colors {selectedEventType ===
|
||||
'unlimited'
|
||||
? 'border-teal-500 bg-teal-500/20 text-teal-500'
|
||||
: 'border-slate-600 text-slate-400 hover:border-slate-500 hover:text-slate-300'}"
|
||||
<option value="all">{t('discover.typeFilterAll')}</option>
|
||||
<option value="limited">{t('discover.typeFilterLimited')}</option>
|
||||
<option value="unlimited">{t('discover.typeFilterUnlimited')}</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Temporal Status Filter -->
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="temporal-status-filter" class="text-sm font-medium text-slate-400"
|
||||
>{t('discover.statusFilterLabel')}</label
|
||||
>
|
||||
Unlimited
|
||||
</button>
|
||||
<select
|
||||
id="temporal-status-filter"
|
||||
bind:value={selectedTemporalStatus}
|
||||
class="rounded-sm border border-slate-600 bg-slate-800 px-3 py-2 text-sm text-white focus:border-violet-500 focus:ring-2 focus:ring-violet-500/20"
|
||||
>
|
||||
<option value="all">{t('discover.statusFilterAll')}</option>
|
||||
<option value="upcoming">{t('discover.statusFilterUpcoming')}</option>
|
||||
<option value="past">{t('discover.statusFilterPast')}</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- Time Filter Dropdown -->
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="time-filter" class="text-sm font-medium text-slate-400"
|
||||
>{t('discover.timeFilterLabel')}</label
|
||||
>
|
||||
<select
|
||||
id="time-filter"
|
||||
bind:value={selectedTimeFilter}
|
||||
class="rounded-sm border border-slate-600 bg-slate-800 px-3 py-2 text-sm text-white focus:border-violet-500 focus:ring-2 focus:ring-violet-500/20"
|
||||
>
|
||||
<option value="any">{t('discover.timeFilterAny')}</option>
|
||||
<option value="next-week">{t('discover.timeFilterNextWeek')}</option>
|
||||
<option value="next-month">{t('discover.timeFilterNextMonth')}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Sort Order Dropdown -->
|
||||
<div class="flex items-center gap-2">
|
||||
<label for="sort-order" class="text-sm font-medium text-slate-400"
|
||||
>{t('discover.sortOrderLabel')}</label
|
||||
>
|
||||
<select
|
||||
id="sort-order"
|
||||
bind:value={selectedSortOrder}
|
||||
class="rounded-sm border border-slate-600 bg-slate-800 px-3 py-2 text-sm text-white focus:border-violet-500 focus:ring-2 focus:ring-violet-500/20"
|
||||
>
|
||||
<option value="asc">{t('discover.sortOrderEarliest')}</option>
|
||||
<option value="desc">{t('discover.sortOrderLatest')}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
@@ -179,7 +280,9 @@
|
||||
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
||||
></path>
|
||||
</svg>
|
||||
<span>{formatDate(event.date)} at {formatTime(event.time)}</span>
|
||||
<span
|
||||
>{formatDate(event.date)} {t('common.atTime')} {formatTime(event.time)}</span
|
||||
>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -196,7 +299,20 @@
|
||||
d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
></path>
|
||||
</svg>
|
||||
{#if event.location_type === 'none'}
|
||||
<span>N/A</span>
|
||||
{:else if event.location_type === 'maps' && event.location_url}
|
||||
<a
|
||||
href={event.location_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-slate-500 transition-colors duration-200 hover:text-slate-300"
|
||||
>
|
||||
{t('create.locationMapsOption')}
|
||||
</a>
|
||||
{:else}
|
||||
<span>{event.location}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<span
|
||||
@@ -205,18 +321,28 @@
|
||||
? 'border-amber-600 text-amber-600'
|
||||
: 'border-teal-500 text-teal-500'}"
|
||||
>
|
||||
{event.type === 'limited' ? 'Limited' : 'Unlimited'}
|
||||
{event.type === 'limited' ? t('common.limited') : t('common.unlimited')}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<span
|
||||
class="rounded-sm border px-2 py-1 text-xs font-medium {event.visibility ===
|
||||
'public'
|
||||
? 'border-teal-500 text-teal-500'
|
||||
: 'border-amber-600 text-amber-600'}"
|
||||
>
|
||||
{event.visibility === 'public' ? t('common.public') : t('common.inviteOnly')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex space-x-3">
|
||||
<div class="flex">
|
||||
<button
|
||||
on:click={() => goto(`/event/${event.id}`)}
|
||||
class="flex-1 rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-2 font-semibold duration-200 hover:bg-violet-400/70"
|
||||
>
|
||||
View Event
|
||||
{t('discover.viewButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -226,8 +352,10 @@
|
||||
{#if searchQuery && filteredEvents.length === 0}
|
||||
<div class="mt-8 text-center">
|
||||
<div class="mb-4 text-4xl">🔍</div>
|
||||
<h3 class="mb-2 text-xl font-bold text-slate-300">No events found</h3>
|
||||
<p class="text-slate-500">Try adjusting your search terms or browse all events</p>
|
||||
<h3 class="mb-2 text-xl font-bold text-slate-300">
|
||||
{t('discover.noEventsFoundTitle')}
|
||||
</h3>
|
||||
<p class="text-slate-500">{t('discover.noEventsFoundDescription')}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,8 @@ import { database } from '$lib/database/db';
|
||||
import { events } from '$lib/database/schema';
|
||||
import { fail } from '@sveltejs/kit';
|
||||
import { eq, desc } from 'drizzle-orm';
|
||||
import type { Actions } from './$types';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
export const load = async ({ cookies }) => {
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
@@ -23,6 +25,8 @@ export const load = async ({ cookies }) => {
|
||||
date: event.date,
|
||||
time: event.time,
|
||||
location: event.location,
|
||||
location_type: event.locationType,
|
||||
location_url: event.locationUrl,
|
||||
type: event.type,
|
||||
attendee_limit: event.attendeeLimit,
|
||||
visibility: event.visibility,
|
||||
@@ -33,7 +37,7 @@ export const load = async ({ cookies }) => {
|
||||
|
||||
return { events: transformedEvents };
|
||||
} catch (error) {
|
||||
console.error('Error loading user events:', error);
|
||||
logger.error({ error, userId }, 'Error loading user events');
|
||||
return { events: [] };
|
||||
}
|
||||
};
|
||||
@@ -65,7 +69,7 @@ export const actions: Actions = {
|
||||
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error('Error deleting event:', error);
|
||||
logger.error({ error, eventId, userId }, 'Error deleting event');
|
||||
return fail(500, { error: 'Failed to delete event' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<script lang="ts">
|
||||
import type { Event } from '$lib/types';
|
||||
import { goto } from '$app/navigation';
|
||||
import { formatTime, formatDate } from '$lib/dateFormatter';
|
||||
import { formatTime, formatDate } from '$lib/dateHelpers';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
export let data: { events: Event[] };
|
||||
|
||||
@@ -60,7 +61,7 @@
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>My Events - Cactoide</title>
|
||||
<title>{t('event.myEventsTitle')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
@@ -69,22 +70,24 @@
|
||||
{#if userEvents.length === 0}
|
||||
<div class="mx-auto max-w-2xl text-center">
|
||||
<div class="mb-4 animate-pulse text-6xl">🎉</div>
|
||||
<h2 class="mb-4 text-2xl font-bold">No Events Yet</h2>
|
||||
<h2 class="mb-4 text-2xl font-bold">{t('event.noEventsYetTitle')}</h2>
|
||||
<p class="text-white-600 mb-8">
|
||||
You haven't created any events yet. Start by creating your first event!
|
||||
{t('event.noEventsYetDescription')}
|
||||
</p>
|
||||
<button
|
||||
on:click={() => goto('/create')}
|
||||
class="rounded-sm border-2 border-violet-500 px-8 py-4 font-bold duration-400 hover:scale-110 hover:bg-violet-500/10"
|
||||
>
|
||||
Create Your First Event
|
||||
{t('event.createYourFirstEventButton')}
|
||||
</button>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="mx-auto max-w-4xl">
|
||||
<div class="mb-6">
|
||||
<h2 class="text-2xl font-bold text-slate-400">My Events ({userEvents.length})</h2>
|
||||
<p class="text-slate-500">Manage your created events</p>
|
||||
<h2 class="text-2xl font-bold text-slate-400">
|
||||
{t('event.myEventsTitle')} ({userEvents.length})
|
||||
</h2>
|
||||
<p class="text-slate-500">{t('event.myEventsDescription')}</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 md:grid-cols-2 lg:grid-cols-3">
|
||||
@@ -104,7 +107,9 @@
|
||||
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
||||
></path>
|
||||
</svg>
|
||||
<span>{formatDate(event.date)} at {formatTime(event.time)}</span>
|
||||
<span
|
||||
>{formatDate(event.date)} {t('common.atTime')} {formatTime(event.time)}</span
|
||||
>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -121,7 +126,20 @@
|
||||
d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
></path>
|
||||
</svg>
|
||||
{#if event.location_type === 'none'}
|
||||
<span>N/A</span>
|
||||
{:else if event.location_type === 'maps' && event.location_url}
|
||||
<a
|
||||
href={event.location_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-slate-500 transition-colors duration-200 hover:text-slate-300"
|
||||
>
|
||||
Google Maps
|
||||
</a>
|
||||
{:else}
|
||||
<span>{event.location}</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<span
|
||||
@@ -130,7 +148,7 @@
|
||||
? 'border-amber-600 text-amber-600'
|
||||
: 'border-teal-500 text-teal-500'}"
|
||||
>
|
||||
{event.type === 'limited' ? 'Limited' : 'Unlimited'}
|
||||
{event.type === 'limited' ? t('common.limited') : t('common.unlimited')}
|
||||
</span>
|
||||
<span
|
||||
class="rounded-sm border px-2 py-1 text-xs font-medium {event.visibility ===
|
||||
@@ -138,7 +156,8 @@
|
||||
? 'border-green-300 text-green-400'
|
||||
: 'border-orange-300 text-orange-400'}"
|
||||
>
|
||||
{event.visibility === 'public' ? 'Public' : 'Private'}
|
||||
<!-- TODO(polaroi8d): replace with something better solution; message.json using this, beacuse of common.invite-only works here -->
|
||||
{t(`common.${event.visibility}`)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2"></div>
|
||||
@@ -149,15 +168,65 @@
|
||||
<button
|
||||
on:click={() => goto(`/event/${event.id}`)}
|
||||
class="flex-1 rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-2 font-semibold duration-200 hover:bg-violet-400/70"
|
||||
aria-label={t('event.viewEventAriaLabel')}
|
||||
>
|
||||
View
|
||||
<svg
|
||||
class="mx-auto h-4 w-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
></path>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => goto(`/event/${event.id}/edit`)}
|
||||
class="flex-1 rounded-sm border-2 border-blue-400 bg-blue-400/20 px-4 py-2 font-semibold text-white duration-200 hover:bg-blue-400/70"
|
||||
aria-label={t('event.editEventAriaLabel')}
|
||||
>
|
||||
<svg
|
||||
class="mx-auto h-4 w-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => openDeleteModal(event)}
|
||||
class="flex-1 rounded-sm border-2 border-red-400 bg-red-400/20 px-4 py-2 font-semibold text-white duration-200 hover:bg-red-400/70"
|
||||
aria-label="Delete event"
|
||||
aria-label={t('event.deleteEventAriaLabel')}
|
||||
>
|
||||
Delete
|
||||
<svg
|
||||
class="mx-auto h-4 w-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -178,10 +247,9 @@
|
||||
>
|
||||
<span class="text-2xl text-red-600">🗑️</span>
|
||||
</div>
|
||||
<h3 class="mb-2 text-xl font-bold text-white">Delete Event</h3>
|
||||
<h3 class="mb-2 text-xl font-bold text-white">{t('event.deleteEventTitle')}</h3>
|
||||
<p class="text-slate-400">
|
||||
Are you sure you want to delete "<span class="font-semibold">{eventToDelete.name}</span>"?
|
||||
This action cannot be undone and will remove all RSVPs.
|
||||
{t('event.deleteEventDescription', { eventName: eventToDelete.name })}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -190,13 +258,13 @@
|
||||
on:click={closeDeleteModal}
|
||||
class="flex-1 rounded-sm border-2 border-slate-300 bg-slate-200 px-4 py-2 font-semibold text-slate-700 transition-all duration-200 hover:bg-slate-300"
|
||||
>
|
||||
Cancel
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
on:click={confirmDelete}
|
||||
class="flex-1 rounded-sm border-2 border-red-500 bg-red-500 px-4 py-2 font-semibold text-white transition-all duration-200 hover:bg-red-600"
|
||||
>
|
||||
Delete
|
||||
{t('common.delete')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,7 @@ import { events, rsvps } from '$lib/database/schema';
|
||||
import { eq, asc } from 'drizzle-orm';
|
||||
import { error, fail } from '@sveltejs/kit';
|
||||
import type { PageServerLoad, Actions } from './$types';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, cookies }) => {
|
||||
const eventId = params.id;
|
||||
@@ -25,6 +26,16 @@ export const load: PageServerLoad = async ({ params, cookies }) => {
|
||||
const event = eventData[0];
|
||||
const eventRsvps = rsvpData;
|
||||
|
||||
// Check if this is an invite-only event
|
||||
if (event.visibility === 'invite-only') {
|
||||
// For invite-only events, check if user is the event creator
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
if (event.userId !== userId) {
|
||||
// User is not the creator, redirect to a message about needing invite
|
||||
throw error(403, 'This event requires an invite link to view');
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the data to match the expected interface
|
||||
const transformedEvent = {
|
||||
id: event.id,
|
||||
@@ -32,6 +43,8 @@ export const load: PageServerLoad = async ({ params, cookies }) => {
|
||||
date: event.date,
|
||||
time: event.time,
|
||||
location: event.location,
|
||||
location_type: event.locationType,
|
||||
location_url: event.locationUrl,
|
||||
type: event.type,
|
||||
attendee_limit: event.attendeeLimit,
|
||||
visibility: event.visibility,
|
||||
@@ -58,7 +71,7 @@ export const load: PageServerLoad = async ({ params, cookies }) => {
|
||||
} catch (err) {
|
||||
if (err instanceof Response) throw err; // This is the 404 error
|
||||
|
||||
console.error('Error loading event:', err);
|
||||
logger.error({ error: err, eventId }, 'Error loading event');
|
||||
throw error(500, 'Failed to load event');
|
||||
}
|
||||
};
|
||||
@@ -69,6 +82,7 @@ export const actions: Actions = {
|
||||
const formData = await request.formData();
|
||||
|
||||
const name = formData.get('newAttendeeName') as string;
|
||||
const numberOfGuests = parseInt(formData.get('numberOfGuests') as string) || 0;
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
if (!name?.trim() || !userId) {
|
||||
@@ -82,31 +96,57 @@ export const actions: Actions = {
|
||||
return fail(404, { error: 'Event not found' });
|
||||
}
|
||||
|
||||
// Check if this is an invite-only event
|
||||
if (eventData.visibility === 'invite-only') {
|
||||
return fail(403, { error: 'This event requires an invite link to RSVP' });
|
||||
}
|
||||
|
||||
// Get current RSVPs
|
||||
const currentRSVPs = await database.select().from(rsvps).where(eq(rsvps.eventId, eventId));
|
||||
|
||||
// Calculate total attendees (including guests)
|
||||
const totalAttendees = currentRSVPs.length + numberOfGuests;
|
||||
|
||||
// Check if event is full (for limited type events)
|
||||
if (eventData.type === 'limited' && eventData.attendeeLimit) {
|
||||
const currentRSVPs = await database.select().from(rsvps).where(eq(rsvps.eventId, eventId));
|
||||
if (currentRSVPs.length >= eventData.attendeeLimit) {
|
||||
return fail(400, { error: 'Event is full' });
|
||||
if (totalAttendees > eventData.attendeeLimit) {
|
||||
return fail(400, {
|
||||
error: `Event capacity exceeded. You're trying to add ${numberOfGuests + 1} attendees (including yourself), but only ${eventData.attendeeLimit - currentRSVPs.length} spots remain.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Check if name is already in the list
|
||||
const existingRSVPs = await database.select().from(rsvps).where(eq(rsvps.eventId, eventId));
|
||||
if (existingRSVPs.some((rsvp) => rsvp.name.toLowerCase() === name.toLowerCase())) {
|
||||
if (currentRSVPs.some((rsvp) => rsvp.name.toLowerCase() === name.toLowerCase())) {
|
||||
return fail(400, { error: 'Name already exists for this event' });
|
||||
}
|
||||
|
||||
// Add RSVP to database
|
||||
await database.insert(rsvps).values({
|
||||
// Prepare RSVPs to insert
|
||||
const rsvpsToInsert = [
|
||||
{
|
||||
eventId: eventId,
|
||||
name: name.trim(),
|
||||
userId: userId,
|
||||
createdAt: new Date()
|
||||
}
|
||||
];
|
||||
|
||||
// Add guest entries
|
||||
for (let i = 1; i <= numberOfGuests; i++) {
|
||||
rsvpsToInsert.push({
|
||||
eventId: eventId,
|
||||
name: `${name.trim()}'s Guest #${i}`,
|
||||
userId: userId,
|
||||
createdAt: new Date()
|
||||
});
|
||||
}
|
||||
|
||||
// Insert all RSVPs
|
||||
await database.insert(rsvps).values(rsvpsToInsert);
|
||||
|
||||
return { success: true, type: 'add' };
|
||||
} catch (err) {
|
||||
console.error('Error adding RSVP:', err);
|
||||
logger.error({ error: err, eventId, userId, name }, 'Error adding RSVP');
|
||||
return fail(500, { error: 'Failed to add RSVP' });
|
||||
}
|
||||
},
|
||||
@@ -124,7 +164,7 @@ export const actions: Actions = {
|
||||
await database.delete(rsvps).where(eq(rsvps.id, rsvpId));
|
||||
return { success: true, type: 'remove' };
|
||||
} catch (err) {
|
||||
console.error('Error removing RSVP:', err);
|
||||
logger.error({ error: err, rsvpId }, 'Error removing RSVP');
|
||||
return fail(500, { error: 'Failed to remove RSVP' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +1,119 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { browser } from '$app/environment';
|
||||
import type { Event, RSVP } from '$lib/types';
|
||||
import { goto } from '$app/navigation';
|
||||
import { enhance } from '$app/forms';
|
||||
import { formatTime, formatDate } from '$lib/dateFormatter';
|
||||
import { formatTime, formatDate } from '$lib/dateHelpers.js';
|
||||
import CalendarModal from '$lib/components/CalendarModal.svelte';
|
||||
import type { CalendarEvent } from '$lib/calendarHelpers.js';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
export let data: { event: Event; rsvps: RSVP[]; userId: string };
|
||||
export let form;
|
||||
type FormDataLocal = { success?: boolean; error?: string; type?: 'add' | 'remove' | 'copy' };
|
||||
export let form: FormDataLocal | undefined;
|
||||
|
||||
let event: Event;
|
||||
let rsvps: RSVP[] = [];
|
||||
let newAttendeeName = '';
|
||||
let isAddingRSVP = false;
|
||||
let error = '';
|
||||
let success = '';
|
||||
let success = ''; // TODO: change to boolean and refactor with 482-506
|
||||
let addGuests = false;
|
||||
let numberOfGuests = 1;
|
||||
let showCalendarModal = false;
|
||||
let calendarEvent: CalendarEvent;
|
||||
let toastType: 'add' | 'remove' | 'copy' | null = null;
|
||||
let typeToShow: 'add' | 'remove' | 'copy' | undefined;
|
||||
let successHideTimer: number | null = null;
|
||||
|
||||
// Use server-side data
|
||||
$: event = data.event;
|
||||
$: rsvps = data.rsvps;
|
||||
$: currentUserId = data.userId;
|
||||
$: isEventCreator = event.user_id === currentUserId;
|
||||
|
||||
// Create calendar event object when event data changes
|
||||
$: if (event && browser) {
|
||||
calendarEvent = {
|
||||
name: event.name,
|
||||
date: event.date,
|
||||
time: event.time,
|
||||
location: event.location,
|
||||
url: `${$page.url.origin}/event/${eventId}`
|
||||
};
|
||||
}
|
||||
|
||||
// Handle form errors from server
|
||||
$: if (form?.error) {
|
||||
error = form.error;
|
||||
error = String(form.error);
|
||||
success = '';
|
||||
}
|
||||
|
||||
// Handle form success from server
|
||||
$: if (form?.success) {
|
||||
const handleFormSuccess = () => {
|
||||
if (form?.type === 'add') {
|
||||
success = 'RSVP added successfully!';
|
||||
} else {
|
||||
success = 'RSVP removed successfully.';
|
||||
}
|
||||
|
||||
error = '';
|
||||
newAttendeeName = '';
|
||||
addGuests = false;
|
||||
numberOfGuests = 1;
|
||||
|
||||
toastType = form?.type || 'add';
|
||||
|
||||
if (browser) {
|
||||
if (successHideTimer) clearTimeout(successHideTimer);
|
||||
successHideTimer = window.setTimeout(() => {
|
||||
success = '';
|
||||
toastType = null;
|
||||
}, 3000);
|
||||
}
|
||||
};
|
||||
|
||||
const eventId = $page.params.id;
|
||||
// Handle form success from server
|
||||
$: if (form?.success) handleFormSuccess();
|
||||
|
||||
function copyEventLink() {
|
||||
const url = `${window.location.origin}/event/${eventId}`;
|
||||
// Derive toast type from local or server form
|
||||
$: typeToShow = toastType ?? form?.type;
|
||||
|
||||
const eventId = $page.params.id || '';
|
||||
|
||||
const copyEventLink = () => {
|
||||
if (browser && isEventCreator) {
|
||||
const url = `${$page.url.origin}/event/${eventId}`;
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
success = 'Event link copied to clipboard!';
|
||||
toastType = 'copy';
|
||||
success = t('event.eventLinkCopied');
|
||||
|
||||
setTimeout(() => {
|
||||
success = '';
|
||||
toastType = null;
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function clearMessages() {
|
||||
const clearMessages = () => {
|
||||
error = '';
|
||||
success = '';
|
||||
}
|
||||
toastType = null;
|
||||
};
|
||||
|
||||
// Calendar modal functions
|
||||
const openCalendarModal = () => {
|
||||
showCalendarModal = true;
|
||||
};
|
||||
|
||||
const closeCalendarModal = () => {
|
||||
showCalendarModal = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{event?.name || 'Event'} - Cactoide</title>
|
||||
<title>{event?.name || t('event.eventTitle')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
@@ -63,18 +124,18 @@
|
||||
<div class="mx-auto max-w-md text-center">
|
||||
<div class="rounded-sm border border-red-500/30 bg-red-900/20 p-8">
|
||||
<div class="mb-4 text-6xl text-red-400">⚠️</div>
|
||||
<h2 class="mb-4 text-2xl font-bold text-red-400">Event Not Found</h2>
|
||||
<p class="my-8">The event you're looking for doesn't exist or has been removed.</p>
|
||||
<h2 class="mb-4 text-2xl font-bold text-red-400">{t('event.eventNotFoundTitle')}</h2>
|
||||
<p class="my-8">{t('event.eventNotFoundDescription')}</p>
|
||||
<button
|
||||
on:click={() => goto('/create')}
|
||||
class="border-white-500 bg-white-400/20 mt-2 rounded-sm border px-6 py-3 font-semibold text-white duration-400 hover:scale-110 hover:bg-white/10"
|
||||
>
|
||||
Create New Event
|
||||
{t('common.createNewEvent')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else if event}
|
||||
<div class="mx-auto max-w-md space-y-6">
|
||||
<div class="mx-auto max-w-2xl space-y-6">
|
||||
<!-- Event Details Card -->
|
||||
|
||||
<div class="rounded-sm border p-6 shadow-2xl">
|
||||
@@ -104,7 +165,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location -->
|
||||
<!-- Location (only show when not 'none') -->
|
||||
<div class="flex items-center space-x-3 text-violet-400">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-sm">
|
||||
<svg class=" h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -123,7 +184,20 @@
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
{#if event.location_type === 'none'}
|
||||
<p class="font-semibold text-white">N/A</p>
|
||||
{:else if event.location_type === 'maps' && event.location_url}
|
||||
<a
|
||||
href={event.location_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="font-semibold text-white transition-colors duration-200 hover:text-violet-300"
|
||||
>
|
||||
{t('create.locationMapsOption')}
|
||||
</a>
|
||||
{:else}
|
||||
<p class="font-semibold text-white">{event.location}</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -135,7 +209,7 @@
|
||||
? 'border-amber-600 text-amber-600'
|
||||
: 'border-teal-500 text-teal-500'}"
|
||||
>
|
||||
{event.type === 'limited' ? 'Limited' : 'Unlimited'}
|
||||
{event.type === 'limited' ? t('common.limited') : t('common.unlimited')}
|
||||
</span>
|
||||
<span
|
||||
class="rounded-sm border px-2 py-1 text-xs font-medium {event.visibility ===
|
||||
@@ -143,13 +217,13 @@
|
||||
? 'border-green-300 text-green-400'
|
||||
: 'border-orange-300 text-orange-400'}"
|
||||
>
|
||||
{event.visibility === 'public' ? 'Public' : 'Private'}
|
||||
{event.visibility === 'public' ? t('common.public') : t('common.private')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#if event.type === 'limited' && event.attendee_limit}
|
||||
<div class="text-right">
|
||||
<p class="text-sm">Capacity</p>
|
||||
<p class="text-sm">{t('common.capacity')}</p>
|
||||
<p class=" text-lg font-bold">
|
||||
{rsvps.length}/{event.attendee_limit}
|
||||
</p>
|
||||
@@ -161,13 +235,19 @@
|
||||
|
||||
<!-- RSVP Form -->
|
||||
<div class=" rounded-sm border p-6 shadow-2xl backdrop-blur-sm">
|
||||
<h3 class=" mb-4 text-xl font-bold">Join This Event</h3>
|
||||
<h3 class=" mb-4 text-xl font-bold">{t('event.joinThisEvent')}</h3>
|
||||
|
||||
{#if event.type === 'limited' && event.attendee_limit && rsvps.length >= event.attendee_limit}
|
||||
{#if event.visibility === 'invite-only'}
|
||||
<div class="py-6 text-center">
|
||||
<div class="mb-3 text-4xl">🎫</div>
|
||||
<p class="font-semibold text-amber-400">{t('event.inviteOnlyBannerTitle')}</p>
|
||||
<p class="mt-1 text-sm text-amber-300">{t('common.inviteRequiredToDetails')}</p>
|
||||
</div>
|
||||
{:else if event.type === 'limited' && event.attendee_limit && rsvps.length >= event.attendee_limit}
|
||||
<div class="py-6 text-center">
|
||||
<div class="mb-3 text-4xl text-red-400">🚫</div>
|
||||
<p class="font-semibold text-red-400">Event is Full!</p>
|
||||
<p class="mt-1 text-sm">Maximum capacity reached</p>
|
||||
<p class="font-semibold text-red-400">{t('event.eventIsFull')}</p>
|
||||
<p class="mt-1 text-sm">{t('event.maximumCapacityReached')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<form
|
||||
@@ -179,7 +259,7 @@
|
||||
return async ({ result, update }) => {
|
||||
isAddingRSVP = false;
|
||||
if (result.type === 'failure') {
|
||||
error = result.data?.error || 'Failed to add RSVP';
|
||||
error = String(result.data?.error || 'Failed to add RSVP');
|
||||
}
|
||||
update();
|
||||
};
|
||||
@@ -189,7 +269,8 @@
|
||||
<input type="hidden" name="userId" value={currentUserId} />
|
||||
<div>
|
||||
<label for="attendeeName" class=" mb-2 block text-sm font-semibold">
|
||||
Your Name <span class="text-red-400">*</span>
|
||||
{t('event.yourNameLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="attendeeName"
|
||||
@@ -197,15 +278,56 @@
|
||||
type="text"
|
||||
bind:value={newAttendeeName}
|
||||
class="border-dark-300 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm"
|
||||
placeholder="Enter your name"
|
||||
placeholder={t('event.yourNamePlaceholder')}
|
||||
maxlength="50"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Add Guests Toggle -->
|
||||
<div class="flex items-center space-x-3">
|
||||
<input
|
||||
id="addGuests"
|
||||
type="checkbox"
|
||||
bind:checked={addGuests}
|
||||
class="h-4 w-4 rounded border-gray-300 text-violet-600 focus:ring-violet-500"
|
||||
/>
|
||||
<label for="addGuests" class="text-sm font-medium text-white">
|
||||
{t('event.addGuestsLabel')}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Number of Guests Input -->
|
||||
{#if addGuests}
|
||||
<div>
|
||||
<label for="numberOfGuests" class="mb-2 block text-sm font-semibold">
|
||||
{t('event.numberOfGuestsLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="numberOfGuests"
|
||||
name="numberOfGuests"
|
||||
type="number"
|
||||
bind:value={numberOfGuests}
|
||||
min="1"
|
||||
max="10"
|
||||
class="border-dark-300 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm"
|
||||
placeholder={t('event.numberOfGuestsPlaceholder')}
|
||||
required
|
||||
/>
|
||||
<p class="mt-1 text-xs text-slate-400">
|
||||
{t('event.guestsWillBeAddedAs', {
|
||||
name: newAttendeeName || t('common.yourNamePlaceholder')
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isAddingRSVP || !newAttendeeName.trim()}
|
||||
disabled={isAddingRSVP ||
|
||||
!newAttendeeName.trim() ||
|
||||
(addGuests && numberOfGuests < 1)}
|
||||
class=" hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
{#if isAddingRSVP}
|
||||
@@ -213,10 +335,15 @@
|
||||
<div
|
||||
class="mr-2 h-5 w-5 animate-spin rounded-full border-b-2 border-white"
|
||||
></div>
|
||||
Adding...
|
||||
{t('event.adding')}
|
||||
</div>
|
||||
{:else if addGuests && numberOfGuests > 0}
|
||||
{t('event.joinEventWithGuests', {
|
||||
count: numberOfGuests,
|
||||
plural: numberOfGuests > 1 ? 's' : ''
|
||||
})}
|
||||
{:else}
|
||||
Join Event
|
||||
{t('event.joinEventButton')}
|
||||
{/if}
|
||||
</button>
|
||||
</form>
|
||||
@@ -224,16 +351,17 @@
|
||||
</div>
|
||||
|
||||
<!-- Attendees List -->
|
||||
{#if event.visibility !== 'invite-only'}
|
||||
<div class="rounded-sm border p-6 shadow-2xl backdrop-blur-sm">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class=" text-xl font-bold">Attendees</h3>
|
||||
<h3 class=" text-xl font-bold">{t('event.attendeesTitle')}</h3>
|
||||
<span class="text-2xl font-bold">{rsvps.length}</span>
|
||||
</div>
|
||||
|
||||
{#if rsvps.length === 0}
|
||||
<div class="text-dark-400 py-8 text-center">
|
||||
<p>No attendees yet</p>
|
||||
<p class="mt-1 text-sm">Be the first to join!</p>
|
||||
<p>{t('event.noAttendeesYet')}</p>
|
||||
<p class="mt-1 text-sm">{t('event.beFirstToJoin')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="space-y-3">
|
||||
@@ -243,12 +371,22 @@
|
||||
>
|
||||
<div class="flex items-center space-x-3">
|
||||
<div
|
||||
class="flex h-8 w-8 items-center justify-center rounded-full text-sm font-bold"
|
||||
class="flex h-8 w-8 items-center justify-center rounded-full text-sm font-bold {attendee.name.includes(
|
||||
"'s Guest"
|
||||
)
|
||||
? 'text-white-400 bg-violet-500/40'
|
||||
: 'bg-violet-500/20 text-violet-400'}"
|
||||
>
|
||||
{attendee.name.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-medium text-white">{attendee.name}</p>
|
||||
<p
|
||||
class="font-medium text-white {attendee.name.includes("'s Guest")
|
||||
? 'text-amber-300'
|
||||
: ''}"
|
||||
>
|
||||
{attendee.name}
|
||||
</p>
|
||||
<p class="text-xs text-violet-400">
|
||||
{(() => {
|
||||
const date = new Date(attendee.created_at);
|
||||
@@ -271,7 +409,7 @@
|
||||
clearMessages();
|
||||
return async ({ result, update }) => {
|
||||
if (result.type === 'failure') {
|
||||
error = result.data?.error || 'Failed to remove RSVP';
|
||||
error = String(result.data?.error || 'Failed to remove RSVP');
|
||||
}
|
||||
update();
|
||||
};
|
||||
@@ -282,9 +420,14 @@
|
||||
<button
|
||||
type="submit"
|
||||
class="text-dark-400 p-1 transition-colors duration-200 hover:text-red-400"
|
||||
aria-label="Remove RSVP"
|
||||
aria-label={t('event.removeRsvpAriaLabel')}
|
||||
>
|
||||
<svg
|
||||
class="h-4 w-4"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
@@ -300,14 +443,26 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="max-w-2xl">
|
||||
<div class="max-w-2xl space-y-3">
|
||||
{#if event.visibility !== 'invite-only'}
|
||||
<button
|
||||
on:click={copyEventLink}
|
||||
disabled={!isEventCreator}
|
||||
class="w-full rounded-sm border-2 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105 {isEventCreator
|
||||
? 'border-violet-500 bg-violet-400/20 hover:bg-violet-400/70'
|
||||
: 'cursor-not-allowed border-gray-500 bg-gray-600/20 hover:bg-gray-600/30'}"
|
||||
>
|
||||
{t('event.copyLinkButton')}
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
on:click={openCalendarModal}
|
||||
class="hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
Copy Link
|
||||
{t('event.addToCalendarButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -315,26 +470,45 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Calendar Modal -->
|
||||
{#if calendarEvent && browser}
|
||||
<CalendarModal
|
||||
bind:isOpen={showCalendarModal}
|
||||
event={calendarEvent}
|
||||
{eventId}
|
||||
baseUrl={$page.url.origin}
|
||||
on:close={closeCalendarModal}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- Success/Error Messages -->
|
||||
{#if success}
|
||||
{#if form?.type === 'add'}
|
||||
{#if typeToShow === 'add'}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500/30 bg-green-900/20 p-4 text-green-400"
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500/30 bg-green-900 p-4 text-green-400"
|
||||
>
|
||||
{success}
|
||||
</div>
|
||||
{:else if form?.type === 'remove'}
|
||||
{:else if typeToShow === 'remove'}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900/20 p-4 text-yellow-400"
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900 p-4 text-yellow-400"
|
||||
>
|
||||
Removed RSVP successfully.
|
||||
{t('event.removedRsvpSuccessfully')}
|
||||
</div>
|
||||
{:else if typeToShow === 'copy'}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900 p-4 text-yellow-400"
|
||||
>
|
||||
{t('event.eventLinkCopied')}
|
||||
</div>
|
||||
{:else}
|
||||
<!-- fallback -->
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if error}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500/30 bg-red-900/20 p-4 text-red-400"
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500/30 bg-red-900 p-4 text-red-400"
|
||||
>
|
||||
{error}
|
||||
</div>
|
||||
|
||||
174
src/routes/event/[id]/edit/+page.server.ts
Normal file
174
src/routes/event/[id]/edit/+page.server.ts
Normal file
@@ -0,0 +1,174 @@
|
||||
import { database } from '$lib/database/db';
|
||||
import { events, inviteTokens } from '$lib/database/schema';
|
||||
import { eq, and } from 'drizzle-orm';
|
||||
import { fail, redirect } from '@sveltejs/kit';
|
||||
import type { Actions, PageServerLoad } from './$types';
|
||||
import { logger } from '$lib/logger';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, cookies }) => {
|
||||
const eventId = params.id;
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
if (!userId) {
|
||||
throw redirect(303, '/');
|
||||
}
|
||||
|
||||
// Fetch the event and verify ownership
|
||||
const event = await database
|
||||
.select()
|
||||
.from(events)
|
||||
.where(and(eq(events.id, eventId), eq(events.userId, userId)))
|
||||
.limit(1);
|
||||
|
||||
if (event.length === 0) {
|
||||
throw redirect(303, '/event');
|
||||
}
|
||||
|
||||
// Fetch invite token if this is an invite-only event
|
||||
let inviteToken = null;
|
||||
if (event[0].visibility === 'invite-only') {
|
||||
const tokenData = await database
|
||||
.select()
|
||||
.from(inviteTokens)
|
||||
.where(eq(inviteTokens.eventId, eventId))
|
||||
.limit(1);
|
||||
|
||||
if (tokenData.length > 0) {
|
||||
inviteToken = {
|
||||
id: tokenData[0].id,
|
||||
event_id: tokenData[0].eventId,
|
||||
token: tokenData[0].token,
|
||||
expires_at: tokenData[0].expiresAt.toISOString(),
|
||||
created_at: tokenData[0].createdAt?.toISOString() || new Date().toISOString()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
event: event[0],
|
||||
inviteToken,
|
||||
userId
|
||||
};
|
||||
};
|
||||
|
||||
export const actions: Actions = {
|
||||
default: async ({ request, params, cookies }) => {
|
||||
const eventId = params.id;
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
const formData = await request.formData();
|
||||
|
||||
if (!userId) {
|
||||
return fail(401, { error: 'Unauthorized' });
|
||||
}
|
||||
|
||||
// Verify event ownership before allowing edit
|
||||
const existingEvent = await database
|
||||
.select()
|
||||
.from(events)
|
||||
.where(and(eq(events.id, eventId), eq(events.userId, userId)))
|
||||
.limit(1);
|
||||
|
||||
if (existingEvent.length === 0) {
|
||||
return fail(403, { error: 'You can only edit your own events' });
|
||||
}
|
||||
|
||||
const name = formData.get('name') as string;
|
||||
const date = formData.get('date') as string;
|
||||
const time = formData.get('time') as string;
|
||||
const location = formData.get('location') as string;
|
||||
const locationType = formData.get('locationType') as string;
|
||||
const locationUrl = formData.get('location_url') as string;
|
||||
const type = formData.get('type') as 'limited' | 'unlimited';
|
||||
const attendeeLimit = formData.get('attendee_limit') as string;
|
||||
const visibility = formData.get('visibility') as 'public' | 'private';
|
||||
|
||||
// Validation
|
||||
const missingFields: string[] = [];
|
||||
|
||||
if (!name?.trim()) missingFields.push('name');
|
||||
if (!date) missingFields.push('date');
|
||||
if (!time) missingFields.push('time');
|
||||
if (!locationType) missingFields.push('location_type');
|
||||
if (locationType === 'text' && !location?.trim()) missingFields.push('location');
|
||||
if (locationType === 'maps' && !locationUrl?.trim()) missingFields.push('location_url');
|
||||
|
||||
if (missingFields.length > 0) {
|
||||
return fail(400, {
|
||||
error: `Missing or empty fields: ${missingFields.join(', ')}`,
|
||||
values: {
|
||||
name,
|
||||
date,
|
||||
time,
|
||||
location,
|
||||
location_type: locationType,
|
||||
location_url: locationUrl,
|
||||
type,
|
||||
attendee_limit: attendeeLimit,
|
||||
visibility
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Check if date is in the past using local timezone
|
||||
const [year, month, day] = date.split('-').map(Number);
|
||||
const eventDate = new Date(year, month - 1, day);
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
if (eventDate < today) {
|
||||
return fail(400, {
|
||||
error: 'Date cannot be in the past.',
|
||||
values: {
|
||||
name,
|
||||
date,
|
||||
time,
|
||||
location,
|
||||
location_type: locationType,
|
||||
location_url: locationUrl,
|
||||
type,
|
||||
attendee_limit: attendeeLimit,
|
||||
visibility
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (type === 'limited' && (!attendeeLimit || parseInt(attendeeLimit) < 2)) {
|
||||
return fail(400, {
|
||||
error: 'Limit must be at least 2 for limited events.',
|
||||
values: {
|
||||
name,
|
||||
date,
|
||||
time,
|
||||
location,
|
||||
location_type: locationType,
|
||||
location_url: locationUrl,
|
||||
type,
|
||||
attendee_limit: attendeeLimit,
|
||||
visibility
|
||||
}
|
||||
});
|
||||
}
|
||||
// Update the event
|
||||
await database
|
||||
.update(events)
|
||||
.set({
|
||||
name: name.trim(),
|
||||
date: date,
|
||||
time: time,
|
||||
location: location?.trim() || '',
|
||||
locationType: locationType as 'none' | 'text' | 'maps',
|
||||
locationUrl: locationType === 'maps' ? locationUrl?.trim() : null,
|
||||
type: type,
|
||||
attendeeLimit: type === 'limited' ? parseInt(attendeeLimit) : null,
|
||||
visibility: visibility,
|
||||
updatedAt: new Date()
|
||||
})
|
||||
.where(and(eq(events.id, eventId), eq(events.userId, userId)))
|
||||
.catch((error) => {
|
||||
logger.error({ error, eventId, userId }, 'Unexpected error updating event');
|
||||
throw error;
|
||||
});
|
||||
|
||||
throw redirect(303, `/event/${eventId}`);
|
||||
}
|
||||
};
|
||||
460
src/routes/event/[id]/edit/+page.svelte
Normal file
460
src/routes/event/[id]/edit/+page.svelte
Normal file
@@ -0,0 +1,460 @@
|
||||
<script lang="ts">
|
||||
import type { CreateEventData, EventType, LocationType } from '$lib/types';
|
||||
import { enhance } from '$app/forms';
|
||||
import { goto } from '$app/navigation';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
export let data;
|
||||
export let form;
|
||||
|
||||
let eventData: CreateEventData = {
|
||||
name: data.event.name,
|
||||
date: data.event.date,
|
||||
time: data.event.time,
|
||||
location: data.event.location,
|
||||
location_type: data.event.locationType || 'none',
|
||||
location_url: data.event.locationUrl || '',
|
||||
type: data.event.type,
|
||||
attendee_limit: data.event.attendeeLimit || undefined,
|
||||
visibility: data.event.visibility
|
||||
};
|
||||
|
||||
let errors: Record<string, string> = {};
|
||||
let isSubmitting = false;
|
||||
let inviteToken = data.inviteToken;
|
||||
|
||||
let showInviteLinkToast = false;
|
||||
let toastHideTimer: number | null = null;
|
||||
|
||||
// Get today's date in YYYY-MM-DD format for min attribute
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
|
||||
// Handle form errors from server
|
||||
$: if (form?.error) {
|
||||
errors.server = form.error;
|
||||
}
|
||||
|
||||
// Pre-fill form with values from server on error
|
||||
$: if (form && 'values' in form && form.values) {
|
||||
const values = form.values;
|
||||
eventData = {
|
||||
...eventData,
|
||||
...values,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
attendee_limit: (values as any).attendee_limit
|
||||
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
parseInt(String((values as any).attendee_limit))
|
||||
: undefined
|
||||
};
|
||||
}
|
||||
|
||||
const handleTypeChange = (type: EventType) => {
|
||||
eventData.type = type;
|
||||
if (type === 'unlimited') {
|
||||
eventData.attendee_limit = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const handleLocationTypeChange = (locationType: LocationType) => {
|
||||
eventData.location_type = locationType;
|
||||
if (locationType === 'none') {
|
||||
eventData.location = '';
|
||||
eventData.location_url = '';
|
||||
} else if (locationType === 'text') {
|
||||
eventData.location_url = '';
|
||||
eventData.location = '';
|
||||
} else {
|
||||
eventData.location = 'Google Maps';
|
||||
}
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
goto(`/event/${data.event.id}`);
|
||||
};
|
||||
|
||||
const copyInviteLink = async () => {
|
||||
if (inviteToken) {
|
||||
const inviteUrl = `${window.location.origin}/event/${data.event.id}/invite/${inviteToken.token}`;
|
||||
try {
|
||||
await navigator.clipboard.writeText(inviteUrl);
|
||||
showInviteLinkToast = true;
|
||||
|
||||
// Auto-hide toast after 3 seconds
|
||||
if (toastHideTimer) clearTimeout(toastHideTimer);
|
||||
toastHideTimer = window.setTimeout(() => {
|
||||
showInviteLinkToast = false;
|
||||
}, 3000);
|
||||
} catch (err) {
|
||||
console.error('Failed to copy invite link:', err);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{t('event.editTitle', { eventName: data.event.name })}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
<!-- Main Content -->
|
||||
<div class="container mx-auto flex-1 px-4 py-8">
|
||||
<div class="mx-auto max-w-2xl">
|
||||
<!-- Event Edit Form -->
|
||||
<div class="rounded-sm border p-8">
|
||||
<div class="mb-8 text-center">
|
||||
<h2 class="text-3xl font-bold text-violet-400">{t('event.editEventTitle')}</h2>
|
||||
<p class="mt-2 text-sm text-slate-400">{t('event.editEventDescription')}</p>
|
||||
</div>
|
||||
|
||||
<form
|
||||
method="POST"
|
||||
use:enhance={() => {
|
||||
isSubmitting = true;
|
||||
return async ({ result, update }) => {
|
||||
isSubmitting = false;
|
||||
if (result.type === 'failure') {
|
||||
// Handle validation errors
|
||||
if (result.data?.error) {
|
||||
errors.server = String(result.data.error);
|
||||
}
|
||||
}
|
||||
update();
|
||||
};
|
||||
}}
|
||||
class="space-y-6"
|
||||
>
|
||||
{#if errors.server}
|
||||
<div class="mb-6 rounded-sm border border-red-200 bg-red-50 p-4 text-red-700">
|
||||
{errors.server}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Event Name -->
|
||||
<div>
|
||||
<label for="name" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('common.name')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
bind:value={eventData.name}
|
||||
class="border-dark-300 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm"
|
||||
placeholder={t('common.enterEventName')}
|
||||
maxlength="100"
|
||||
required
|
||||
/>
|
||||
{#if errors.name}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.name}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Date and Time Row -->
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="date" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('common.date')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="date"
|
||||
name="date"
|
||||
type="date"
|
||||
bind:value={eventData.date}
|
||||
min={today}
|
||||
class="border-dark-300 w-full rounded-sm border-2 bg-white px-4 py-3 text-slate-900 shadow-sm transition-all duration-200"
|
||||
required
|
||||
/>
|
||||
{#if errors.date}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.date}</p>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="time" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('common.time')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="time"
|
||||
name="time"
|
||||
type="time"
|
||||
bind:value={eventData.time}
|
||||
class="border-dark-300 w-full rounded-sm border-2 bg-white px-4 py-3 text-slate-900 shadow-sm transition-all duration-200"
|
||||
required
|
||||
/>
|
||||
{#if errors.time}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.time}</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location Type -->
|
||||
<div>
|
||||
<!-- Hidden input to submit locationType value -->
|
||||
<input type="hidden" name="locationType" bind:value={eventData.location_type} />
|
||||
|
||||
<fieldset>
|
||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('create.locationTypeLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</legend>
|
||||
<div class="grid grid-cols-3 gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.location_type ===
|
||||
'none'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => handleLocationTypeChange('none')}
|
||||
>
|
||||
{t('create.locationNoneOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.location_type ===
|
||||
'text'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => handleLocationTypeChange('text')}
|
||||
>
|
||||
{t('create.locationTextOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.location_type ===
|
||||
'maps'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => handleLocationTypeChange('maps')}
|
||||
>
|
||||
{t('create.locationMapsOption')}
|
||||
</button>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-slate-400">
|
||||
{eventData.location_type === 'none'
|
||||
? t('create.locationNoneDescription')
|
||||
: eventData.location_type === 'text'
|
||||
? t('create.locationTextDescription')
|
||||
: t('create.locationMapsDescription')}
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Location Input (only show when not 'none') -->
|
||||
{#if eventData.location_type !== 'none'}
|
||||
<div>
|
||||
<label for="location" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{eventData.location_type === 'text'
|
||||
? t('create.locationLabel')
|
||||
: t('create.googleMapsUrlLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
{#if eventData.location_type === 'text'}
|
||||
<input
|
||||
id="location"
|
||||
name="location"
|
||||
type="text"
|
||||
bind:value={eventData.location}
|
||||
class="border-dark-300 placeholder-dark-500 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm transition-all"
|
||||
placeholder={t('create.locationPlaceholder')}
|
||||
maxlength="200"
|
||||
required
|
||||
/>
|
||||
{:else}
|
||||
<input
|
||||
id="location_url"
|
||||
name="location_url"
|
||||
type="url"
|
||||
bind:value={eventData.location_url}
|
||||
class="border-dark-300 placeholder-dark-500 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm transition-all"
|
||||
placeholder={t('create.googleMapsUrlPlaceholder')}
|
||||
maxlength="500"
|
||||
required
|
||||
/>
|
||||
{/if}
|
||||
{#if errors.location}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.location}</p>
|
||||
{/if}
|
||||
{#if errors.location_url}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.location_url}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Event Type -->
|
||||
<div>
|
||||
<!-- Hidden input to submit type value -->
|
||||
<input type="hidden" name="type" bind:value={eventData.type} />
|
||||
|
||||
<fieldset>
|
||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('common.type')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</legend>
|
||||
<div class="grid grid-cols-2 gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.type ===
|
||||
'unlimited'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => handleTypeChange('unlimited')}
|
||||
>
|
||||
{t('common.unlimited')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.type ===
|
||||
'limited'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => handleTypeChange('limited')}
|
||||
>
|
||||
{t('common.limited')}
|
||||
</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Limit (only for limited events) -->
|
||||
{#if eventData.type === 'limited'}
|
||||
<div>
|
||||
<label for="limit" class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('common.attendeeLimit')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="attendee_limit"
|
||||
name="attendee_limit"
|
||||
type="number"
|
||||
bind:value={eventData.attendee_limit}
|
||||
min="1"
|
||||
max="1000"
|
||||
class="border-dark-300 w-full rounded-sm border-2 bg-white px-4 py-3 text-slate-900 shadow-sm transition-all duration-200"
|
||||
placeholder={t('common.enterLimit')}
|
||||
required
|
||||
/>
|
||||
{#if errors.attendee_limit}
|
||||
<p class="mt-2 text-sm font-medium text-red-600">{errors.attendee_limit}</p>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Event Visibility -->
|
||||
<div>
|
||||
<!-- Hidden input to submit visibility value -->
|
||||
<input type="hidden" name="visibility" bind:value={eventData.visibility} />
|
||||
|
||||
<fieldset>
|
||||
<legend class="text-dark-800 mb-3 block text-sm font-semibold">
|
||||
{t('common.visibility')} <span class="text-red-400">{t('common.required')}</span>
|
||||
</legend>
|
||||
<div class="grid grid-cols-3 gap-3">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.visibility ===
|
||||
'public'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700'}"
|
||||
on:click={() => (eventData.visibility = 'public')}
|
||||
>
|
||||
{t('create.publicOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.visibility ===
|
||||
'private'
|
||||
? ' border-violet-500 bg-violet-400/20 font-semibold hover:bg-violet-400/70'
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => (eventData.visibility = 'private')}
|
||||
>
|
||||
{t('create.privateOption')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-sm border-2 px-4 py-3 font-medium transition-all duration-200 {eventData.visibility ===
|
||||
'invite-only'
|
||||
? ' border-amber-500 bg-amber-400/20 font-semibold hover:bg-amber-400/70'
|
||||
: 'border-dark-300 text-dark-700 bg-gray-600/20 hover:bg-gray-600/70'}"
|
||||
on:click={() => (eventData.visibility = 'invite-only')}
|
||||
>
|
||||
{t('create.inviteOnlyOption')}
|
||||
</button>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-slate-400">
|
||||
{eventData.visibility === 'public'
|
||||
? t('create.publicDescription')
|
||||
: eventData.visibility === 'private'
|
||||
? t('create.privateDescription')
|
||||
: t('create.inviteOnlyDescription')}
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<!-- Invite Link Section (only for invite-only events and event creator) -->
|
||||
{#if eventData.visibility === 'invite-only' && inviteToken && data.event.userId === data.userId}
|
||||
<div class="rounded-sm border border-amber-500/30 bg-amber-900/20 p-4">
|
||||
<div class="mb-3 flex items-center justify-between">
|
||||
<h3 class="text-lg font-semibold text-amber-400">Invite Link</h3>
|
||||
</div>
|
||||
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-center space-x-2">
|
||||
<input
|
||||
type="text"
|
||||
value={`${window.location.origin}/event/${data.event.id}/invite/${inviteToken.token}`}
|
||||
readonly
|
||||
class="flex-1 rounded-sm border border-amber-300 bg-amber-50 px-3 py-2 text-sm text-amber-900"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
on:click={copyInviteLink}
|
||||
class="rounded-sm border border-amber-300 bg-amber-200 px-3 py-2 text-sm font-medium text-amber-900 hover:bg-amber-300"
|
||||
>
|
||||
{t('event.copyInviteLinkButton')}
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-xs text-amber-300">
|
||||
{t('event.inviteLinkExpiresAt', {
|
||||
time: new Date(inviteToken.expires_at).toLocaleString()
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="flex space-x-3">
|
||||
<button
|
||||
type="button"
|
||||
on:click={handleCancel}
|
||||
class="flex-1 rounded-sm border-2 border-slate-300 bg-slate-200 px-4 py-3 font-semibold text-slate-700 transition-all duration-200 hover:bg-slate-400 hover:text-slate-200"
|
||||
>
|
||||
{t('common.cancel')}
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isSubmitting}
|
||||
class="hover:bg-violet-400/70' flex-1 rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
{#if isSubmitting}
|
||||
<div class="flex items-center justify-center">
|
||||
<div class="mr-2 h-5 w-5 animate-spin rounded-full border-b-2 border-white"></div>
|
||||
{t('event.updatingEvent')}
|
||||
</div>
|
||||
{:else}
|
||||
{t('event.updateEventButton')}
|
||||
{/if}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Invite Link Toast -->
|
||||
{#if showInviteLinkToast}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500/30 bg-yellow-900 p-4 text-yellow-400"
|
||||
>
|
||||
{t('event.inviteLinkCopied')}
|
||||
</div>
|
||||
{/if}
|
||||
223
src/routes/event/[id]/invite/[token]/+page.server.ts
Normal file
223
src/routes/event/[id]/invite/[token]/+page.server.ts
Normal file
@@ -0,0 +1,223 @@
|
||||
import { database } from '$lib/database/db';
|
||||
import { events, rsvps, inviteTokens } from '$lib/database/schema';
|
||||
import { eq, and, asc } from 'drizzle-orm';
|
||||
import { error, fail } from '@sveltejs/kit';
|
||||
import type { PageServerLoad, Actions } from './$types';
|
||||
import { isTokenValid } from '$lib/inviteTokenHelpers.js';
|
||||
|
||||
export const load: PageServerLoad = async ({ params, cookies }) => {
|
||||
const eventId = params.id;
|
||||
const token = params.token;
|
||||
|
||||
if (!eventId || !token) {
|
||||
throw error(404, 'Event or token not found');
|
||||
}
|
||||
|
||||
try {
|
||||
// Fetch event, RSVPs, and invite token in parallel
|
||||
const [eventData, rsvpData, tokenData] = await Promise.all([
|
||||
database.select().from(events).where(eq(events.id, eventId)).limit(1),
|
||||
database.select().from(rsvps).where(eq(rsvps.eventId, eventId)).orderBy(asc(rsvps.createdAt)),
|
||||
database
|
||||
.select()
|
||||
.from(inviteTokens)
|
||||
.where(and(eq(inviteTokens.eventId, eventId), eq(inviteTokens.token, token)))
|
||||
.limit(1)
|
||||
]);
|
||||
|
||||
if (!eventData[0]) {
|
||||
throw error(404, 'Event not found');
|
||||
}
|
||||
|
||||
if (!tokenData[0]) {
|
||||
throw error(404, 'Invalid invite token');
|
||||
}
|
||||
|
||||
const event = eventData[0];
|
||||
const eventRsvps = rsvpData;
|
||||
const inviteToken = tokenData[0];
|
||||
|
||||
// Check if token is still valid
|
||||
if (!isTokenValid(inviteToken.expiresAt.toISOString())) {
|
||||
throw error(410, 'Invite token has expired');
|
||||
}
|
||||
|
||||
// Check if event is invite-only
|
||||
if (event.visibility !== 'invite-only') {
|
||||
throw error(403, 'This event does not require an invite');
|
||||
}
|
||||
|
||||
// Transform the data to match the expected interface
|
||||
const transformedEvent = {
|
||||
id: event.id,
|
||||
name: event.name,
|
||||
date: event.date,
|
||||
time: event.time,
|
||||
location: event.location,
|
||||
location_type: event.locationType,
|
||||
location_url: event.locationUrl,
|
||||
type: event.type,
|
||||
attendee_limit: event.attendeeLimit,
|
||||
visibility: event.visibility,
|
||||
user_id: event.userId,
|
||||
created_at: event.createdAt?.toISOString() || new Date().toISOString(),
|
||||
updated_at: event.updatedAt?.toISOString() || new Date().toISOString()
|
||||
};
|
||||
|
||||
const transformedRsvps = eventRsvps.map((rsvp) => ({
|
||||
id: rsvp.id,
|
||||
event_id: rsvp.eventId,
|
||||
name: rsvp.name,
|
||||
user_id: rsvp.userId,
|
||||
created_at: rsvp.createdAt?.toISOString() || new Date().toISOString()
|
||||
}));
|
||||
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
return {
|
||||
event: transformedEvent,
|
||||
rsvps: transformedRsvps,
|
||||
userId: userId,
|
||||
inviteToken: {
|
||||
id: inviteToken.id,
|
||||
event_id: inviteToken.eventId,
|
||||
token: inviteToken.token,
|
||||
expires_at: inviteToken.expiresAt.toISOString(),
|
||||
created_at: inviteToken.createdAt?.toISOString() || new Date().toISOString()
|
||||
}
|
||||
};
|
||||
} catch (err) {
|
||||
if (err instanceof Response) throw err; // This is the 404/410/403 error
|
||||
|
||||
console.error('Error loading invite-only event:', err);
|
||||
throw error(500, 'Failed to load event');
|
||||
}
|
||||
};
|
||||
|
||||
export const actions: Actions = {
|
||||
addRSVP: async ({ request, params, cookies }) => {
|
||||
const eventId = params.id;
|
||||
const token = params.token;
|
||||
const formData = await request.formData();
|
||||
|
||||
const name = formData.get('newAttendeeName') as string;
|
||||
const numberOfGuests = parseInt(formData.get('numberOfGuests') as string) || 0;
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
if (!name?.trim() || !userId) {
|
||||
return fail(400, { error: 'Name and user ID are required' });
|
||||
}
|
||||
|
||||
try {
|
||||
// Verify the invite token is still valid
|
||||
const [tokenData] = await database
|
||||
.select()
|
||||
.from(inviteTokens)
|
||||
.where(and(eq(inviteTokens.eventId, eventId), eq(inviteTokens.token, token)))
|
||||
.limit(1);
|
||||
|
||||
if (!tokenData || !isTokenValid(tokenData.expiresAt.toISOString())) {
|
||||
return fail(403, { error: 'Invalid or expired invite token' });
|
||||
}
|
||||
|
||||
// Check if event exists and get its details
|
||||
const [eventData] = await database.select().from(events).where(eq(events.id, eventId));
|
||||
if (!eventData) {
|
||||
return fail(404, { error: 'Event not found' });
|
||||
}
|
||||
|
||||
// Get current RSVPs
|
||||
const currentRSVPs = await database.select().from(rsvps).where(eq(rsvps.eventId, eventId));
|
||||
|
||||
// Calculate total attendees (including guests)
|
||||
const totalAttendees = currentRSVPs.length + numberOfGuests;
|
||||
|
||||
// Check if event is full (for limited type events)
|
||||
if (eventData.type === 'limited' && eventData.attendeeLimit) {
|
||||
if (totalAttendees > eventData.attendeeLimit) {
|
||||
return fail(400, {
|
||||
error: `Event capacity exceeded. You're trying to add ${numberOfGuests + 1} attendees (including yourself), but only ${eventData.attendeeLimit - currentRSVPs.length} spots remain.`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Check if name is already in the list
|
||||
if (currentRSVPs.some((rsvp) => rsvp.name.toLowerCase() === name.toLowerCase())) {
|
||||
return fail(400, { error: 'Name already exists for this event' });
|
||||
}
|
||||
|
||||
// Prepare RSVPs to insert
|
||||
const rsvpsToInsert = [
|
||||
{
|
||||
eventId: eventId,
|
||||
name: name.trim(),
|
||||
userId: userId,
|
||||
createdAt: new Date()
|
||||
}
|
||||
];
|
||||
|
||||
// Add guest entries
|
||||
for (let i = 1; i <= numberOfGuests; i++) {
|
||||
rsvpsToInsert.push({
|
||||
eventId: eventId,
|
||||
name: `${name.trim()}'s Guest #${i}`,
|
||||
userId: userId,
|
||||
createdAt: new Date()
|
||||
});
|
||||
}
|
||||
|
||||
// Insert all RSVPs
|
||||
await database.insert(rsvps).values(rsvpsToInsert);
|
||||
|
||||
return { success: true, type: 'add' };
|
||||
} catch (err) {
|
||||
console.error('Error adding RSVP:', err);
|
||||
return fail(500, { error: 'Failed to add RSVP' });
|
||||
}
|
||||
},
|
||||
|
||||
removeRSVP: async ({ request, params, cookies }) => {
|
||||
const eventId = params.id;
|
||||
const token = params.token;
|
||||
const formData = await request.formData();
|
||||
|
||||
const rsvpId = formData.get('rsvpId') as string;
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
if (!rsvpId || !userId) {
|
||||
return fail(400, { error: 'RSVP ID and user ID are required' });
|
||||
}
|
||||
|
||||
try {
|
||||
// Verify the invite token is still valid
|
||||
const [tokenData] = await database
|
||||
.select()
|
||||
.from(inviteTokens)
|
||||
.where(and(eq(inviteTokens.eventId, eventId), eq(inviteTokens.token, token)))
|
||||
.limit(1);
|
||||
|
||||
if (!tokenData || !isTokenValid(tokenData.expiresAt.toISOString())) {
|
||||
return fail(403, { error: 'Invalid or expired invite token' });
|
||||
}
|
||||
|
||||
// Check if RSVP exists and belongs to the user
|
||||
const [rsvpData] = await database
|
||||
.select()
|
||||
.from(rsvps)
|
||||
.where(and(eq(rsvps.id, rsvpId), eq(rsvps.eventId, eventId), eq(rsvps.userId, userId)))
|
||||
.limit(1);
|
||||
|
||||
if (!rsvpData) {
|
||||
return fail(404, { error: 'RSVP not found or you do not have permission to remove it' });
|
||||
}
|
||||
|
||||
// Delete the RSVP
|
||||
await database.delete(rsvps).where(eq(rsvps.id, rsvpId));
|
||||
|
||||
return { success: true, type: 'remove' };
|
||||
} catch (err) {
|
||||
console.error('Error removing RSVP:', err);
|
||||
return fail(500, { error: 'Failed to remove RSVP' });
|
||||
}
|
||||
}
|
||||
};
|
||||
472
src/routes/event/[id]/invite/[token]/+page.svelte
Normal file
472
src/routes/event/[id]/invite/[token]/+page.svelte
Normal file
@@ -0,0 +1,472 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { browser } from '$app/environment';
|
||||
import type { Event, RSVP, InviteToken } from '$lib/types';
|
||||
import { goto } from '$app/navigation';
|
||||
import { enhance } from '$app/forms';
|
||||
import { formatTime, formatDate } from '$lib/dateHelpers.js';
|
||||
import CalendarModal from '$lib/components/CalendarModal.svelte';
|
||||
import type { CalendarEvent } from '$lib/calendarHelpers.js';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
|
||||
export let data: { event: Event; rsvps: RSVP[]; userId: string; inviteToken: InviteToken };
|
||||
export let form;
|
||||
|
||||
let event: Event;
|
||||
let rsvps: RSVP[] = [];
|
||||
let newAttendeeName = '';
|
||||
let isAddingRSVP = false;
|
||||
let error = '';
|
||||
let success = '';
|
||||
let addGuests = false;
|
||||
let numberOfGuests = 1;
|
||||
let showCalendarModal = false;
|
||||
let calendarEvent: CalendarEvent;
|
||||
|
||||
// Use server-side data
|
||||
$: event = data.event;
|
||||
$: rsvps = data.rsvps;
|
||||
$: currentUserId = data.userId;
|
||||
$: isEventCreator = event.user_id === currentUserId;
|
||||
|
||||
// Create calendar event object when event data changes
|
||||
$: if (event && browser) {
|
||||
calendarEvent = {
|
||||
name: event.name,
|
||||
date: event.date,
|
||||
time: event.time,
|
||||
location: event.location,
|
||||
url: `${$page.url.origin}/event/${eventId}/invite/${token}`
|
||||
};
|
||||
}
|
||||
|
||||
// Handle form errors from server
|
||||
$: if (form?.error) {
|
||||
error = String(form.error);
|
||||
success = '';
|
||||
}
|
||||
|
||||
// Handle form success from server
|
||||
$: if (form?.success) {
|
||||
success = 'RSVP added successfully!';
|
||||
error = '';
|
||||
newAttendeeName = '';
|
||||
addGuests = false;
|
||||
numberOfGuests = 1;
|
||||
}
|
||||
|
||||
const eventId = $page.params.id || '';
|
||||
const token = $page.params.token || '';
|
||||
|
||||
const copyInviteLink = () => {
|
||||
if (browser && isEventCreator) {
|
||||
const url = `${$page.url.origin}/event/${eventId}/invite/${token}`;
|
||||
navigator.clipboard.writeText(url).then(() => {
|
||||
success = 'Invite link copied to clipboard!';
|
||||
setTimeout(() => {
|
||||
success = '';
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const clearMessages = () => {
|
||||
error = '';
|
||||
success = '';
|
||||
};
|
||||
|
||||
// Calendar modal functions
|
||||
const openCalendarModal = () => {
|
||||
showCalendarModal = true;
|
||||
};
|
||||
|
||||
const closeCalendarModal = () => {
|
||||
showCalendarModal = false;
|
||||
};
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{event?.name || t('event.eventTitle')} - Invite Only</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex min-h-screen flex-col">
|
||||
<!-- Main Content -->
|
||||
<div class="container mx-auto flex-1 px-4 py-6">
|
||||
{#if error && !event}
|
||||
<!-- Error State -->
|
||||
<div class="mx-auto max-w-md text-center">
|
||||
<div class="rounded-sm border border-red-500/30 bg-red-900/20 p-8">
|
||||
<div class="mb-4 text-6xl text-red-400">⚠️</div>
|
||||
<h2 class="mb-4 text-2xl font-bold text-red-400">{t('event.eventNotFoundTitle')}</h2>
|
||||
<p class="my-8">{t('event.eventNotFoundDescription')}</p>
|
||||
<button
|
||||
on:click={() => goto('/create')}
|
||||
class="border-white-500 bg-white-400/20 mt-2 rounded-sm border px-6 py-3 font-semibold text-white duration-400 hover:scale-110 hover:bg-white/10"
|
||||
>
|
||||
{t('common.createNewEvent')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{:else if event}
|
||||
<div class="mx-auto max-w-2xl space-y-6">
|
||||
<!-- Invite Only Banner -->
|
||||
<div class="rounded-sm border border-amber-500/30 bg-amber-900/20 p-4">
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="text-2xl">🎫</div>
|
||||
<div>
|
||||
<h3 class="font-semibold text-amber-400">{t('event.inviteOnlyBannerTitle')}</h3>
|
||||
<p class="text-sm text-amber-300">{t('event.inviteOnlyBannerSubtitle')}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Event Details Card -->
|
||||
<div class="rounded-sm border p-6 shadow-2xl">
|
||||
<h2 class=" mb-4 text-center text-2xl font-bold">
|
||||
{event.name}
|
||||
</h2>
|
||||
|
||||
<div class="space-y-4">
|
||||
<!-- Date & Time -->
|
||||
<div class="flex items-center space-x-3 text-violet-400">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-sm">
|
||||
<svg class=" h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<p class="font-semibold text-white">
|
||||
{formatDate(event.date)}
|
||||
<span class="font-medium text-violet-400">-</span>
|
||||
{formatTime(event.time)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Location (only show when not 'none') -->
|
||||
<div class="flex items-center space-x-3 text-violet-400">
|
||||
<div class="flex h-8 w-8 items-center justify-center rounded-sm">
|
||||
<svg class=" h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"
|
||||
></path>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M15 11a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
{#if event.location_type === 'none'}
|
||||
<p class="font-semibold text-white">N/A</p>
|
||||
{:else if event.location_type === 'maps' && event.location_url}
|
||||
<a
|
||||
href={event.location_url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="font-semibold text-white transition-colors duration-200 hover:text-violet-300"
|
||||
>
|
||||
{t('create.locationMapsOption')}
|
||||
</a>
|
||||
{:else}
|
||||
<p class="font-semibold text-white">{event.location}</p>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Event Type, Visibility & Capacity -->
|
||||
<div class="flex items-center justify-between rounded-sm p-3">
|
||||
<div class="flex items-center space-x-2">
|
||||
<span
|
||||
class="rounded-sm border px-2 py-1 text-xs font-medium {event.type === 'limited'
|
||||
? 'border-amber-600 text-amber-600'
|
||||
: 'border-teal-500 text-teal-500'}"
|
||||
>
|
||||
{event.type === 'limited' ? t('common.limited') : t('common.unlimited')}
|
||||
</span>
|
||||
<span
|
||||
class="rounded-sm border border-amber-300 px-2 py-1 text-xs font-medium text-amber-400"
|
||||
>
|
||||
{t('event.inviteOnlyBadge')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#if event.type === 'limited' && event.attendee_limit}
|
||||
<div class="text-right">
|
||||
<p class="text-sm">{t('common.capacity')}</p>
|
||||
<p class=" text-lg font-bold">
|
||||
{rsvps.length}/{event.attendee_limit}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- RSVP Form -->
|
||||
<div class=" rounded-sm border p-6 shadow-2xl backdrop-blur-sm">
|
||||
<h3 class=" mb-4 text-xl font-bold">{t('event.joinThisEvent')}</h3>
|
||||
|
||||
{#if event.type === 'limited' && event.attendee_limit && rsvps.length >= event.attendee_limit}
|
||||
<div class="py-6 text-center">
|
||||
<div class="mb-3 text-4xl text-red-400">🚫</div>
|
||||
<p class="font-semibold text-red-400">{t('event.eventIsFull')}</p>
|
||||
<p class="mt-1 text-sm">{t('event.maximumCapacityReached')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<form
|
||||
method="POST"
|
||||
action="?/addRSVP"
|
||||
use:enhance={() => {
|
||||
isAddingRSVP = true;
|
||||
clearMessages();
|
||||
return async ({ result, update }) => {
|
||||
isAddingRSVP = false;
|
||||
if (result.type === 'failure') {
|
||||
error = String(result.data?.error || 'Failed to add RSVP');
|
||||
}
|
||||
update();
|
||||
};
|
||||
}}
|
||||
class="space-y-4"
|
||||
>
|
||||
<input type="hidden" name="userId" value={currentUserId} />
|
||||
<div>
|
||||
<label for="attendeeName" class=" mb-2 block text-sm font-semibold">
|
||||
{t('event.yourNameLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="attendeeName"
|
||||
name="newAttendeeName"
|
||||
type="text"
|
||||
bind:value={newAttendeeName}
|
||||
class="border-dark-300 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm"
|
||||
placeholder={t('event.yourNamePlaceholder')}
|
||||
maxlength="50"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Add Guests Toggle -->
|
||||
<div class="flex items-center space-x-3">
|
||||
<input
|
||||
id="addGuests"
|
||||
type="checkbox"
|
||||
bind:checked={addGuests}
|
||||
class="h-4 w-4 rounded border-gray-300 text-violet-600 focus:ring-violet-500"
|
||||
/>
|
||||
<label for="addGuests" class="text-sm font-medium text-white">
|
||||
{t('event.addGuestsLabel')}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Number of Guests Input -->
|
||||
{#if addGuests}
|
||||
<div>
|
||||
<label for="numberOfGuests" class="mb-2 block text-sm font-semibold">
|
||||
{t('event.numberOfGuestsLabel')}
|
||||
<span class="text-red-400">{t('common.required')}</span>
|
||||
</label>
|
||||
<input
|
||||
id="numberOfGuests"
|
||||
name="numberOfGuests"
|
||||
type="number"
|
||||
bind:value={numberOfGuests}
|
||||
min="1"
|
||||
max="10"
|
||||
class="border-dark-300 w-full rounded-sm border-2 px-4 py-3 text-slate-900 shadow-sm"
|
||||
placeholder={t('event.numberOfGuestsPlaceholder')}
|
||||
required
|
||||
/>
|
||||
<p class="mt-1 text-xs text-slate-400">
|
||||
{t('event.guestsWillBeAddedAs', {
|
||||
name: newAttendeeName || t('common.yourNamePlaceholder')
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
type="submit"
|
||||
disabled={isAddingRSVP ||
|
||||
!newAttendeeName.trim() ||
|
||||
(addGuests && numberOfGuests < 1)}
|
||||
class=" hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
{#if isAddingRSVP}
|
||||
<div class="flex items-center justify-center">
|
||||
<div
|
||||
class="mr-2 h-5 w-5 animate-spin rounded-full border-b-2 border-white"
|
||||
></div>
|
||||
{t('event.adding')}
|
||||
</div>
|
||||
{:else if addGuests && numberOfGuests > 0}
|
||||
{t('event.joinEventWithGuests', {
|
||||
count: numberOfGuests,
|
||||
plural: numberOfGuests > 1 ? 's' : ''
|
||||
})}
|
||||
{:else}
|
||||
{t('event.joinEventButton')}
|
||||
{/if}
|
||||
</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Attendees List -->
|
||||
<div class="rounded-sm border p-6 shadow-2xl backdrop-blur-sm">
|
||||
<div class="mb-4 flex items-center justify-between">
|
||||
<h3 class=" text-xl font-bold">{t('event.attendeesTitle')}</h3>
|
||||
<span class="text-2xl font-bold">{rsvps.length}</span>
|
||||
</div>
|
||||
|
||||
{#if rsvps.length === 0}
|
||||
<div class="text-dark-400 py-8 text-center">
|
||||
<p>{t('event.noAttendeesYet')}</p>
|
||||
<p class="mt-1 text-sm">{t('event.beFirstToJoin')}</p>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="space-y-3">
|
||||
{#each rsvps as attendee, i (i)}
|
||||
<div
|
||||
class="flex items-center justify-between rounded-sm border border-white/20 p-3"
|
||||
>
|
||||
<div class="flex items-center space-x-3">
|
||||
<div
|
||||
class="flex h-8 w-8 items-center justify-center rounded-full text-sm font-bold {attendee.name.includes(
|
||||
"'s Guest"
|
||||
)
|
||||
? 'text-white-400 bg-violet-500/40'
|
||||
: 'bg-violet-500/20 text-violet-400'}"
|
||||
>
|
||||
{attendee.name.charAt(0).toUpperCase()}
|
||||
</div>
|
||||
<div>
|
||||
<p
|
||||
class="font-medium text-white {attendee.name.includes("'s Guest")
|
||||
? 'text-amber-300'
|
||||
: ''}"
|
||||
>
|
||||
{attendee.name}
|
||||
</p>
|
||||
<p class="text-xs text-violet-400">
|
||||
{(() => {
|
||||
const date = new Date(attendee.created_at);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
return `${year}/${month}/${day} ${hours}:${minutes}`;
|
||||
})()}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if attendee.user_id === currentUserId}
|
||||
<form
|
||||
method="POST"
|
||||
action="?/removeRSVP"
|
||||
use:enhance={() => {
|
||||
clearMessages();
|
||||
return async ({ result, update }) => {
|
||||
if (result.type === 'failure') {
|
||||
error = String(result.data?.error || 'Failed to remove RSVP');
|
||||
}
|
||||
update();
|
||||
};
|
||||
}}
|
||||
style="display: inline;"
|
||||
>
|
||||
<input type="hidden" name="rsvpId" value={attendee.id} />
|
||||
<button
|
||||
type="submit"
|
||||
class="text-dark-400 p-1 transition-colors duration-200 hover:text-red-400"
|
||||
aria-label={t('event.removeRsvpAriaLabel')}
|
||||
>
|
||||
<svg class="h-4 w-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="max-w-2xl space-y-3">
|
||||
<button
|
||||
on:click={copyInviteLink}
|
||||
disabled={!isEventCreator}
|
||||
class="w-full rounded-sm border-2 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105 {isEventCreator
|
||||
? 'border-violet-500 bg-violet-400/20 hover:bg-violet-400/70'
|
||||
: 'cursor-not-allowed border-gray-500 bg-gray-600/20 hover:bg-gray-600/30'}"
|
||||
>
|
||||
{t('event.copyInviteLinkButton')}
|
||||
</button>
|
||||
<button
|
||||
on:click={openCalendarModal}
|
||||
class="hover:bg-violet-400/70' w-full rounded-sm border-2 border-violet-500 bg-violet-400/20 px-4 py-3 py-4 font-bold font-medium font-semibold text-white shadow-lg transition-all duration-200 hover:scale-105"
|
||||
>
|
||||
{t('event.addToCalendarButton')}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Calendar Modal -->
|
||||
{#if calendarEvent && browser}
|
||||
<CalendarModal
|
||||
bind:isOpen={showCalendarModal}
|
||||
event={calendarEvent}
|
||||
{eventId}
|
||||
baseUrl={$page.url.origin}
|
||||
on:close={closeCalendarModal}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<!-- Success/Error Messages -->
|
||||
{#if success}
|
||||
{#if form?.type === 'add'}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-green-500 bg-green-900 p-4 text-green-400"
|
||||
>
|
||||
{success}
|
||||
</div>
|
||||
{:else if form?.type === 'remove'}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-yellow-500 bg-yellow-900 p-4 text-yellow-400"
|
||||
>
|
||||
{t('event.removedRsvpSuccessfully')}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if error}
|
||||
<div
|
||||
class="fixed right-4 bottom-4 z-40 w-128 rounded-sm border border-red-500 bg-red-900 p-4 text-red-400"
|
||||
>
|
||||
{error}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -9,6 +9,7 @@
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
"moduleResolution": "bundler",
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user