2025-11-09
This commit is contained in:
parent
0284993ad3
commit
b7306d362c
3
.cursorindexingignore
Normal file
3
.cursorindexingignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
# Don't index SpecStory auto-save files, but allow explicit context inclusion via @ references
|
||||||
|
.specstory/**
|
||||||
4
.specstory/.gitignore
vendored
Normal file
4
.specstory/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# SpecStory project identity file
|
||||||
|
/.project.json
|
||||||
|
# SpecStory explanation file
|
||||||
|
/.what-is-this.md
|
||||||
19080
.specstory/history/2025-11-02_17-58Z-analyze-site-for-ui-improvements.md
Normal file
19080
.specstory/history/2025-11-02_17-58Z-analyze-site-for-ui-improvements.md
Normal file
File diff suppressed because one or more lines are too long
675
COPYING.txt
Normal file
675
COPYING.txt
Normal file
@ -0,0 +1,675 @@
|
|||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is 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. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
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 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. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
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 Affero 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 special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU 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 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 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 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 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 General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU 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 the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
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 GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||||
11
package-lock.json
generated
11
package-lock.json
generated
@ -17,6 +17,7 @@
|
|||||||
"minecraft-server-util": "^5.4.4",
|
"minecraft-server-util": "^5.4.4",
|
||||||
"motion": "^12.23.24",
|
"motion": "^12.23.24",
|
||||||
"next": "15.4.6",
|
"next": "15.4.6",
|
||||||
|
"next-themes": "^0.4.6",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
"recharts": "2.15.4",
|
"recharts": "2.15.4",
|
||||||
@ -16558,6 +16559,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/next-themes": {
|
||||||
|
"version": "0.4.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/next-themes/-/next-themes-0.4.6.tgz",
|
||||||
|
"integrity": "sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc",
|
||||||
|
"react-dom": "^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/next/node_modules/postcss": {
|
"node_modules/next/node_modules/postcss": {
|
||||||
"version": "8.4.31",
|
"version": "8.4.31",
|
||||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
"minecraft-server-util": "^5.4.4",
|
"minecraft-server-util": "^5.4.4",
|
||||||
"motion": "^12.23.24",
|
"motion": "^12.23.24",
|
||||||
"next": "15.4.6",
|
"next": "15.4.6",
|
||||||
|
"next-themes": "^0.4.6",
|
||||||
"react": "19.1.0",
|
"react": "19.1.0",
|
||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
"recharts": "2.15.4",
|
"recharts": "2.15.4",
|
||||||
|
|||||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
@ -35,6 +35,9 @@ importers:
|
|||||||
next:
|
next:
|
||||||
specifier: 15.4.6
|
specifier: 15.4.6
|
||||||
version: 15.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
version: 15.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||||
|
next-themes:
|
||||||
|
specifier: ^0.4.6
|
||||||
|
version: 0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
|
||||||
react:
|
react:
|
||||||
specifier: 19.1.0
|
specifier: 19.1.0
|
||||||
version: 19.1.0
|
version: 19.1.0
|
||||||
@ -3090,6 +3093,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
|
resolution: {integrity: sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==}
|
||||||
engines: {node: '>= 0.6'}
|
engines: {node: '>= 0.6'}
|
||||||
|
|
||||||
|
next-themes@0.4.6:
|
||||||
|
resolution: {integrity: sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==}
|
||||||
|
peerDependencies:
|
||||||
|
react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
|
||||||
|
react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
|
||||||
|
|
||||||
next@15.4.6:
|
next@15.4.6:
|
||||||
resolution: {integrity: sha512-us++E/Q80/8+UekzB3SAGs71AlLDsadpFMXVNM/uQ0BMwsh9m3mr0UNQIfjKed8vpWXsASe+Qifrnu1oLIcKEQ==}
|
resolution: {integrity: sha512-us++E/Q80/8+UekzB3SAGs71AlLDsadpFMXVNM/uQ0BMwsh9m3mr0UNQIfjKed8vpWXsASe+Qifrnu1oLIcKEQ==}
|
||||||
engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0}
|
engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0}
|
||||||
@ -7688,6 +7697,11 @@ snapshots:
|
|||||||
|
|
||||||
negotiator@1.0.0: {}
|
negotiator@1.0.0: {}
|
||||||
|
|
||||||
|
next-themes@0.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0):
|
||||||
|
dependencies:
|
||||||
|
react: 19.1.0
|
||||||
|
react-dom: 19.1.0(react@19.1.0)
|
||||||
|
|
||||||
next@15.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0):
|
next@15.4.6(react-dom@19.1.0(react@19.1.0))(react@19.1.0):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@next/env': 15.4.6
|
'@next/env': 15.4.6
|
||||||
|
|||||||
107
src/app/api/leaderboard/route.ts
Normal file
107
src/app/api/leaderboard/route.ts
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
|
const PLAN_BASE_URL = 'https://stats.biohazardvfx.com';
|
||||||
|
const SERVER_NAME = 'BiohazardVFX';
|
||||||
|
|
||||||
|
interface PlanPlayerData {
|
||||||
|
name: string; // HTML string with <a> tag, need to extract text
|
||||||
|
activePlaytime?: {
|
||||||
|
d: string; // Display format like "10d 3h 46m 48s"
|
||||||
|
v: string; // Value in milliseconds as string
|
||||||
|
};
|
||||||
|
sessions?: string;
|
||||||
|
[key: string]: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PlanPlayersResponse {
|
||||||
|
data?: PlanPlayerData[];
|
||||||
|
[key: string]: unknown;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const runtime = 'edge';
|
||||||
|
|
||||||
|
// Extract player name from HTML string
|
||||||
|
function extractPlayerName(nameString: string): string {
|
||||||
|
// Name format: '<a class="link" href="../player/...">PlayerName</a>'
|
||||||
|
const match = nameString.match(/>(.+?)<\/a>/);
|
||||||
|
return match ? match[1] : nameString.replace(/<[^>]*>/g, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function GET() {
|
||||||
|
try {
|
||||||
|
const playersResponse = await fetch(
|
||||||
|
`${PLAN_BASE_URL}/v1/players?server=${SERVER_NAME}`,
|
||||||
|
{
|
||||||
|
next: { revalidate: 300 }, // Cache for 5 minutes
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!playersResponse.ok) {
|
||||||
|
throw new Error(`Plan API returned ${playersResponse.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const data: PlanPlayersResponse = await playersResponse.json();
|
||||||
|
|
||||||
|
if (!data.data || !Array.isArray(data.data)) {
|
||||||
|
return NextResponse.json({
|
||||||
|
players: [],
|
||||||
|
total: 0,
|
||||||
|
message: 'No player data available',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Process and sort players by playtime
|
||||||
|
const processedPlayers = data.data
|
||||||
|
.map((player) => {
|
||||||
|
const playtimeMs = player.activePlaytime?.v
|
||||||
|
? parseInt(player.activePlaytime.v, 10)
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
// Convert milliseconds to seconds
|
||||||
|
const playtimeSeconds = Math.floor(playtimeMs / 1000);
|
||||||
|
|
||||||
|
// Format playtime for display
|
||||||
|
const days = Math.floor(playtimeSeconds / 86400);
|
||||||
|
const hours = Math.floor((playtimeSeconds % 86400) / 3600);
|
||||||
|
const minutes = Math.floor((playtimeSeconds % 3600) / 60);
|
||||||
|
|
||||||
|
let formatted = '';
|
||||||
|
if (days > 0) {
|
||||||
|
formatted = `${days}d ${hours}h`;
|
||||||
|
} else if (hours > 0) {
|
||||||
|
formatted = `${hours}h ${minutes}m`;
|
||||||
|
} else {
|
||||||
|
formatted = `${minutes}m`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
name: extractPlayerName(player.name),
|
||||||
|
playtime: playtimeSeconds,
|
||||||
|
playtimeFormatted: player.activePlaytime?.d || formatted,
|
||||||
|
sessions: parseInt(player.sessions || '0', 10),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.filter((player) => player.playtime > 0) // Only players with playtime
|
||||||
|
.sort((a, b) => b.playtime - a.playtime) // Sort descending by playtime
|
||||||
|
.slice(0, 20); // Top 20 players
|
||||||
|
|
||||||
|
return NextResponse.json({
|
||||||
|
players: processedPlayers,
|
||||||
|
total: processedPlayers.length,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching Plan leaderboard:', error);
|
||||||
|
return NextResponse.json(
|
||||||
|
{
|
||||||
|
error: 'Failed to fetch leaderboard data',
|
||||||
|
players: [],
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
{ status: 500 }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -66,6 +66,9 @@
|
|||||||
--radius-md: calc(var(--radius) - 2px);
|
--radius-md: calc(var(--radius) - 2px);
|
||||||
--radius-lg: var(--radius);
|
--radius-lg: var(--radius);
|
||||||
--radius-xl: calc(var(--radius) + 4px);
|
--radius-xl: calc(var(--radius) + 4px);
|
||||||
|
--background-end-rgb: var(----background-end-rgb);
|
||||||
|
--background-start-rgb: var(----background-start-rgb);
|
||||||
|
--foreground-rgb: var(----foreground-rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
@ -122,6 +125,9 @@
|
|||||||
--shadow-xl: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 8px 10px -1px hsl(28 18% 25% / 0.18);
|
--shadow-xl: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 8px 10px -1px hsl(28 18% 25% / 0.18);
|
||||||
--shadow-2xl: 0px 2px 3px 0px hsl(28 18% 25% / 0.45);
|
--shadow-2xl: 0px 2px 3px 0px hsl(28 18% 25% / 0.45);
|
||||||
--tracking-normal: 0em;
|
--tracking-normal: 0em;
|
||||||
|
--foreground-rgb: 255, 255, 255;
|
||||||
|
--background-start-rgb: 0, 0, 0;
|
||||||
|
--background-end-rgb: 0, 0, 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
@ -187,4 +193,128 @@
|
|||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
letter-spacing: var(--tracking-normal);
|
letter-spacing: var(--tracking-normal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rocker Switch Styles */
|
||||||
|
.rocker {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #888;
|
||||||
|
width: 7em;
|
||||||
|
height: 4em;
|
||||||
|
overflow: hidden;
|
||||||
|
border-bottom: 0.5em solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker-small {
|
||||||
|
font-size: 0.75em;
|
||||||
|
width: 5.5em;
|
||||||
|
height: 3.2em;
|
||||||
|
border-bottom: 0.4em solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker label {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.5em;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
color: #aaa;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color 0.2s;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker input:checked + .switch-left,
|
||||||
|
.rocker input:not(:checked) + .switch-left + .switch-right {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker input:checked + .switch-left + .switch-right,
|
||||||
|
.rocker input:not(:checked) + .switch-left {
|
||||||
|
color: #888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-left,
|
||||||
|
.switch-right {
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 2.5em;
|
||||||
|
width: 3em;
|
||||||
|
transition: all 0.2s;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-left {
|
||||||
|
height: 2.4em;
|
||||||
|
width: 2.75em;
|
||||||
|
left: 0.85em;
|
||||||
|
bottom: 0.4em;
|
||||||
|
background-color: #ddd;
|
||||||
|
transform: rotate(15deg) skewX(15deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.switch-right {
|
||||||
|
right: 0.8em;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #575757;
|
||||||
|
color: #fff;
|
||||||
|
transform: rotate(-15deg) skewX(-15deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker-small .switch-left {
|
||||||
|
height: 1.9em;
|
||||||
|
width: 2.2em;
|
||||||
|
left: 0.65em;
|
||||||
|
bottom: 0.35em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker-small .switch-right {
|
||||||
|
right: 0.65em;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker input:checked + .switch-left {
|
||||||
|
background-color: #575757;
|
||||||
|
color: #fff;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0.5em;
|
||||||
|
height: 2.5em;
|
||||||
|
width: 2.75em;
|
||||||
|
transform: rotate(0deg) skewX(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker input:checked + .switch-left + .switch-right {
|
||||||
|
background-color: #ddd;
|
||||||
|
color: #888;
|
||||||
|
bottom: 0.4em;
|
||||||
|
right: 0.8em;
|
||||||
|
height: 2.4em;
|
||||||
|
width: 2.75em;
|
||||||
|
transform: rotate(0deg) skewX(0deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker-small input:checked + .switch-left {
|
||||||
|
left: 0.4em;
|
||||||
|
height: 1.9em;
|
||||||
|
width: 2.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rocker-small input:checked + .switch-left + .switch-right {
|
||||||
|
right: 0.4em;
|
||||||
|
height: 1.9em;
|
||||||
|
width: 2.2em;
|
||||||
}
|
}
|
||||||
@ -1,6 +1,9 @@
|
|||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Geist, Geist_Mono } from "next/font/google";
|
import { Geist, Geist_Mono } from "next/font/google";
|
||||||
import { Toaster } from 'sonner';
|
import { Toaster } from 'sonner';
|
||||||
|
import { ThemeProvider } from "@/lib/theme-provider";
|
||||||
|
import { Navigation } from "@/components/navigation";
|
||||||
|
import { CustomFooter } from "@/components/custom-footer";
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
|
|
||||||
const geistSans = Geist({
|
const geistSans = Geist({
|
||||||
@ -71,12 +74,21 @@ export default function RootLayout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en" suppressHydrationWarning>
|
||||||
<body
|
<body
|
||||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||||
>
|
>
|
||||||
{children}
|
<ThemeProvider
|
||||||
<Toaster position="bottom-right" />
|
attribute="class"
|
||||||
|
defaultTheme="system"
|
||||||
|
enableSystem
|
||||||
|
disableTransitionOnChange
|
||||||
|
>
|
||||||
|
<Navigation />
|
||||||
|
{children}
|
||||||
|
<CustomFooter />
|
||||||
|
<Toaster position="bottom-right" />
|
||||||
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -7,7 +7,9 @@ import { motion } from "motion/react";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Hero } from "@/components/hero";
|
import { Hero } from "@/components/hero";
|
||||||
import { ServerStatus } from "@/components/server-status";
|
import { ServerStatus } from "@/components/server-status";
|
||||||
|
import { Leaderboard } from "@/components/leaderboard";
|
||||||
import { MinecraftServerStructuredData } from "@/components/structured-data";
|
import { MinecraftServerStructuredData } from "@/components/structured-data";
|
||||||
|
import { MessageCircle } from "lucide-react";
|
||||||
|
|
||||||
interface ServerData {
|
interface ServerData {
|
||||||
online: boolean;
|
online: boolean;
|
||||||
@ -69,6 +71,7 @@ export default function Home() {
|
|||||||
src="/backgroundimg.avif"
|
src="/backgroundimg.avif"
|
||||||
alt="Minecraft background"
|
alt="Minecraft background"
|
||||||
fill
|
fill
|
||||||
|
sizes="100vw"
|
||||||
className="object-cover"
|
className="object-cover"
|
||||||
priority
|
priority
|
||||||
/>
|
/>
|
||||||
@ -78,30 +81,38 @@ export default function Home() {
|
|||||||
|
|
||||||
<div className="relative z-10 flex min-h-svh flex-col font-sans">
|
<div className="relative z-10 flex min-h-svh flex-col font-sans">
|
||||||
<main className="flex flex-1 items-center justify-center px-6 py-16 sm:px-10 lg:px-14">
|
<main className="flex flex-1 items-center justify-center px-6 py-16 sm:px-10 lg:px-14">
|
||||||
<div className="w-full max-w-5xl space-y-10">
|
<div className="w-full max-w-7xl">
|
||||||
<section className="rounded-3xl border border-white/10 bg-background/96 p-8 shadow-2xl backdrop-blur-xl sm:p-10 lg:p-12">
|
<div className="flex gap-6 items-start relative">
|
||||||
<div className="grid gap-10 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]">
|
{/* Leaderboard - Left Side (separate card) */}
|
||||||
<Hero />
|
<section className="hidden lg:flex lg:flex-shrink-0 w-[280px] rounded-3xl border border-white/10 bg-background/96 p-4 shadow-2xl backdrop-blur-xl self-start overflow-visible" style={{ maxHeight: '650px' }}>
|
||||||
|
<Leaderboard className="h-full" />
|
||||||
|
</section>
|
||||||
|
|
||||||
<div className="flex flex-col gap-6">
|
{/* Main Card - Centered */}
|
||||||
<div className="rounded-3xl border border-border/40 bg-background p-6 shadow-lg">
|
<div className="flex-1 flex justify-center">
|
||||||
<div className="flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between text-foreground">
|
<section className="w-full max-w-5xl rounded-3xl border border-white/10 bg-background/96 p-8 shadow-2xl backdrop-blur-xl sm:p-10 lg:p-12" id="main-card">
|
||||||
<div>
|
<div className="grid gap-10 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,0.95fr)]">
|
||||||
<p className="text-xs uppercase tracking-[0.35em] text-muted-foreground">
|
<Hero />
|
||||||
Live snapshot
|
|
||||||
</p>
|
<div className="flex flex-col gap-6" id="server-status">
|
||||||
<h2 className="text-2xl font-semibold tracking-tight">
|
<div className="rounded-3xl border border-border/40 bg-background p-6 shadow-lg">
|
||||||
Server Pulse
|
<div className="flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between text-foreground">
|
||||||
</h2>
|
<div>
|
||||||
|
<p className="text-xs uppercase tracking-[0.35em] text-muted-foreground">
|
||||||
|
Live snapshot
|
||||||
|
</p>
|
||||||
|
<h2 className="text-2xl font-semibold tracking-tight">
|
||||||
|
Server Pulse
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
<span className="text-xs uppercase tracking-[0.3em] text-muted-foreground">
|
||||||
|
Auto refresh • 30s
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="mt-6">
|
||||||
|
<ServerStatus className="h-full" />
|
||||||
</div>
|
</div>
|
||||||
<span className="text-xs uppercase tracking-[0.3em] text-muted-foreground">
|
|
||||||
Auto refresh • 30s
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-6">
|
|
||||||
<ServerStatus className="h-full" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<motion.div
|
<motion.div
|
||||||
className="rounded-3xl border border-border/50 bg-background/50 p-6 shadow-xl backdrop-blur"
|
className="rounded-3xl border border-border/50 bg-background/50 p-6 shadow-xl backdrop-blur"
|
||||||
@ -159,13 +170,32 @@ export default function Home() {
|
|||||||
transition={{ duration: 0.4, delay: 1.9, ease: "easeOut" }}
|
transition={{ duration: 0.4, delay: 1.9, ease: "easeOut" }}
|
||||||
style={{ willChange: "opacity, transform" }}
|
style={{ willChange: "opacity, transform" }}
|
||||||
>
|
>
|
||||||
<Button size="lg" className="mt-6 w-full font-bold shadow-lg transition-all hover:shadow-xl">
|
<Button
|
||||||
Join the Server
|
size="lg"
|
||||||
|
className="mt-6 w-full font-bold shadow-lg transition-all hover:shadow-xl"
|
||||||
|
asChild
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
href="https://discord.gg/58FnVzmzrS"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="flex items-center justify-center gap-2"
|
||||||
|
>
|
||||||
|
<MessageCircle className="h-5 w-5" />
|
||||||
|
Join Discord
|
||||||
|
</a>
|
||||||
</Button>
|
</Button>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Leaderboard Section - Mobile */}
|
||||||
|
<section className="mt-10 lg:hidden rounded-3xl border border-white/10 bg-background/96 p-8 shadow-2xl backdrop-blur-xl sm:p-10 lg:p-12">
|
||||||
|
<Leaderboard />
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
234
src/components/custom-footer.tsx
Normal file
234
src/components/custom-footer.tsx
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
import StickyFooter from '@/components/ui/footer';
|
||||||
|
import { motion } from 'framer-motion';
|
||||||
|
import { MessageCircle } from 'lucide-react';
|
||||||
|
import { toast } from 'sonner';
|
||||||
|
|
||||||
|
const currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
|
const footerData = {
|
||||||
|
sections: [
|
||||||
|
{
|
||||||
|
title: 'Server',
|
||||||
|
links: [
|
||||||
|
{ text: 'Home', href: '/' },
|
||||||
|
{ text: 'Status', href: '/#server-status' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Community',
|
||||||
|
links: [
|
||||||
|
{ text: 'Discord', href: 'https://discord.gg/58FnVzmzrS', external: true },
|
||||||
|
{ text: 'Server IP', href: '#', isButton: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Info',
|
||||||
|
links: [
|
||||||
|
{ text: 'Version: 1.21.x', href: '#', isStatic: true },
|
||||||
|
{ text: 'Difficulty: Hard', href: '#', isStatic: true },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
title: 'BiohazardVFX',
|
||||||
|
subtitle: 'Minecraft SMP Server',
|
||||||
|
copyright: `©${currentYear} BiohazardVFX. All rights reserved.`,
|
||||||
|
};
|
||||||
|
|
||||||
|
export function CustomFooter() {
|
||||||
|
const handleCopyIP = async () => {
|
||||||
|
try {
|
||||||
|
await navigator.clipboard.writeText('minecraft.biohazardvfx.com');
|
||||||
|
toast.success('Server IP copied to clipboard!');
|
||||||
|
} catch (error) {
|
||||||
|
toast.error('Failed to copy IP address');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="relative h-[70vh]" style={{ clipPath: 'polygon(0% 0, 100% 0%, 100% 100%, 0 100%)' }}>
|
||||||
|
<div className="relative h-[calc(100vh+70vh)] -top-[100vh]">
|
||||||
|
<div className="h-[70vh] sticky top-[calc(100vh-70vh)]">
|
||||||
|
<motion.div
|
||||||
|
initial="hidden"
|
||||||
|
animate="visible"
|
||||||
|
variants={{
|
||||||
|
hidden: { opacity: 0, y: 50 },
|
||||||
|
visible: {
|
||||||
|
opacity: 1,
|
||||||
|
y: 0,
|
||||||
|
transition: {
|
||||||
|
duration: 0.8,
|
||||||
|
ease: 'easeOut',
|
||||||
|
staggerChildren: 0.1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
className="bg-gradient-to-br from-card via-muted to-card/90 py-6 md:py-12 px-4 md:px-12 h-full w-full flex flex-col justify-between relative overflow-hidden"
|
||||||
|
>
|
||||||
|
<div className="absolute inset-0 bg-gradient-to-t from-background/20 to-transparent pointer-events-none" />
|
||||||
|
|
||||||
|
{/* Navigation Section */}
|
||||||
|
<motion.div className="relative z-10">
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-6 md:gap-12 lg:gap-20">
|
||||||
|
{footerData.sections.map((section, index) => (
|
||||||
|
<motion.div
|
||||||
|
key={section.title}
|
||||||
|
initial={{ opacity: 0, x: -20 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ delay: 0.3 + index * 0.1, duration: 0.6 }}
|
||||||
|
className="flex flex-col gap-2"
|
||||||
|
>
|
||||||
|
<h3 className="mb-2 uppercase text-muted-foreground text-xs font-semibold tracking-wider border-b border-border pb-1 hover:text-foreground transition-colors duration-300">
|
||||||
|
{section.title}
|
||||||
|
</h3>
|
||||||
|
{section.links.map((link, linkIndex) => {
|
||||||
|
if (link.external) {
|
||||||
|
return (
|
||||||
|
<motion.a
|
||||||
|
key={linkIndex}
|
||||||
|
href={link.href}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
whileHover={{ x: 8 }}
|
||||||
|
className="text-muted-foreground hover:text-foreground transition-colors duration-300 font-sans text-xs md:text-sm group relative"
|
||||||
|
>
|
||||||
|
<span className="relative">
|
||||||
|
{link.text}
|
||||||
|
<motion.span
|
||||||
|
className="absolute bottom-0 left-0 h-0.5 bg-primary"
|
||||||
|
initial={{ width: 0 }}
|
||||||
|
whileHover={{ width: '100%' }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</motion.a>
|
||||||
|
);
|
||||||
|
} else if (link.isButton) {
|
||||||
|
return (
|
||||||
|
<motion.button
|
||||||
|
key={linkIndex}
|
||||||
|
onClick={handleCopyIP}
|
||||||
|
whileHover={{ x: 8 }}
|
||||||
|
className="text-muted-foreground hover:text-foreground transition-colors duration-300 font-sans text-xs md:text-sm text-left group relative"
|
||||||
|
>
|
||||||
|
<span className="relative">
|
||||||
|
{link.text}
|
||||||
|
<motion.span
|
||||||
|
className="absolute bottom-0 left-0 h-0.5 bg-primary"
|
||||||
|
initial={{ width: 0 }}
|
||||||
|
whileHover={{ width: '100%' }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</motion.button>
|
||||||
|
);
|
||||||
|
} else if (link.isStatic) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
key={linkIndex}
|
||||||
|
className="text-muted-foreground font-sans text-xs md:text-sm"
|
||||||
|
>
|
||||||
|
{link.text}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<motion.a
|
||||||
|
key={linkIndex}
|
||||||
|
href={link.href}
|
||||||
|
whileHover={{ x: 8 }}
|
||||||
|
className="text-muted-foreground hover:text-foreground transition-colors duration-300 font-sans text-xs md:text-sm group relative"
|
||||||
|
>
|
||||||
|
<span className="relative">
|
||||||
|
{link.text}
|
||||||
|
<motion.span
|
||||||
|
className="absolute bottom-0 left-0 h-0.5 bg-primary"
|
||||||
|
initial={{ width: 0 }}
|
||||||
|
whileHover={{ width: '100%' }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</motion.a>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
</motion.div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
|
||||||
|
{/* Footer Bottom Section */}
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, y: 30 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
transition={{ delay: 0.8, duration: 0.8 }}
|
||||||
|
className="flex flex-col md:flex-row justify-between items-start md:items-end relative z-10 gap-4 md:gap-6 mt-6"
|
||||||
|
>
|
||||||
|
<div className="flex-1">
|
||||||
|
<motion.h1
|
||||||
|
initial={{ opacity: 0, x: -50 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ delay: 1, duration: 0.8 }}
|
||||||
|
whileHover={{ scale: 1.02 }}
|
||||||
|
className="text-[12vw] md:text-[10vw] lg:text-[8vw] xl:text-[6vw] leading-[0.8] font-serif bg-gradient-to-r from-foreground via-muted-foreground to-foreground/60 bg-clip-text text-transparent cursor-default"
|
||||||
|
>
|
||||||
|
{footerData.title}
|
||||||
|
</motion.h1>
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, width: 0 }}
|
||||||
|
animate={{ opacity: 1, width: 'auto' }}
|
||||||
|
transition={{ delay: 1.2, duration: 0.6 }}
|
||||||
|
className="flex items-center gap-3 md:gap-4 mt-3 md:mt-4"
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
className="w-8 md:w-12 h-0.5 bg-gradient-to-r from-primary to-secondary"
|
||||||
|
animate={{ scaleX: [1, 1.2, 1] }}
|
||||||
|
transition={{ duration: 2, repeat: Number.POSITIVE_INFINITY, ease: 'easeInOut' }}
|
||||||
|
/>
|
||||||
|
<motion.p
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
transition={{ delay: 1.4, duration: 0.5 }}
|
||||||
|
className="text-muted-foreground text-xs md:text-sm font-sans hover:text-foreground transition-colors duration-300"
|
||||||
|
>
|
||||||
|
{footerData.subtitle}
|
||||||
|
</motion.p>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, x: 50 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ delay: 1.6, duration: 0.6 }}
|
||||||
|
className="text-left md:text-right"
|
||||||
|
>
|
||||||
|
<motion.p
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
transition={{ delay: 1.8, duration: 0.5 }}
|
||||||
|
className="text-muted-foreground text-xs md:text-sm mb-2 md:mb-3 hover:text-foreground transition-colors duration-300"
|
||||||
|
>
|
||||||
|
{footerData.copyright}
|
||||||
|
</motion.p>
|
||||||
|
<motion.a
|
||||||
|
href="https://discord.gg/58FnVzmzrS"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
whileHover={{ scale: 1.1 }}
|
||||||
|
whileTap={{ scale: 0.9 }}
|
||||||
|
className="inline-flex items-center gap-2 w-8 h-8 md:w-10 md:h-10 rounded-full bg-muted hover:bg-gradient-to-r hover:from-primary hover:to-secondary transition-colors duration-300 justify-center"
|
||||||
|
aria-label="Join Discord"
|
||||||
|
>
|
||||||
|
<MessageCircle className="h-4 w-4 md:h-5 md:w-5 text-muted-foreground group-hover:text-primary-foreground" />
|
||||||
|
</motion.a>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -3,10 +3,12 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { Copy, Check } from 'lucide-react';
|
import { Copy, Check } from 'lucide-react';
|
||||||
import { HoverRollingText } from '@/components/hover-rolling-text';
|
import { HoverRollingText } from '@/components/hover-rolling-text';
|
||||||
import { motion } from 'motion/react';
|
import { motion } from 'motion/react';
|
||||||
|
import { ScreenshotLightbox } from '@/components/screenshot-lightbox';
|
||||||
|
|
||||||
const screenshots = [
|
const screenshots = [
|
||||||
'/2023-11-23_21.00.17.png',
|
'/2023-11-23_21.00.17.png',
|
||||||
@ -18,6 +20,9 @@ const screenshots = [
|
|||||||
export function Hero() {
|
export function Hero() {
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
const [currentImage, setCurrentImage] = useState(0);
|
const [currentImage, setCurrentImage] = useState(0);
|
||||||
|
const [lightboxOpen, setLightboxOpen] = useState(false);
|
||||||
|
const [lightboxIndex, setLightboxIndex] = useState(0);
|
||||||
|
const [imagesLoaded, setImagesLoaded] = useState(false);
|
||||||
const serverAddress = 'minecraft.biohazardvfx.com';
|
const serverAddress = 'minecraft.biohazardvfx.com';
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -25,7 +30,13 @@ export function Hero() {
|
|||||||
setCurrentImage((prev) => (prev + 1) % screenshots.length);
|
setCurrentImage((prev) => (prev + 1) % screenshots.length);
|
||||||
}, 5000); // Change image every 5 seconds
|
}, 5000); // Change image every 5 seconds
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
// Mark images as loaded after a short delay (they load progressively)
|
||||||
|
const loadTimer = setTimeout(() => setImagesLoaded(true), 500);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearInterval(interval);
|
||||||
|
clearTimeout(loadTimer);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const copyServerAddress = async () => {
|
const copyServerAddress = async () => {
|
||||||
@ -121,12 +132,31 @@ export function Hero() {
|
|||||||
|
|
||||||
{/* Screenshot Showcase */}
|
{/* Screenshot Showcase */}
|
||||||
<motion.div
|
<motion.div
|
||||||
className="group relative aspect-video overflow-hidden rounded-3xl border border-border/50 bg-card/50 shadow-2xl backdrop-blur transition-all hover:shadow-3xl"
|
className="group relative aspect-video overflow-hidden rounded-3xl border border-border/50 bg-card/50 shadow-2xl backdrop-blur transition-all hover:shadow-3xl cursor-pointer"
|
||||||
initial={{ opacity: 0, y: 20 }}
|
initial={{ opacity: 0, y: 20 }}
|
||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.5, delay: 0.9, ease: [0.33, 1, 0.68, 1] }}
|
transition={{ duration: 0.5, delay: 0.9, ease: [0.33, 1, 0.68, 1] }}
|
||||||
style={{ backfaceVisibility: "hidden", WebkitBackfaceVisibility: "hidden", transform: "translateZ(0)" }}
|
style={{ backfaceVisibility: "hidden", WebkitBackfaceVisibility: "hidden", transform: "translateZ(0)" }}
|
||||||
|
onClick={() => {
|
||||||
|
setLightboxIndex(currentImage);
|
||||||
|
setLightboxOpen(true);
|
||||||
|
}}
|
||||||
|
role="button"
|
||||||
|
tabIndex={0}
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
|
e.preventDefault();
|
||||||
|
setLightboxIndex(currentImage);
|
||||||
|
setLightboxOpen(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
aria-label="View screenshots in lightbox"
|
||||||
>
|
>
|
||||||
|
{!imagesLoaded && (
|
||||||
|
<div className="absolute inset-0">
|
||||||
|
<Skeleton className="h-full w-full" />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{screenshots.map((screenshot, index) => (
|
{screenshots.map((screenshot, index) => (
|
||||||
<div
|
<div
|
||||||
key={screenshot}
|
key={screenshot}
|
||||||
@ -137,6 +167,7 @@ export function Hero() {
|
|||||||
src={screenshot}
|
src={screenshot}
|
||||||
alt={`Minecraft server screenshot ${index + 1}`}
|
alt={`Minecraft server screenshot ${index + 1}`}
|
||||||
fill
|
fill
|
||||||
|
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"
|
||||||
className="object-cover transition-transform duration-700 group-hover:scale-105"
|
className="object-cover transition-transform duration-700 group-hover:scale-105"
|
||||||
priority={index === 0}
|
priority={index === 0}
|
||||||
/>
|
/>
|
||||||
@ -161,6 +192,14 @@ export function Hero() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
|
|
||||||
|
{/* Lightbox */}
|
||||||
|
<ScreenshotLightbox
|
||||||
|
images={screenshots}
|
||||||
|
isOpen={lightboxOpen}
|
||||||
|
initialIndex={lightboxIndex}
|
||||||
|
onClose={() => setLightboxOpen(false)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
164
src/components/leaderboard.tsx
Normal file
164
src/components/leaderboard.tsx
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { motion } from 'motion/react';
|
||||||
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
import { Trophy, Clock, Calendar } from 'lucide-react';
|
||||||
|
import { PlayerTooltip } from '@/components/player-tooltip';
|
||||||
|
|
||||||
|
interface LeaderboardPlayer {
|
||||||
|
name: string;
|
||||||
|
playtime: number;
|
||||||
|
playtimeFormatted: string;
|
||||||
|
sessions: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface LeaderboardData {
|
||||||
|
players: LeaderboardPlayer[];
|
||||||
|
total: number;
|
||||||
|
error?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const getRankBadge = (rank: number) => {
|
||||||
|
if (rank === 1) return '🥇';
|
||||||
|
if (rank === 2) return '🥈';
|
||||||
|
if (rank === 3) return '🥉';
|
||||||
|
return `#${rank}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export function Leaderboard({ className }: { className?: string }) {
|
||||||
|
const [data, setData] = useState<LeaderboardData | null>(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [error, setError] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchLeaderboard = async () => {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/leaderboard');
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Failed to fetch leaderboard');
|
||||||
|
}
|
||||||
|
const leaderboardData = await response.json() as LeaderboardData;
|
||||||
|
setData(leaderboardData);
|
||||||
|
setError(null);
|
||||||
|
} catch (err) {
|
||||||
|
setError('Failed to load leaderboard');
|
||||||
|
console.error(err);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchLeaderboard();
|
||||||
|
// Refresh every minute
|
||||||
|
const interval = setInterval(fetchLeaderboard, 60000);
|
||||||
|
return () => clearInterval(interval);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className={cn("w-full flex flex-col", className)} style={{ height: '100%', minHeight: 0 }}>
|
||||||
|
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
||||||
|
<Trophy className="h-4 w-4 text-primary" />
|
||||||
|
<h2 className="text-base font-semibold">Top Players</h2>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 overflow-y-auto" style={{ minHeight: 0 }}>
|
||||||
|
<div className="space-y-2 pr-2">
|
||||||
|
{[1, 2, 3, 4, 5, 6].map((i) => (
|
||||||
|
<div key={i} className="flex items-center gap-2 p-2 rounded-lg border border-border/50">
|
||||||
|
<Skeleton className="h-5 w-5 rounded-full" />
|
||||||
|
<Skeleton className="h-3 flex-1" />
|
||||||
|
<Skeleton className="h-3 w-12" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
{/* Spacer to prevent last item from being cut off */}
|
||||||
|
<div style={{ height: '2rem', minHeight: '2rem', flexShrink: 0 }} aria-hidden="true" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error || !data || data.players.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className={cn("w-full flex flex-col", className)} style={{ height: '100%', minHeight: 0 }}>
|
||||||
|
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
||||||
|
<Trophy className="h-4 w-4 text-primary" />
|
||||||
|
<h2 className="text-base font-semibold">Top Players</h2>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 flex items-center justify-center">
|
||||||
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
|
{error || 'No leaderboard data available'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<motion.div
|
||||||
|
className={cn("w-full flex flex-col relative", className)}
|
||||||
|
initial={{ opacity: 0, x: -20 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ duration: 0.5 }}
|
||||||
|
style={{ height: '100%', minHeight: 0, display: 'flex', flexDirection: 'column' }}
|
||||||
|
>
|
||||||
|
<div className="flex items-center gap-2 mb-4 flex-shrink-0">
|
||||||
|
<Trophy className="h-4 w-4 text-primary" />
|
||||||
|
<h2 className="text-base font-semibold">Top Players</h2>
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 overflow-y-auto" style={{ minHeight: 0 }}>
|
||||||
|
<div className="space-y-1.5 pr-2" style={{ paddingBottom: '2.5rem' }}>
|
||||||
|
{data.players.slice(0, 10).map((player, index) => {
|
||||||
|
const rank = index + 1;
|
||||||
|
const isTopThree = rank <= 3;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<motion.div
|
||||||
|
key={player.name}
|
||||||
|
className={cn(
|
||||||
|
"flex items-center gap-2 p-2 rounded-lg border transition-all text-sm",
|
||||||
|
isTopThree
|
||||||
|
? "bg-primary/5 border-primary/20 shadow-sm"
|
||||||
|
: "bg-background/50 border-border/50 hover:border-primary/30"
|
||||||
|
)}
|
||||||
|
initial={{ opacity: 0, x: -20 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ duration: 0.2, delay: index * 0.03 }}
|
||||||
|
>
|
||||||
|
<div className={cn(
|
||||||
|
"flex items-center justify-center w-6 h-6 rounded-full font-bold text-xs flex-shrink-0",
|
||||||
|
rank === 1 && "bg-primary text-primary-foreground",
|
||||||
|
rank === 2 && "bg-secondary text-secondary-foreground",
|
||||||
|
rank === 3 && "bg-accent text-accent-foreground",
|
||||||
|
rank > 3 && "bg-muted text-muted-foreground"
|
||||||
|
)}>
|
||||||
|
{rank <= 3 ? getRankBadge(rank) : rank}
|
||||||
|
</div>
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<PlayerTooltip playerName={player.name}>
|
||||||
|
<p className={cn(
|
||||||
|
"font-semibold truncate text-xs cursor-pointer",
|
||||||
|
isTopThree && "text-primary"
|
||||||
|
)}>
|
||||||
|
{player.name}
|
||||||
|
</p>
|
||||||
|
</PlayerTooltip>
|
||||||
|
<div className="flex items-center gap-2 mt-0.5 text-[10px] text-muted-foreground">
|
||||||
|
<span className="flex items-center gap-0.5">
|
||||||
|
<Clock className="h-2.5 w-2.5" />
|
||||||
|
{player.playtimeFormatted}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
45
src/components/navigation.tsx
Normal file
45
src/components/navigation.tsx
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useState } from 'react';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import { Menu, MenuItem, HoveredLink } from '@/components/ui/navbar-menu';
|
||||||
|
import { ThemeToggle } from '@/components/theme-toggle';
|
||||||
|
import { MessageCircle } from 'lucide-react';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
|
export function Navigation() {
|
||||||
|
const [active, setActive] = useState<string | null>(null);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="fixed top-4 left-1/2 -translate-x-1/2 z-50 w-full max-w-6xl px-4">
|
||||||
|
<Menu setActive={setActive}>
|
||||||
|
<MenuItem setActive={setActive} active={active} item="Home">
|
||||||
|
<div className="flex flex-col space-y-4 text-sm">
|
||||||
|
<HoveredLink href="/">Home</HoveredLink>
|
||||||
|
</div>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem setActive={setActive} active={active} item="Server">
|
||||||
|
<div className="flex flex-col space-y-4 text-sm">
|
||||||
|
<HoveredLink href="/#server-status">Server Status</HoveredLink>
|
||||||
|
</div>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem setActive={setActive} active={active} item="Community">
|
||||||
|
<div className="flex flex-col space-y-4 text-sm">
|
||||||
|
<HoveredLink
|
||||||
|
href="https://discord.gg/58FnVzmzrS"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="flex items-center gap-2"
|
||||||
|
>
|
||||||
|
<MessageCircle className="h-4 w-4" />
|
||||||
|
Discord
|
||||||
|
</HoveredLink>
|
||||||
|
</div>
|
||||||
|
</MenuItem>
|
||||||
|
<div className="flex items-center justify-center">
|
||||||
|
<ThemeToggle />
|
||||||
|
</div>
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -1,164 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import { useEffect, useState } from 'react';
|
|
||||||
import { Area, AreaChart, CartesianGrid, XAxis } from 'recharts';
|
|
||||||
import {
|
|
||||||
Card,
|
|
||||||
CardContent,
|
|
||||||
CardDescription,
|
|
||||||
CardHeader,
|
|
||||||
CardTitle,
|
|
||||||
} from '@/components/ui/card';
|
|
||||||
import {
|
|
||||||
ChartConfig,
|
|
||||||
ChartContainer,
|
|
||||||
ChartTooltip,
|
|
||||||
ChartTooltipContent,
|
|
||||||
} from '@/components/ui/chart';
|
|
||||||
import { cn } from '@/lib/utils';
|
|
||||||
|
|
||||||
const chartConfig = {
|
|
||||||
players: {
|
|
||||||
label: 'Players',
|
|
||||||
color: 'hsl(var(--chart-1))',
|
|
||||||
},
|
|
||||||
} satisfies ChartConfig;
|
|
||||||
|
|
||||||
interface ChartData {
|
|
||||||
date: string;
|
|
||||||
players: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface PlayerActivityChartProps {
|
|
||||||
className?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function PlayerActivityChart({ className }: PlayerActivityChartProps = {}) {
|
|
||||||
const [chartData, setChartData] = useState<ChartData[]>([]);
|
|
||||||
const [loading, setLoading] = useState(true);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
// Generate sample data for the last 7 days
|
|
||||||
// In a real implementation, this would fetch from Plan API
|
|
||||||
const generateData = () => {
|
|
||||||
const data: ChartData[] = [];
|
|
||||||
const now = new Date();
|
|
||||||
|
|
||||||
for (let i = 6; i >= 0; i--) {
|
|
||||||
const date = new Date(now);
|
|
||||||
date.setDate(date.getDate() - i);
|
|
||||||
|
|
||||||
data.push({
|
|
||||||
date: date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' }),
|
|
||||||
players: Math.floor(Math.random() * 5) + 1, // Random for demo
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
setChartData(generateData());
|
|
||||||
setLoading(false);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return (
|
|
||||||
<div className="h-[200px] flex items-center justify-center text-muted-foreground text-sm">
|
|
||||||
Loading chart...
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const peakPlayers = chartData.reduce((max, entry) => Math.max(max, entry.players), 0);
|
|
||||||
const averagePlayers =
|
|
||||||
chartData.length > 0
|
|
||||||
? Math.round(
|
|
||||||
chartData.reduce((sum, entry) => sum + entry.players, 0) / chartData.length
|
|
||||||
)
|
|
||||||
: 0;
|
|
||||||
const latestPlayers =
|
|
||||||
chartData.length > 0 ? chartData[chartData.length - 1].players : 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card
|
|
||||||
className={cn(
|
|
||||||
"rounded-2xl border border-border bg-card text-card-foreground shadow-lg",
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<CardHeader className="p-0 pb-4">
|
|
||||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
|
||||||
<div>
|
|
||||||
<CardTitle className="text-sm font-semibold">Player Activity</CardTitle>
|
|
||||||
<CardDescription className="text-xs text-muted-foreground">
|
|
||||||
Last 7 days
|
|
||||||
</CardDescription>
|
|
||||||
</div>
|
|
||||||
<div className="flex flex-wrap items-center gap-3 text-xs uppercase tracking-[0.3em] text-muted-foreground">
|
|
||||||
<span>
|
|
||||||
Peak<span className="ml-1 font-semibold text-foreground">{peakPlayers}</span>
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
Average
|
|
||||||
<span className="ml-1 font-semibold text-foreground">
|
|
||||||
{averagePlayers}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span>
|
|
||||||
Latest
|
|
||||||
<span className="ml-1 font-semibold text-foreground">{latestPlayers}</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</CardHeader>
|
|
||||||
<CardContent className="p-0">
|
|
||||||
<ChartContainer
|
|
||||||
config={chartConfig}
|
|
||||||
className="aspect-auto h-[220px] w-full rounded-xl border border-border/60 bg-background/95 p-4"
|
|
||||||
>
|
|
||||||
<AreaChart
|
|
||||||
accessibilityLayer
|
|
||||||
data={chartData}
|
|
||||||
margin={{
|
|
||||||
left: 12,
|
|
||||||
right: 12,
|
|
||||||
top: 12,
|
|
||||||
bottom: 12,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="players-gradient" x1="0" x2="0" y1="0" y2="1">
|
|
||||||
<stop offset="5%" stopColor="hsl(var(--chart-1))" stopOpacity={0.6} />
|
|
||||||
<stop offset="95%" stopColor="hsl(var(--chart-1))" stopOpacity={0.05} />
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
<CartesianGrid
|
|
||||||
vertical={false}
|
|
||||||
strokeDasharray="4 4"
|
|
||||||
stroke="rgba(148, 163, 184, 0.35)"
|
|
||||||
/>
|
|
||||||
<XAxis
|
|
||||||
dataKey="date"
|
|
||||||
tickLine={false}
|
|
||||||
axisLine={false}
|
|
||||||
tickMargin={8}
|
|
||||||
tickFormatter={(value) => value}
|
|
||||||
tick={{ fill: 'hsl(var(--muted-foreground))', fontSize: 12, fontWeight: 500 }}
|
|
||||||
/>
|
|
||||||
<ChartTooltip
|
|
||||||
cursor={false}
|
|
||||||
content={<ChartTooltipContent indicator="line" />}
|
|
||||||
/>
|
|
||||||
<Area
|
|
||||||
dataKey="players"
|
|
||||||
type="natural"
|
|
||||||
fill="url(#players-gradient)"
|
|
||||||
stroke="var(--color-players)"
|
|
||||||
strokeWidth={2.5}
|
|
||||||
/>
|
|
||||||
</AreaChart>
|
|
||||||
</ChartContainer>
|
|
||||||
</CardContent>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
111
src/components/player-tooltip.tsx
Normal file
111
src/components/player-tooltip.tsx
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useState } from 'react';
|
||||||
|
import { createPortal } from 'react-dom';
|
||||||
|
import { motion, AnimatePresence } from 'motion/react';
|
||||||
|
import { useEffect, useRef } from 'react';
|
||||||
|
|
||||||
|
interface PlayerTooltipProps {
|
||||||
|
playerName: string;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get Minecraft skin URL (using Minotar API)
|
||||||
|
const getMinecraftSkinUrl = (username: string) => {
|
||||||
|
// Minotar provides avatar images - use /avatar/ for head only or /helm/avatar/ for head with helm
|
||||||
|
return `https://minotar.net/avatar/${encodeURIComponent(username)}/64`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function PlayerTooltip({ playerName, children }: PlayerTooltipProps) {
|
||||||
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
|
const [position, setPosition] = useState({ top: 0, left: 0 });
|
||||||
|
const triggerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const updatePosition = () => {
|
||||||
|
if (triggerRef.current) {
|
||||||
|
// Find the actual child element (the <p> tag) to get its position
|
||||||
|
const childElement = triggerRef.current.firstElementChild as HTMLElement;
|
||||||
|
if (childElement) {
|
||||||
|
const rect = childElement.getBoundingClientRect();
|
||||||
|
setPosition({
|
||||||
|
top: rect.top - 90, // Position above the element (accounting for tooltip height)
|
||||||
|
left: rect.left + rect.width / 2,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isHovered) {
|
||||||
|
// Small delay to ensure DOM is ready
|
||||||
|
const timeoutId = setTimeout(updatePosition, 0);
|
||||||
|
window.addEventListener('scroll', updatePosition, true);
|
||||||
|
window.addEventListener('resize', updatePosition);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
window.removeEventListener('scroll', updatePosition, true);
|
||||||
|
window.removeEventListener('resize', updatePosition);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}, [isHovered]);
|
||||||
|
|
||||||
|
const tooltipContent = (
|
||||||
|
<AnimatePresence>
|
||||||
|
{isHovered && typeof window !== 'undefined' && (
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, y: 10, scale: 0.9 }}
|
||||||
|
animate={{
|
||||||
|
opacity: 1,
|
||||||
|
y: 0,
|
||||||
|
scale: 1,
|
||||||
|
transition: {
|
||||||
|
type: 'spring',
|
||||||
|
stiffness: 260,
|
||||||
|
damping: 20,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
exit={{ opacity: 0, y: 10, scale: 0.9 }}
|
||||||
|
className="fixed z-[100] flex -translate-x-1/2 flex-col items-center justify-center rounded-lg bg-card border border-border shadow-xl p-3"
|
||||||
|
style={{
|
||||||
|
pointerEvents: 'none',
|
||||||
|
willChange: 'transform',
|
||||||
|
top: `${position.top}px`,
|
||||||
|
left: `${position.left}px`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className="relative">
|
||||||
|
<img
|
||||||
|
src={getMinecraftSkinUrl(playerName)}
|
||||||
|
alt={`${playerName}'s Minecraft skin`}
|
||||||
|
width={64}
|
||||||
|
height={64}
|
||||||
|
className="rounded-md border-2 border-border"
|
||||||
|
loading="lazy"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mt-2 text-xs font-semibold text-foreground">
|
||||||
|
{playerName}
|
||||||
|
</div>
|
||||||
|
<div className="absolute -bottom-1 left-1/2 -translate-x-1/2 w-2 h-2 rotate-45 bg-card border-r border-b border-border" />
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div
|
||||||
|
ref={triggerRef}
|
||||||
|
className="relative inline"
|
||||||
|
onMouseEnter={() => setIsHovered(true)}
|
||||||
|
onMouseLeave={() => setIsHovered(false)}
|
||||||
|
style={{ display: 'inline' }}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
{typeof window !== 'undefined' && createPortal(tooltipContent, document.body)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
159
src/components/screenshot-lightbox.tsx
Normal file
159
src/components/screenshot-lightbox.tsx
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import Image from 'next/image';
|
||||||
|
import { motion, AnimatePresence } from 'motion/react';
|
||||||
|
import { X, ChevronLeft, ChevronRight } from 'lucide-react';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
|
interface ScreenshotLightboxProps {
|
||||||
|
images: string[];
|
||||||
|
isOpen: boolean;
|
||||||
|
initialIndex: number;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ScreenshotLightbox({ images, isOpen, initialIndex, onClose }: ScreenshotLightboxProps) {
|
||||||
|
const [currentIndex, setCurrentIndex] = useState(initialIndex);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setCurrentIndex(initialIndex);
|
||||||
|
}, [initialIndex]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isOpen) return;
|
||||||
|
|
||||||
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
onClose();
|
||||||
|
} else if (e.key === 'ArrowLeft') {
|
||||||
|
setCurrentIndex((prev) => (prev > 0 ? prev - 1 : images.length - 1));
|
||||||
|
} else if (e.key === 'ArrowRight') {
|
||||||
|
setCurrentIndex((prev) => (prev < images.length - 1 ? prev + 1 : 0));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('keydown', handleKeyDown);
|
||||||
|
return () => window.removeEventListener('keydown', handleKeyDown);
|
||||||
|
}, [isOpen, images.length, onClose]);
|
||||||
|
|
||||||
|
const goToPrevious = () => {
|
||||||
|
setCurrentIndex((prev) => (prev > 0 ? prev - 1 : images.length - 1));
|
||||||
|
};
|
||||||
|
|
||||||
|
const goToNext = () => {
|
||||||
|
setCurrentIndex((prev) => (prev < images.length - 1 ? prev + 1 : 0));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!isOpen) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AnimatePresence>
|
||||||
|
<motion.div
|
||||||
|
className="fixed inset-0 z-50 flex items-center justify-center"
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
|
{/* Backdrop */}
|
||||||
|
<motion.div
|
||||||
|
className="absolute inset-0 bg-black/90 backdrop-blur-sm"
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
exit={{ opacity: 0 }}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Lightbox Content */}
|
||||||
|
<motion.div
|
||||||
|
className="relative z-10 w-full h-full flex items-center justify-center p-4"
|
||||||
|
initial={{ scale: 0.9, opacity: 0 }}
|
||||||
|
animate={{ scale: 1, opacity: 1 }}
|
||||||
|
exit={{ scale: 0.9, opacity: 0 }}
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
{/* Close Button */}
|
||||||
|
<button
|
||||||
|
onClick={onClose}
|
||||||
|
className="absolute top-4 right-4 z-20 rounded-full bg-background/90 p-2 text-foreground hover:bg-background transition-colors shadow-lg"
|
||||||
|
aria-label="Close lightbox"
|
||||||
|
>
|
||||||
|
<X className="h-6 w-6" />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{/* Previous Button */}
|
||||||
|
{images.length > 1 && (
|
||||||
|
<button
|
||||||
|
onClick={goToPrevious}
|
||||||
|
className="absolute left-4 z-20 rounded-full bg-background/90 p-3 text-foreground hover:bg-background transition-colors shadow-lg"
|
||||||
|
aria-label="Previous image"
|
||||||
|
>
|
||||||
|
<ChevronLeft className="h-6 w-6" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Next Button */}
|
||||||
|
{images.length > 1 && (
|
||||||
|
<button
|
||||||
|
onClick={goToNext}
|
||||||
|
className="absolute right-4 z-20 rounded-full bg-background/90 p-3 text-foreground hover:bg-background transition-colors shadow-lg"
|
||||||
|
aria-label="Next image"
|
||||||
|
>
|
||||||
|
<ChevronRight className="h-6 w-6" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Image Container */}
|
||||||
|
<div className="relative w-full max-w-7xl h-full max-h-[90vh]">
|
||||||
|
<AnimatePresence mode="wait">
|
||||||
|
<motion.div
|
||||||
|
key={currentIndex}
|
||||||
|
initial={{ opacity: 0, x: 20 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
exit={{ opacity: 0, x: -20 }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
className="relative w-full h-full"
|
||||||
|
>
|
||||||
|
<Image
|
||||||
|
src={images[currentIndex]}
|
||||||
|
alt={`Screenshot ${currentIndex + 1} of ${images.length}`}
|
||||||
|
fill
|
||||||
|
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 90vw, 85vw"
|
||||||
|
className="object-contain"
|
||||||
|
priority
|
||||||
|
/>
|
||||||
|
</motion.div>
|
||||||
|
</AnimatePresence>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Image Counter */}
|
||||||
|
{images.length > 1 && (
|
||||||
|
<div className="absolute bottom-4 left-1/2 -translate-x-1/2 z-20 rounded-full bg-background/90 px-4 py-2 text-sm text-foreground shadow-lg">
|
||||||
|
{currentIndex + 1} / {images.length}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Thumbnail Indicators */}
|
||||||
|
{images.length > 1 && (
|
||||||
|
<div className="absolute bottom-16 left-1/2 -translate-x-1/2 z-20 flex gap-2">
|
||||||
|
{images.map((_, index) => (
|
||||||
|
<button
|
||||||
|
key={index}
|
||||||
|
onClick={() => setCurrentIndex(index)}
|
||||||
|
className={cn(
|
||||||
|
"h-2 rounded-full transition-all duration-300",
|
||||||
|
index === currentIndex
|
||||||
|
? "w-8 bg-primary"
|
||||||
|
: "w-2 bg-background/50 hover:bg-background/70"
|
||||||
|
)}
|
||||||
|
aria-label={`Go to image ${index + 1}`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</AnimatePresence>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@ -4,6 +4,7 @@ import { useEffect, useState } from 'react';
|
|||||||
import { motion } from 'motion/react';
|
import { motion } from 'motion/react';
|
||||||
|
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
|
|
||||||
interface ServerStatus {
|
interface ServerStatus {
|
||||||
online: boolean;
|
online: boolean;
|
||||||
@ -66,28 +67,125 @@ export function ServerStatus({ className }: ServerStatusProps = {}) {
|
|||||||
|
|
||||||
if (loading) {
|
if (loading) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2 text-muted-foreground">
|
<div className={cn("space-y-6 rounded-2xl border border-border/50 bg-card/50 p-6 shadow-xl backdrop-blur", className)}>
|
||||||
<div className="h-2 w-2 rounded-full bg-muted" />
|
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||||
<span>Loading server status...</span>
|
<div className="flex items-center gap-2.5">
|
||||||
|
<Skeleton className="h-3 w-3 rounded-full" />
|
||||||
|
<Skeleton className="h-4 w-24" />
|
||||||
|
</div>
|
||||||
|
<Skeleton className="h-5 w-32 rounded-full" />
|
||||||
|
</div>
|
||||||
|
<div className="grid min-w-0 gap-3 sm:grid-cols-2">
|
||||||
|
{[1, 2, 3, 4].map((i) => (
|
||||||
|
<div key={i} className="rounded-xl border border-border/50 bg-background/95 p-4">
|
||||||
|
<Skeleton className="h-3 w-20 mb-2" />
|
||||||
|
<Skeleton className="h-8 w-16 mb-1" />
|
||||||
|
<Skeleton className="h-2 w-12" />
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error || !status) {
|
if (error || !status) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2 text-destructive">
|
<motion.div
|
||||||
<div className="h-2 w-2 rounded-full bg-destructive" />
|
className={cn(
|
||||||
<span>Unable to connect to server</span>
|
"space-y-6 rounded-2xl border border-destructive/50 bg-destructive/10 p-6 text-card-foreground shadow-xl backdrop-blur",
|
||||||
</div>
|
className
|
||||||
|
)}
|
||||||
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
|
animate={{ opacity: 1, scale: 1 }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
className="flex items-center gap-3 rounded-xl border border-destructive/50 bg-destructive/20 px-4 py-3"
|
||||||
|
animate={{
|
||||||
|
boxShadow: [
|
||||||
|
'0 0 0px rgba(239, 68, 68, 0.4)',
|
||||||
|
'0 0 20px rgba(239, 68, 68, 0.6)',
|
||||||
|
'0 0 0px rgba(239, 68, 68, 0.4)',
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 2,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: 'easeInOut',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
className="h-3 w-3 rounded-full bg-destructive"
|
||||||
|
animate={{
|
||||||
|
scale: [1, 1.2, 1],
|
||||||
|
opacity: [1, 0.7, 1],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 1.5,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: 'easeInOut',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="text-sm font-bold text-destructive">Unable to connect to server</span>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!status.online) {
|
if (!status.online) {
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center gap-2 text-destructive">
|
<motion.div
|
||||||
<div className="h-2 w-2 rounded-full bg-destructive" />
|
className={cn(
|
||||||
<span>Server offline</span>
|
"space-y-6 rounded-2xl border border-destructive/50 bg-destructive/10 p-6 text-card-foreground shadow-xl backdrop-blur",
|
||||||
</div>
|
className
|
||||||
|
)}
|
||||||
|
initial={{ opacity: 0, scale: 0.95 }}
|
||||||
|
animate={{
|
||||||
|
opacity: 1,
|
||||||
|
scale: 1,
|
||||||
|
x: [0, -2, 2, -2, 2, 0],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 0.5,
|
||||||
|
x: {
|
||||||
|
duration: 0.3,
|
||||||
|
repeat: 0,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
className="flex items-center gap-3 rounded-xl border border-destructive/50 bg-destructive/20 px-4 py-3"
|
||||||
|
animate={{
|
||||||
|
boxShadow: [
|
||||||
|
'0 0 0px rgba(239, 68, 68, 0.4)',
|
||||||
|
'0 0 20px rgba(239, 68, 68, 0.6)',
|
||||||
|
'0 0 0px rgba(239, 68, 68, 0.4)',
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 2,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: 'easeInOut',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
className="h-3 w-3 rounded-full bg-destructive"
|
||||||
|
animate={{
|
||||||
|
scale: [1, 1.3, 1],
|
||||||
|
opacity: [1, 0.6, 1],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 1.5,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: 'easeInOut',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="text-sm font-bold text-destructive">Server Offline</span>
|
||||||
|
</motion.div>
|
||||||
|
<p className="text-xs text-muted-foreground text-center">
|
||||||
|
The server is currently unavailable. Please check back later.
|
||||||
|
</p>
|
||||||
|
</motion.div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,10 +238,31 @@ export function ServerStatus({ className }: ServerStatusProps = {}) {
|
|||||||
transition={{ duration: 0.4, delay: 0.5 }}
|
transition={{ duration: 0.4, delay: 0.5 }}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2.5">
|
<div className="flex items-center gap-2.5">
|
||||||
<span className="h-2 w-2 animate-pulse rounded-full bg-emerald-500 shadow-lg shadow-emerald-500/50" />
|
<motion.span
|
||||||
<span className="text-sm font-bold text-emerald-600 dark:text-emerald-400">
|
className="h-3 w-3 rounded-full bg-emerald-500 shadow-lg"
|
||||||
|
animate={{
|
||||||
|
scale: [1, 1.2, 1],
|
||||||
|
opacity: [1, 0.8, 1],
|
||||||
|
boxShadow: [
|
||||||
|
'0 0 0px rgba(16, 185, 129, 0.4)',
|
||||||
|
'0 0 10px rgba(16, 185, 129, 0.8)',
|
||||||
|
'0 0 0px rgba(16, 185, 129, 0.4)',
|
||||||
|
],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 2,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: 'easeInOut',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<motion.span
|
||||||
|
className="text-sm font-bold text-emerald-600 dark:text-emerald-400"
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
transition={{ delay: 0.6 }}
|
||||||
|
>
|
||||||
Server Online
|
Server Online
|
||||||
</span>
|
</motion.span>
|
||||||
</div>
|
</div>
|
||||||
<span className="rounded-full border border-border/40 bg-background/70 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.15em] text-muted-foreground shadow-sm">
|
<span className="rounded-full border border-border/40 bg-background/70 px-3 py-1 text-[10px] font-bold uppercase tracking-[0.15em] text-muted-foreground shadow-sm">
|
||||||
Refreshes every 30s
|
Refreshes every 30s
|
||||||
|
|||||||
38
src/components/theme-toggle.tsx
Normal file
38
src/components/theme-toggle.tsx
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import { useTheme } from 'next-themes';
|
||||||
|
import { Moon, Sun } from 'lucide-react';
|
||||||
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
|
export function ThemeToggle({ className }: { className?: string }) {
|
||||||
|
const { theme, setTheme } = useTheme();
|
||||||
|
const [mounted, setMounted] = React.useState(false);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
setMounted(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!mounted) {
|
||||||
|
return <div className={cn('h-9 w-16', className)} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isDark = theme === 'dark';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<label className={cn("rocker rocker-small", className)}>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={isDark}
|
||||||
|
onChange={(e) => setTheme(e.target.checked ? 'dark' : 'light')}
|
||||||
|
aria-label="Toggle theme"
|
||||||
|
/>
|
||||||
|
<span className="switch-left">
|
||||||
|
<Sun className="h-3 w-3" />
|
||||||
|
</span>
|
||||||
|
<span className="switch-right">
|
||||||
|
<Moon className="h-3 w-3" />
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
);
|
||||||
|
}
|
||||||
279
src/components/ui/footer.tsx
Normal file
279
src/components/ui/footer.tsx
Normal file
@ -0,0 +1,279 @@
|
|||||||
|
"use client"
|
||||||
|
import { motion } from "framer-motion"
|
||||||
|
|
||||||
|
// Animation variants for reusability
|
||||||
|
const containerVariants = {
|
||||||
|
hidden: { opacity: 0, y: 50 },
|
||||||
|
visible: {
|
||||||
|
opacity: 1,
|
||||||
|
y: 0,
|
||||||
|
transition: {
|
||||||
|
duration: 0.8,
|
||||||
|
ease: "easeOut",
|
||||||
|
staggerChildren: 0.1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemVariants = {
|
||||||
|
hidden: { opacity: 0, x: -20 },
|
||||||
|
visible: {
|
||||||
|
opacity: 1,
|
||||||
|
x: 0,
|
||||||
|
transition: { duration: 0.6, ease: "easeOut" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const linkVariants = {
|
||||||
|
hidden: { opacity: 0, y: 10 },
|
||||||
|
visible: {
|
||||||
|
opacity: 1,
|
||||||
|
y: 0,
|
||||||
|
transition: { duration: 0.4, ease: "easeOut" },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const socialVariants = {
|
||||||
|
hidden: { opacity: 0, scale: 0 },
|
||||||
|
visible: {
|
||||||
|
opacity: 1,
|
||||||
|
scale: 1,
|
||||||
|
transition: {
|
||||||
|
type: "spring",
|
||||||
|
stiffness: 200,
|
||||||
|
damping: 10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
const backgroundVariants = {
|
||||||
|
hidden: { opacity: 0, scale: 0.8 },
|
||||||
|
visible: {
|
||||||
|
opacity: 1,
|
||||||
|
scale: 1,
|
||||||
|
transition: {
|
||||||
|
duration: 2,
|
||||||
|
ease: "easeOut",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Footer data for better maintainability
|
||||||
|
const footerData = {
|
||||||
|
sections: [
|
||||||
|
{ title: "About", links: ["Home", "Projects", "Our Mission", "Contact Us"] },
|
||||||
|
{ title: "Education", links: ["News", "Learn", "Certification", "Publications"] },
|
||||||
|
{ title: "Services", links: ["Web Design", "Development", "Consulting", "Support"] },
|
||||||
|
{ title: "Resources", links: ["Blog", "Documentation", "Community", "Help Center"] },
|
||||||
|
],
|
||||||
|
social: [
|
||||||
|
{ href: "#", label: "Twitter", icon: "T" },
|
||||||
|
{ href: "#", label: "GitHub", icon: "G" },
|
||||||
|
{ href: "#", label: "LinkedIn", icon: "L" },
|
||||||
|
],
|
||||||
|
title: "Sticky Footer",
|
||||||
|
subtitle: "Scroll-triggered design",
|
||||||
|
copyright: "©2024 All rights reserved",
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reusable components
|
||||||
|
const NavSection = ({ title, links, index }: { title: string; links: string[]; index: number }) => (
|
||||||
|
<motion.div variants={itemVariants} custom={index} className="flex flex-col gap-2">
|
||||||
|
<motion.h3
|
||||||
|
initial={{ opacity: 0, y: -10 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
transition={{ delay: 0.3 + index * 0.1, duration: 0.5 }}
|
||||||
|
className="mb-2 uppercase text-muted-foreground text-xs font-semibold tracking-wider border-b border-border pb-1 hover:text-foreground transition-colors duration-300"
|
||||||
|
>
|
||||||
|
{title}
|
||||||
|
</motion.h3>
|
||||||
|
{links.map((link, linkIndex) => (
|
||||||
|
<motion.a
|
||||||
|
key={linkIndex}
|
||||||
|
variants={linkVariants}
|
||||||
|
custom={linkIndex}
|
||||||
|
href="#"
|
||||||
|
whileHover={{
|
||||||
|
x: 8,
|
||||||
|
transition: { type: "spring", stiffness: 300, damping: 20 },
|
||||||
|
}}
|
||||||
|
className="text-muted-foreground hover:text-foreground transition-colors duration-300 font-sans text-xs md:text-sm group relative"
|
||||||
|
>
|
||||||
|
<span className="relative">
|
||||||
|
{link}
|
||||||
|
<motion.span
|
||||||
|
className="absolute bottom-0 left-0 h-0.5 bg-primary"
|
||||||
|
initial={{ width: 0 }}
|
||||||
|
whileHover={{ width: "100%" }}
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</motion.a>
|
||||||
|
))}
|
||||||
|
</motion.div>
|
||||||
|
)
|
||||||
|
|
||||||
|
const SocialLink = ({ href, label, icon, index }: { href: string; label: string; icon: string; index: number }) => (
|
||||||
|
<motion.a
|
||||||
|
variants={socialVariants}
|
||||||
|
custom={index}
|
||||||
|
href={href}
|
||||||
|
whileHover={{
|
||||||
|
scale: 1.2,
|
||||||
|
rotate: 12,
|
||||||
|
transition: { type: "spring", stiffness: 300, damping: 15 },
|
||||||
|
}}
|
||||||
|
whileTap={{ scale: 0.9 }}
|
||||||
|
className="w-6 h-6 md:w-8 md:h-8 rounded-full bg-muted hover:bg-gradient-to-r hover:from-primary hover:to-secondary flex items-center justify-center transition-colors duration-300 group"
|
||||||
|
aria-label={label}
|
||||||
|
>
|
||||||
|
<motion.span
|
||||||
|
className="text-xs md:text-sm font-bold text-muted-foreground group-hover:text-primary-foreground"
|
||||||
|
whileHover={{ scale: 1.1 }}
|
||||||
|
>
|
||||||
|
{icon}
|
||||||
|
</motion.span>
|
||||||
|
</motion.a>
|
||||||
|
)
|
||||||
|
|
||||||
|
export default function StickyFooter() {
|
||||||
|
return (
|
||||||
|
<div className="relative h-[70vh] " style={{ clipPath: "polygon(0% 0, 100% 0%, 100% 100%, 0 100%)" }}>
|
||||||
|
<div className="relative h-[calc(100vh+70vh)] -top-[100vh]">
|
||||||
|
<div className="h-[70vh] sticky top-[calc(100vh-70vh)]">
|
||||||
|
<motion.div
|
||||||
|
initial="hidden"
|
||||||
|
animate="visible"
|
||||||
|
variants={containerVariants}
|
||||||
|
className="bg-gradient-to-br from-card via-muted to-card/90 py-6 md:py-12 px-4 md:px-12 h-full w-full flex flex-col justify-between relative overflow-hidden"
|
||||||
|
>
|
||||||
|
{/* Animated Background Elements */}
|
||||||
|
<div className="absolute inset-0 bg-gradient-to-t from-background/20 to-transparent pointer-events-none" />
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
variants={backgroundVariants}
|
||||||
|
className="absolute top-0 right-0 w-48 h-48 md:w-96 md:h-96 bg-primary/5 rounded-full blur-3xl"
|
||||||
|
animate={{
|
||||||
|
scale: [1, 1.1, 1],
|
||||||
|
opacity: [0.3, 0.6, 0.3],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 4,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: "easeInOut",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
variants={backgroundVariants}
|
||||||
|
className="absolute bottom-0 left-0 w-48 h-48 md:w-96 md:h-96 bg-secondary/5 rounded-full blur-3xl"
|
||||||
|
animate={{
|
||||||
|
scale: [1, 1.2, 1],
|
||||||
|
opacity: [0.2, 0.5, 0.2],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 5,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: "easeInOut",
|
||||||
|
delay: 1,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* Navigation Section */}
|
||||||
|
<motion.div variants={containerVariants} className="relative z-10">
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-6 md:gap-12 lg:gap-20">
|
||||||
|
{footerData.sections.map((section, index) => (
|
||||||
|
<NavSection key={section.title} title={section.title} links={section.links} index={index} />
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</motion.div>
|
||||||
|
|
||||||
|
{/* Footer Bottom Section */}
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, y: 30 }}
|
||||||
|
animate={{ opacity: 1, y: 0 }}
|
||||||
|
transition={{ delay: 0.8, duration: 0.8, ease: "easeOut" }}
|
||||||
|
className="flex flex-col md:flex-row justify-between items-start md:items-end relative z-10 gap-4 md:gap-6 mt-6"
|
||||||
|
>
|
||||||
|
<div className="flex-1">
|
||||||
|
<motion.h1
|
||||||
|
initial={{ opacity: 0, x: -50 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ delay: 1, duration: 0.8, ease: "easeOut" }}
|
||||||
|
whileHover={{
|
||||||
|
scale: 1.02,
|
||||||
|
transition: { type: "spring", stiffness: 300, damping: 20 },
|
||||||
|
}}
|
||||||
|
className="text-[12vw] md:text-[10vw] lg:text-[8vw] xl:text-[6vw] leading-[0.8] font-serif bg-gradient-to-r from-foreground via-muted-foreground to-foreground/60 bg-clip-text text-transparent cursor-default"
|
||||||
|
>
|
||||||
|
{footerData.title}
|
||||||
|
</motion.h1>
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, width: 0 }}
|
||||||
|
animate={{ opacity: 1, width: "auto" }}
|
||||||
|
transition={{ delay: 1.2, duration: 0.6 }}
|
||||||
|
className="flex items-center gap-3 md:gap-4 mt-3 md:mt-4"
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
className="w-8 md:w-12 h-0.5 bg-gradient-to-r from-primary to-secondary"
|
||||||
|
animate={{
|
||||||
|
scaleX: [1, 1.2, 1],
|
||||||
|
}}
|
||||||
|
transition={{
|
||||||
|
duration: 2,
|
||||||
|
repeat: Number.POSITIVE_INFINITY,
|
||||||
|
ease: "easeInOut",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<motion.p
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
transition={{ delay: 1.4, duration: 0.5 }}
|
||||||
|
className="text-muted-foreground text-xs md:text-sm font-sans hover:text-foreground transition-colors duration-300"
|
||||||
|
>
|
||||||
|
{footerData.subtitle}
|
||||||
|
</motion.p>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, x: 50 }}
|
||||||
|
animate={{ opacity: 1, x: 0 }}
|
||||||
|
transition={{ delay: 1.6, duration: 0.6 }}
|
||||||
|
className="text-left md:text-right"
|
||||||
|
>
|
||||||
|
<motion.p
|
||||||
|
initial={{ opacity: 0 }}
|
||||||
|
animate={{ opacity: 1 }}
|
||||||
|
transition={{ delay: 1.8, duration: 0.5 }}
|
||||||
|
className="text-muted-foreground text-xs md:text-sm mb-2 md:mb-3 hover:text-foreground transition-colors duration-300"
|
||||||
|
>
|
||||||
|
{footerData.copyright}
|
||||||
|
</motion.p>
|
||||||
|
|
||||||
|
<motion.div
|
||||||
|
variants={containerVariants}
|
||||||
|
initial="hidden"
|
||||||
|
animate="visible"
|
||||||
|
transition={{ delay: 2, staggerChildren: 0.1 }}
|
||||||
|
className="flex gap-2 md:gap-3"
|
||||||
|
>
|
||||||
|
{footerData.social.map((social, index) => (
|
||||||
|
<SocialLink
|
||||||
|
key={social.label}
|
||||||
|
href={social.href}
|
||||||
|
label={social.label}
|
||||||
|
icon={social.icon}
|
||||||
|
index={index}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
121
src/components/ui/navbar-menu.tsx
Normal file
121
src/components/ui/navbar-menu.tsx
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
"use client";
|
||||||
|
import React from "react";
|
||||||
|
import { motion } from "framer-motion";
|
||||||
|
import Link from "next/link";
|
||||||
|
import Image from "next/image";
|
||||||
|
|
||||||
|
const transition = {
|
||||||
|
type: "spring",
|
||||||
|
mass: 0.5,
|
||||||
|
damping: 11.5,
|
||||||
|
stiffness: 100,
|
||||||
|
restDelta: 0.001,
|
||||||
|
restSpeed: 0.001,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MenuItem = ({
|
||||||
|
setActive,
|
||||||
|
active,
|
||||||
|
item,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
setActive: (item: string) => void;
|
||||||
|
active: string | null;
|
||||||
|
item: string;
|
||||||
|
children?: React.ReactNode;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<div onMouseEnter={() => setActive(item)} className="relative ">
|
||||||
|
<motion.p
|
||||||
|
transition={{ duration: 0.3 }}
|
||||||
|
className="cursor-pointer text-foreground hover:text-primary transition-colors font-medium"
|
||||||
|
>
|
||||||
|
{item}
|
||||||
|
</motion.p>
|
||||||
|
{active !== null && (
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, scale: 0.85, y: 10 }}
|
||||||
|
animate={{ opacity: 1, scale: 1, y: 0 }}
|
||||||
|
transition={transition}
|
||||||
|
>
|
||||||
|
{active === item && (
|
||||||
|
<div className="absolute top-[calc(100%_+_1.2rem)] left-1/2 transform -translate-x-1/2 pt-4">
|
||||||
|
<motion.div
|
||||||
|
transition={transition}
|
||||||
|
layoutId="active" // layoutId ensures smooth animation
|
||||||
|
className="bg-card/95 backdrop-blur-md rounded-2xl overflow-hidden border border-border shadow-xl"
|
||||||
|
>
|
||||||
|
<motion.div
|
||||||
|
layout // layout ensures smooth animation
|
||||||
|
className="w-max h-full p-4"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</motion.div>
|
||||||
|
</motion.div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Menu = ({
|
||||||
|
setActive,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
setActive: (item: string | null) => void;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<nav
|
||||||
|
onMouseLeave={() => setActive(null)} // resets the state
|
||||||
|
className="relative rounded-full border border-border/50 dark:bg-background/95 dark:border-border bg-background/95 backdrop-blur-md shadow-lg flex justify-center space-x-4 px-8 py-4 "
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</nav>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ProductItem = ({
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
href,
|
||||||
|
src,
|
||||||
|
}: {
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
href: string;
|
||||||
|
src: string;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<Link href={href} className="flex space-x-2">
|
||||||
|
<Image
|
||||||
|
src={src}
|
||||||
|
width={140}
|
||||||
|
height={70}
|
||||||
|
alt={title}
|
||||||
|
className="flex-shrink-0 rounded-md shadow-2xl"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<h4 className="text-xl font-bold mb-1 text-black dark:text-white">
|
||||||
|
{title}
|
||||||
|
</h4>
|
||||||
|
<p className="text-neutral-700 text-sm max-w-[10rem] dark:text-neutral-300">
|
||||||
|
{description}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const HoveredLink = ({ children, ...rest }: any) => {
|
||||||
|
return (
|
||||||
|
<Link
|
||||||
|
{...rest}
|
||||||
|
className="text-muted-foreground hover:text-foreground transition-colors"
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
};
|
||||||
101
src/components/ui/shadcn-io/animated-tooltip/index.tsx
Normal file
101
src/components/ui/shadcn-io/animated-tooltip/index.tsx
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import React, { useState, useRef } from "react";
|
||||||
|
import {
|
||||||
|
motion,
|
||||||
|
useTransform,
|
||||||
|
AnimatePresence,
|
||||||
|
useMotionValue,
|
||||||
|
useSpring,
|
||||||
|
} from "motion/react";
|
||||||
|
|
||||||
|
export type AnimatedTooltipItem = {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
designation: string;
|
||||||
|
image: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AnimatedTooltipProps = {
|
||||||
|
items: AnimatedTooltipItem[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export const AnimatedTooltip = ({ items }: AnimatedTooltipProps) => {
|
||||||
|
const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);
|
||||||
|
const springConfig = { stiffness: 100, damping: 15 };
|
||||||
|
const x = useMotionValue(0);
|
||||||
|
const animationFrameRef = useRef<number | null>(null);
|
||||||
|
|
||||||
|
const rotate = useSpring(
|
||||||
|
useTransform(x, [-100, 100], [-45, 45]),
|
||||||
|
springConfig,
|
||||||
|
);
|
||||||
|
const translateX = useSpring(
|
||||||
|
useTransform(x, [-100, 100], [-50, 50]),
|
||||||
|
springConfig,
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleMouseMove = (event: any) => {
|
||||||
|
if (animationFrameRef.current) {
|
||||||
|
cancelAnimationFrame(animationFrameRef.current);
|
||||||
|
}
|
||||||
|
|
||||||
|
animationFrameRef.current = requestAnimationFrame(() => {
|
||||||
|
const halfWidth = event.target.offsetWidth / 2;
|
||||||
|
x.set(event.nativeEvent.offsetX - halfWidth);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{items.map((item, idx) => (
|
||||||
|
<div
|
||||||
|
className="group relative -mr-4"
|
||||||
|
key={item.name}
|
||||||
|
onMouseEnter={() => setHoveredIndex(item.id)}
|
||||||
|
onMouseLeave={() => setHoveredIndex(null)}
|
||||||
|
>
|
||||||
|
<AnimatePresence>
|
||||||
|
{hoveredIndex === item.id && (
|
||||||
|
<motion.div
|
||||||
|
initial={{ opacity: 0, y: 20, scale: 0.6 }}
|
||||||
|
animate={{
|
||||||
|
opacity: 1,
|
||||||
|
y: 0,
|
||||||
|
scale: 1,
|
||||||
|
transition: {
|
||||||
|
type: "spring",
|
||||||
|
stiffness: 260,
|
||||||
|
damping: 10,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
exit={{ opacity: 0, y: 20, scale: 0.6 }}
|
||||||
|
style={{
|
||||||
|
translateX: translateX,
|
||||||
|
rotate: rotate,
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
}}
|
||||||
|
className="absolute -top-16 left-1/2 z-50 flex -translate-x-1/2 flex-col items-center justify-center rounded-md bg-black px-4 py-2 text-xs shadow-xl"
|
||||||
|
>
|
||||||
|
<div className="absolute inset-x-10 -bottom-px z-30 h-px w-[20%] bg-gradient-to-r from-transparent via-emerald-500 to-transparent" />
|
||||||
|
<div className="absolute -bottom-px left-10 z-30 h-px w-[40%] bg-gradient-to-r from-transparent via-sky-500 to-transparent" />
|
||||||
|
<div className="relative z-30 text-base font-bold text-white">
|
||||||
|
{item.name}
|
||||||
|
</div>
|
||||||
|
<div className="text-xs text-white">{item.designation}</div>
|
||||||
|
</motion.div>
|
||||||
|
)}
|
||||||
|
</AnimatePresence>
|
||||||
|
<img
|
||||||
|
onMouseMove={handleMouseMove}
|
||||||
|
height={100}
|
||||||
|
width={100}
|
||||||
|
src={item.image}
|
||||||
|
alt={item.name}
|
||||||
|
className="relative !m-0 h-14 w-14 rounded-full border-2 border-white object-cover object-top !p-0 transition duration-500 group-hover:z-30 group-hover:scale-105"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
13
src/components/ui/skeleton.tsx
Normal file
13
src/components/ui/skeleton.tsx
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
data-slot="skeleton"
|
||||||
|
className={cn("bg-accent animate-pulse rounded-md", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Skeleton }
|
||||||
14
src/components/ui/switch.tsx
Normal file
14
src/components/ui/switch.tsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export const Component = () => {
|
||||||
|
return (
|
||||||
|
<div className={cn("flex flex-col items-center gap-4 p-4 rounded-lg")}>
|
||||||
|
<label className="rocker rocker-small">
|
||||||
|
<input type="checkbox" />
|
||||||
|
<span className="switch-left">Yes</span>
|
||||||
|
<span className="switch-right">No</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
12
src/lib/theme-provider.tsx
Normal file
12
src/lib/theme-provider.tsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import { ThemeProvider as NextThemesProvider } from 'next-themes';
|
||||||
|
|
||||||
|
export function ThemeProvider({
|
||||||
|
children,
|
||||||
|
...props
|
||||||
|
}: React.ComponentProps<typeof NextThemesProvider>) {
|
||||||
|
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user