First public commit
4
.dockerignore
Normal file
|
@ -0,0 +1,4 @@
|
|||
node_modules
|
||||
.env
|
||||
.sentryclirc
|
||||
sentry.properties
|
3
.eslintrc.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
78
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,78 @@
|
|||
name: ci
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- development
|
||||
|
||||
jobs:
|
||||
linting:
|
||||
name: Linting
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: yarn
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: ESLint
|
||||
run: yarn lint
|
||||
|
||||
# Label of the container job
|
||||
integration-tests:
|
||||
name: Run tests
|
||||
# Containers must run in Linux based operating systems
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Downloads a copy of the code in your repository before running CI tests
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: yarn
|
||||
|
||||
- name: Set environment variables
|
||||
run: |
|
||||
echo "DATABASE_URL=postgresql://postgres:password@localhost:5432/db" >> $GITHUB_ENV
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Run db
|
||||
run: |
|
||||
docker pull postgres:14.2
|
||||
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_DB=db postgres:14.2
|
||||
yarn wait-on --timeout 60000 tcp:localhost:5432
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
|
||||
- name: Deploy migrations
|
||||
run: yarn prisma migrate deploy
|
||||
|
||||
- name: Install playwright dependencies
|
||||
run: yarn playwright install --with-deps chromium
|
||||
|
||||
- name: Launch app
|
||||
run: yarn start 2>&1 & # backgrounnd mode
|
||||
|
||||
- name: Run tests
|
||||
run: yarn test
|
||||
|
||||
- name: Upload artifact playwright-report
|
||||
if: ${{ success() || failure() }}
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: playwright-report
|
||||
path: ./playwright-report
|
42
.gitignore
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# Sentry
|
||||
.sentryclirc
|
||||
|
||||
# playwright
|
||||
/playwright-report
|
||||
/test-results
|
8
.prettierrc
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"semi": true,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"trailingComma": "all",
|
||||
"singleQuote": false,
|
||||
"arrowParens": "always"
|
||||
}
|
6
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true
|
||||
},
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
22
Dockerfile
Normal file
|
@ -0,0 +1,22 @@
|
|||
FROM node:alpine
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
ENV PORT 3000
|
||||
ARG DATABASE_URL
|
||||
ENV DATABASE_URL $DATABASE_URL
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json /usr/src/app
|
||||
COPY yarn.lock /usr/src/app
|
||||
COPY schema.prisma /usr/src/app
|
||||
|
||||
RUN yarn --production
|
||||
|
||||
COPY . /usr/src/app
|
||||
|
||||
RUN yarn build
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
CMD [ "yarn", "start" ]
|
661
LICENSE
Normal file
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 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 Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
82
README.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
<img src="./public/logo.png" width="200" />
|
||||
|
||||
Rallly is an open-source collaborative scheduling service – designed and developed by @lukevella
|
||||
|
||||
## Running with docker
|
||||
|
||||
_This assumes that you have Docker installed_
|
||||
|
||||
Clone this repo and change directory to the root of the repository.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/lukevella/Rallly.git
|
||||
cd Rallly
|
||||
```
|
||||
|
||||
Build and run with `docker-compose`
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
Go to [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
## Running without docker
|
||||
|
||||
Clone this repo and change directory to the root of the repository.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/lukevella/Rallly.git
|
||||
cd Rallly
|
||||
```
|
||||
|
||||
Copy the sample `.env` file then open it and set the variables.
|
||||
|
||||
```bash
|
||||
cp sample.env .env
|
||||
```
|
||||
|
||||
You will need to supply a url to an empty postgres database.
|
||||
|
||||
```
|
||||
# /.env
|
||||
DATABASE_URL='postgresql://user:password@hostname/dbname'
|
||||
```
|
||||
|
||||
Install dependencies
|
||||
|
||||
```
|
||||
yarn
|
||||
```
|
||||
|
||||
Next we need to run the database migrations to create our tables
|
||||
|
||||
```
|
||||
yarn prisma migrate deploy
|
||||
```
|
||||
|
||||
Start the Next.js server
|
||||
|
||||
```
|
||||
# For development
|
||||
yarn dev
|
||||
# For production
|
||||
yarn build
|
||||
yarn start
|
||||
```
|
||||
|
||||
## Contributors
|
||||
|
||||
If you would like to contribute to the development of the project please reach out first before spending significant time on it.
|
||||
|
||||
## License
|
||||
|
||||
Rallly is open-source under the GNU Affero General Public License Version 3 (AGPLv3) or any later version. See [LICENSE](LICENSE) for more detail.
|
||||
|
||||
## Credits
|
||||
|
||||
This project would not exist without the help of other great open-source projects. Thanks to the developers and teams at:
|
||||
|
||||
- [Next.js](https://github.com/vercel/next.js)
|
||||
- [Prisma](https://github.com/prisma/prisma)
|
||||
- [TailwindCSS](https://github.com/tailwindlabs/tailwindcss)
|
23
api-client/add-participant.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Participant, Vote } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export interface AddParticipantPayload {
|
||||
pollId: string;
|
||||
name: string;
|
||||
votes: string[];
|
||||
}
|
||||
|
||||
export type AddParticipantResponse = Participant & {
|
||||
votes: Vote[];
|
||||
};
|
||||
|
||||
export const addParticipant = async (
|
||||
payload: AddParticipantPayload,
|
||||
): Promise<AddParticipantResponse> => {
|
||||
const res = await axios.post<AddParticipantResponse>(
|
||||
`/api/poll/${payload.pollId}/participant`,
|
||||
payload,
|
||||
);
|
||||
|
||||
return res.data;
|
||||
};
|
18
api-client/create-comment.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { Comment } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export interface CreateCommentPayload {
|
||||
pollId: string;
|
||||
content: string;
|
||||
authorName: string;
|
||||
}
|
||||
|
||||
export const createComment = async (
|
||||
payload: CreateCommentPayload,
|
||||
): Promise<Comment> => {
|
||||
const { data } = await axios.post<Comment>(
|
||||
`/api/poll/${payload.pollId}/comments`,
|
||||
payload,
|
||||
);
|
||||
return data;
|
||||
};
|
7
api-client/create-demo.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { Poll } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export const createDemo = async (): Promise<Poll> => {
|
||||
const { data } = await axios.post<Poll>("/api/poll/create-demo");
|
||||
return data;
|
||||
};
|
21
api-client/create-poll.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { Poll } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export interface CreatePollPayload {
|
||||
title: string;
|
||||
type: "date";
|
||||
timeZone?: string;
|
||||
location?: string;
|
||||
description?: string;
|
||||
user: {
|
||||
name: string;
|
||||
email: string;
|
||||
};
|
||||
options: string[];
|
||||
demo?: boolean;
|
||||
}
|
||||
|
||||
export const createPoll = async (payload: CreatePollPayload): Promise<Poll> => {
|
||||
const { data } = await axios.post<Poll>("/api/poll", payload);
|
||||
return data;
|
||||
};
|
17
api-client/delete-participant.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import axios from "axios";
|
||||
|
||||
export interface DeleteParticipantPayload {
|
||||
pollId: string;
|
||||
participantId: string;
|
||||
}
|
||||
|
||||
export const deleteParticipant = async (
|
||||
payload: DeleteParticipantPayload,
|
||||
): Promise<void> => {
|
||||
try {
|
||||
const { pollId, participantId } = payload;
|
||||
await axios.delete(`/api/poll/${pollId}/participant/${participantId}`);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
14
api-client/get-poll.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { Link, Option, Participant, Poll, User, Vote } from "@prisma/client";
|
||||
|
||||
export interface GetPollApiResponse extends Omit<Poll, "verificationCode"> {
|
||||
options: Array<Option & { votes: Vote[] }>;
|
||||
participants: Array<Participant & { votes: Vote[] }>;
|
||||
user: User;
|
||||
role: "admin" | "participant";
|
||||
links: Array<Link>;
|
||||
pollId: string;
|
||||
}
|
||||
|
||||
export interface GetPollResponse extends Omit<GetPollApiResponse, "createdAt"> {
|
||||
createdAt: string;
|
||||
}
|
15
api-client/update-participant.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import axios from "axios";
|
||||
|
||||
export interface UpdateParticipantPayload {
|
||||
pollId: string;
|
||||
participantId: string;
|
||||
name: string;
|
||||
votes: string[];
|
||||
}
|
||||
|
||||
export const updateParticipant = async (
|
||||
payload: UpdateParticipantPayload,
|
||||
): Promise<void> => {
|
||||
const { pollId, participantId, ...body } = payload;
|
||||
await axios.patch(`/api/poll/${pollId}/participant/${participantId}`, body);
|
||||
};
|
25
api-client/update-poll.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { Poll } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
|
||||
export interface UpdatePollPayload {
|
||||
title?: string;
|
||||
timeZone?: string;
|
||||
location?: string;
|
||||
description?: string;
|
||||
optionsToDelete?: string[];
|
||||
optionsToAdd?: string[];
|
||||
notifications?: boolean;
|
||||
closed?: boolean;
|
||||
}
|
||||
|
||||
export const updatePoll = async (
|
||||
urlId: string,
|
||||
payload: UpdatePollPayload,
|
||||
): Promise<Poll> => {
|
||||
try {
|
||||
const { data } = await axios.patch<Poll>(`/api/poll/${urlId}`, payload);
|
||||
return data;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
71
components/button/button.tsx
Normal file
|
@ -0,0 +1,71 @@
|
|||
import clsx from "clsx";
|
||||
import * as React from "react";
|
||||
|
||||
import SpinnerIcon from "../icons/spinner.svg";
|
||||
|
||||
export interface ButtonProps {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
icon?: React.ReactElement;
|
||||
htmlType?: React.ButtonHTMLAttributes<HTMLButtonElement>["type"];
|
||||
type?: "default" | "primary" | "danger" | "link";
|
||||
form?: string;
|
||||
href?: string;
|
||||
rounded?: boolean;
|
||||
title?: string;
|
||||
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
||||
}
|
||||
|
||||
const Button: React.ForwardRefRenderFunction<HTMLButtonElement, ButtonProps> = (
|
||||
{
|
||||
children,
|
||||
loading,
|
||||
type = "default",
|
||||
htmlType = "button",
|
||||
className,
|
||||
icon,
|
||||
disabled,
|
||||
href,
|
||||
rounded,
|
||||
...passThroughProps
|
||||
},
|
||||
ref,
|
||||
) => {
|
||||
return (
|
||||
<button
|
||||
ref={ref}
|
||||
type={htmlType}
|
||||
className={clsx(
|
||||
{
|
||||
"btn-default": type === "default",
|
||||
"btn-primary": type === "primary",
|
||||
"btn-danger": type === "danger",
|
||||
"btn-link": type === "link",
|
||||
"btn-disabled": disabled,
|
||||
"rounded-full p-2 h-auto": rounded,
|
||||
"w-10 p-0": !children,
|
||||
},
|
||||
className,
|
||||
)}
|
||||
{...passThroughProps}
|
||||
disabled={disabled || loading}
|
||||
>
|
||||
{loading ? (
|
||||
<SpinnerIcon
|
||||
className={clsx("w-5 animate-spin inline-block", {
|
||||
"mr-2": !!children,
|
||||
})}
|
||||
/>
|
||||
) : icon ? (
|
||||
React.cloneElement(icon, {
|
||||
className: clsx("w-5 h-5", { "-ml-1 mr-2": !!children }),
|
||||
})
|
||||
) : null}
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.forwardRef(Button);
|
2
components/button/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export type { ButtonProps } from "./button";
|
||||
export { default } from "./button";
|
28
components/compact-button.tsx
Normal file
|
@ -0,0 +1,28 @@
|
|||
import * as React from "react";
|
||||
|
||||
export interface CompactButtonProps {
|
||||
icon?: React.ComponentType<{
|
||||
className?: string;
|
||||
style?: React.CSSProperties;
|
||||
}>;
|
||||
children?: React.ReactNode;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
const CompactButton: React.VoidFunctionComponent<CompactButtonProps> = ({
|
||||
icon: Icon,
|
||||
children,
|
||||
onClick,
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="h-5 w-5 rounded-full hover:bg-gray-200 transition-colors active:text-gray-500 active:bg-gray-300 text-gray-400 bg-gray-100 inline-flex items-center justify-center"
|
||||
onClick={onClick}
|
||||
>
|
||||
{Icon ? <Icon className="w-3 h-3" /> : children}
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export default CompactButton;
|
49
components/cookie-consent.tsx
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
import Cookies from "js-cookie";
|
||||
import Link from "next/link";
|
||||
import * as React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { getPortal } from "utils/selectors";
|
||||
import CookiesIllustration from "./cookie-consent/cookies.svg";
|
||||
|
||||
const CookieConsentPopover: React.VoidFunctionComponent = () => {
|
||||
const [visible, setVisible] = React.useState(true);
|
||||
|
||||
return ReactDOM.createPortal(
|
||||
<Transition
|
||||
show={visible}
|
||||
appear={true}
|
||||
as="div"
|
||||
enter="transition transform delay-1000 duration-1000"
|
||||
enterFrom="opacity-0 translate-y-8"
|
||||
enterTo="opacity-100 translate-y-0"
|
||||
leave="duration-200"
|
||||
leaveFrom="opacity-100 translate-y-0"
|
||||
leaveTo="opacity-0 translate-y-8"
|
||||
className="bg-white z-50 p-4 pt-8 shadow-lg fixed rounded-lg w-60 text-sm bottom-8 right-8"
|
||||
>
|
||||
<CookiesIllustration className="absolute -top-6" />
|
||||
<div className="mb-3">
|
||||
Your privacy is important to us. We only use cookies to improve the
|
||||
browsing experience on this website.
|
||||
</div>
|
||||
<div className="flex space-x-6 items-center">
|
||||
<Link href="/privacy-policy">
|
||||
<a className="text-slate-400 hover:text-indigo-500">Privacy Policy</a>
|
||||
</Link>
|
||||
<button
|
||||
onClick={() => {
|
||||
Cookies.set("rallly_cookie_consent", "1", { expires: 365 });
|
||||
setVisible(false);
|
||||
}}
|
||||
className="grow text-white focus:ring-2 focus:ring-indigo-200 transition-all bg-indigo-500 hover:bg-indigo-500/90 active:bg-indigo-600/90 px-5 py-1 font-semibold shadow-sm rounded-md"
|
||||
>
|
||||
OK
|
||||
</button>
|
||||
</div>
|
||||
</Transition>,
|
||||
getPortal(),
|
||||
);
|
||||
};
|
||||
|
||||
export default CookieConsentPopover;
|
11
components/cookie-consent/cookies.svg
Normal file
|
@ -0,0 +1,11 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="71" height="44" fill="none" viewBox="0 0 71 44">
|
||||
<path fill="#BF8870" stroke="#644647" stroke-width="2" d="M42.5 21.5c0 5.722-1.803 10.584-5.22 14.134-3.414 3.546-8.526 5.874-15.316 6.366-6.742-.008-11.96-2.324-15.494-5.991C2.934 32.34 1.013 27.247 1 21.557 2.47 9.01 10.733 1 22 1c6.778 0 11.872 2.172 15.275 5.752C40.686 10.339 42.5 15.447 42.5 21.5z"/>
|
||||
<path fill="#fff" fill-opacity=".2" d="M3.893 28.215c.175.632 1.06.43 1.06-.226 0-12.719 9.84-23.03 21.976-23.03.748 0 1.026-.99.309-1.203A18.135 18.135 0 0022.046 3C11.527 3 3 11.994 3 23.09c0 1.463.408 3.373.893 5.125z"/>
|
||||
<path fill="#F0E0D2" stroke="#634647" stroke-width="2" d="M24.434 11c1.045 0 1.81-.82 1.92-1.765.115-.296.186-.637.122-.99a1.41 1.41 0 00-.724-.996 2.08 2.08 0 00-.784-.228C24.767 7 24.57 7 24.448 7h-.014c-1.131 0-1.934.96-1.934 2s.803 2 1.934 2zM10.5 25a3 3 0 002.99-2.755c.234-.525.358-1.066.257-1.59-.127-.656-.558-1.067-1.001-1.295-.41-.21-.866-.288-1.229-.324-.367-.036-.733-.036-1-.036H10.5a3 3 0 100 6zM22.963 36.678a3 3 0 004.018.624c.556-.144 1.056-.383 1.404-.79.434-.507.487-1.1.39-1.588-.091-.452-.314-.858-.512-1.164-.2-.309-.429-.596-.595-.805l-.01-.013a3 3 0 10-4.695 3.736z"/>
|
||||
<path fill="#845556" stroke="#634647" stroke-width="2" d="M37.044 19.802a3 3 0 00-.6-4.022c-.303-.488-.68-.894-1.172-1.105-.614-.264-1.195-.138-1.633.1-.404.222-.725.556-.958.835-.236.284-.442.587-.592.809l-.01.013a3 3 0 104.965 3.37z"/>
|
||||
<path stroke="#634647" stroke-linecap="round" stroke-width="2" d="M30.5 27.754l2.793 2.793M23.5 21.5c1-1.5 1-1.5 3.126-2.414M11.5 10.978s2.5 0 3.622 1.576M14.5 33.304s0-1.804 1.537-3.639"/>
|
||||
<path fill="#EAAC89" stroke="#634647" stroke-linejoin="round" stroke-width="2" d="M36.503 5.02c3.24-2.622 7.309-3.92 11.865-3.873a.379.379 0 01.077.104.98.98 0 01.105.577 4.5 4.5 0 002.429 4.693 4.517 4.517 0 001.272 1.542c.207.16.34.493.3.753A4.5 4.5 0 0057 14c.648 0 1.429.312 1.897.758a4.488 4.488 0 003.788 1.19c.26-.04.593.094.753.3a4.494 4.494 0 005.133 1.47c.197-.073.505-.086.756-.01a.522.522 0 01.187.087c.407 2.624.39 5.542-.116 8.734-1.543 6.564-4.985 11.117-9.36 13.724-4.378 2.609-9.775 3.32-15.318 2.038-11.884-4.288-17.803-14.156-15.238-25.128 1.285-5.5 3.774-9.514 7.022-12.142zm11.85-3.882s.004 0 .011.006c-.007-.003-.01-.005-.01-.006zm21.173 16.674s-.004-.003-.008-.012c.007.007.01.012.008.012z"/>
|
||||
<path fill="#fff" fill-opacity=".2" d="M30.893 27.215c.175.632 1.06.43 1.06-.226C31.953 14.27 35.363 4.5 47.5 4.5c.143 0 .217-.087.247-.22.165-.731.002-1.78-.747-1.78-10.519 0-17 8.494-17 19.59 0 1.463.408 3.373.893 5.125z"/>
|
||||
<path fill="#845556" stroke="#634647" stroke-width="2" d="M41.634 15.72c.238-1.017-.387-1.949-1.282-2.271-.262-.179-.577-.325-.937-.344a1.41 1.41 0 00-1.134.48 2.081 2.081 0 00-.4.71c-.066.191-.111.383-.14.502l-.002.013c-.258 1.102.495 2.102 1.507 2.339 1.012.236 2.13-.327 2.388-1.428zM51.824 33.36a3 3 0 00-2.002-3.539c-.458-.347-.957-.59-1.491-.611-.667-.026-1.165.3-1.488.68-.298.35-.478.777-.595 1.122-.119.35-.202.706-.263.967l-.004.016a3 3 0 105.843 1.365z"/>
|
||||
<path stroke="#634647" stroke-linecap="round" stroke-width="2" d="M49.784 20.368l-1.02-2.238M36.807 29.659s.569-2.435 2.36-3.168M60.877 28.325s-1.757-.41-3.193-2.325"/>
|
||||
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
57
components/crisp-chat.tsx
Normal file
|
@ -0,0 +1,57 @@
|
|||
import * as React from "react";
|
||||
import Button from "./button";
|
||||
import Chat from "@/components/icons/chat.svg";
|
||||
|
||||
const crispWebsiteId = process.env.NEXT_PUBLIC_CRISP_WEBSITE_ID;
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
$crisp?: Array<unknown>;
|
||||
CRISP_WEBSITE_ID?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export const showCrispChat = () => {
|
||||
window.$crisp?.push(["do", "chat:show"]);
|
||||
window.$crisp?.push(["do", "chat:open"]);
|
||||
};
|
||||
|
||||
export const ChatButton: React.VoidFunctionComponent<{ text?: string }> = ({
|
||||
text,
|
||||
}) => {
|
||||
return (
|
||||
<Button icon={<Chat />} onClick={showCrispChat}>
|
||||
{text}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
const CrispChat: React.VoidFunctionComponent = () => {
|
||||
React.useEffect(() => {
|
||||
if (!crispWebsiteId) {
|
||||
return;
|
||||
}
|
||||
window.$crisp = [];
|
||||
window.CRISP_WEBSITE_ID = crispWebsiteId;
|
||||
(() => {
|
||||
const d = document;
|
||||
const s = d.createElement("script");
|
||||
s.src = "https://client.crisp.chat/l.js";
|
||||
s.async = true;
|
||||
d.getElementsByTagName("body")[0].appendChild(s);
|
||||
window.$crisp.push(["safe", true]); // disable warning about other event listeners
|
||||
window.$crisp.push(["do", "chat:hide"]);
|
||||
window.$crisp.push([
|
||||
"on",
|
||||
"chat:closed",
|
||||
() => {
|
||||
window.$crisp?.push(["do", "chat:hide"]);
|
||||
},
|
||||
]);
|
||||
})();
|
||||
});
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export default CrispChat;
|
42
components/date-card.tsx
Normal file
|
@ -0,0 +1,42 @@
|
|||
import clsx from "clsx";
|
||||
import * as React from "react";
|
||||
|
||||
export interface DateCardProps {
|
||||
annotation?: React.ReactNode;
|
||||
day: string;
|
||||
month: string;
|
||||
dow: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const DateCard: React.VoidFunctionComponent<DateCardProps> = ({
|
||||
annotation,
|
||||
className,
|
||||
day,
|
||||
dow,
|
||||
month,
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
"inline-block bg-white text-center border h-14 w-14 rounded-md relative shadow-md shadow-slate-100",
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{annotation ? (
|
||||
<div className="absolute -top-3 -right-3">{annotation}</div>
|
||||
) : null}
|
||||
<div className="text-xs -mt-2 mb-[-1px] text-slate-400 relative">
|
||||
<span className="relative inline-block after:content-[''] after:inline-block after:absolute after:left-0 px-1 after:top-[7px] after:border-white after:-z-10 z-10 after:border-t after:w-full">
|
||||
{dow}
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-red-500 text-lg -mb-1 text-center">{day}</div>
|
||||
<div className="text-gray-800 text-center text-xs uppercase font-semibold">
|
||||
{month}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DateCard;
|
233
components/discussion/discussion.tsx
Normal file
|
@ -0,0 +1,233 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
import { Comment } from "@prisma/client";
|
||||
import axios from "axios";
|
||||
import { formatRelative } from "date-fns";
|
||||
import { usePlausible } from "next-plausible";
|
||||
import * as React from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||
import { useList } from "react-use";
|
||||
import {
|
||||
createComment,
|
||||
CreateCommentPayload,
|
||||
} from "../../api-client/create-comment";
|
||||
import { requiredString } from "../../utils/form-validation";
|
||||
import Button from "../button";
|
||||
import CompactButton from "../compact-button";
|
||||
import Dropdown, { DropdownItem } from "../dropdown";
|
||||
import DotsHorizontal from "../icons/dots-horizontal.svg";
|
||||
import Trash from "../icons/trash.svg";
|
||||
import NameInput from "../name-input";
|
||||
import UserAvater from "../poll/user-avatar";
|
||||
import { useUserName } from "../user-name-context";
|
||||
|
||||
export interface DiscussionProps {
|
||||
pollId: string;
|
||||
canDelete?: boolean;
|
||||
}
|
||||
|
||||
interface CommentForm {
|
||||
authorName: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
const Comments: React.VoidFunctionComponent<{
|
||||
comments: {
|
||||
id: string;
|
||||
authorName: string;
|
||||
content: string;
|
||||
createdAt: string;
|
||||
}[];
|
||||
deletedComments: string[];
|
||||
onDelete: (commentId: string) => void;
|
||||
canDelete?: boolean;
|
||||
}> = ({ comments, deletedComments, onDelete, canDelete }) => {
|
||||
return (
|
||||
<div className="bg-slate-50 p-4 space-y-3 border-b">
|
||||
{comments.map((comment, i) => {
|
||||
return (
|
||||
<div className="flex" key={i}>
|
||||
<Transition
|
||||
show={!deletedComments.includes(comment.id)}
|
||||
as="div"
|
||||
enter="transition transform duration-300"
|
||||
enterFrom="opacity-0 translate-y-4"
|
||||
enterTo="opacity-100 translate-y-0"
|
||||
leave="transition transform duration-100"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
className="bg-white border rounded-xl px-3 py-2 shadow-sm w-fit"
|
||||
>
|
||||
<div className="flex space-x-2 items-center">
|
||||
<UserAvater name={comment.authorName} />
|
||||
<div className="mb-1">
|
||||
<span className="mr-1">{comment.authorName}</span>
|
||||
<span className="mr-1 text-slate-400">•</span>
|
||||
<span className="text-sm text-slate-500">
|
||||
{formatRelative(new Date(comment.createdAt), Date.now())}
|
||||
</span>
|
||||
</div>
|
||||
{canDelete ? (
|
||||
<Dropdown
|
||||
placement="bottom-start"
|
||||
trigger={<CompactButton icon={DotsHorizontal} />}
|
||||
>
|
||||
<DropdownItem
|
||||
icon={Trash}
|
||||
label="Delete comment"
|
||||
onClick={() => {
|
||||
onDelete(comment.id);
|
||||
}}
|
||||
/>
|
||||
</Dropdown>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="w-fit whitespace-pre-wrap">{comment.content}</div>
|
||||
</Transition>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const Discussion: React.VoidFunctionComponent<DiscussionProps> = ({
|
||||
pollId,
|
||||
canDelete,
|
||||
}) => {
|
||||
const getCommentsQueryKey = ["poll", pollId, "comments"];
|
||||
const [userName, setUserName] = useUserName();
|
||||
const [deletedComments, { push }] = useList<string>([]);
|
||||
const queryClient = useQueryClient();
|
||||
const { data: comments } = useQuery(
|
||||
getCommentsQueryKey,
|
||||
async () => {
|
||||
const res = await axios.get<{
|
||||
comments: Array<Omit<Comment, "createdAt"> & { createdAt: string }>;
|
||||
}>(`/api/poll/${pollId}/comments`);
|
||||
return res.data.comments;
|
||||
},
|
||||
{
|
||||
refetchInterval: 10000, // refetch every 10 seconds
|
||||
},
|
||||
);
|
||||
|
||||
const plausible = usePlausible();
|
||||
|
||||
const { mutate: createCommentMutation } = useMutation(
|
||||
(payload: CreateCommentPayload) => {
|
||||
// post comment
|
||||
return createComment(payload);
|
||||
},
|
||||
{
|
||||
onSuccess: (newComment) => {
|
||||
queryClient.setQueryData(getCommentsQueryKey, (comments) => {
|
||||
if (Array.isArray(comments)) {
|
||||
return [...comments, newComment];
|
||||
}
|
||||
return [newComment];
|
||||
});
|
||||
plausible("Created comment");
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const { mutate: deleteCommentMutation } = useMutation(
|
||||
async (payload: { pollId: string; commentId: string }) => {
|
||||
await axios.delete(`/api/poll/${pollId}/comments/${payload.commentId}`);
|
||||
},
|
||||
{
|
||||
onMutate: ({ commentId }) => {
|
||||
push(commentId);
|
||||
plausible("Deleted comment");
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(getCommentsQueryKey);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const { register, setValue, control, handleSubmit, formState } =
|
||||
useForm<CommentForm>({
|
||||
defaultValues: {
|
||||
authorName: userName,
|
||||
content: "",
|
||||
},
|
||||
});
|
||||
|
||||
React.useEffect(() => {
|
||||
setValue("authorName", userName);
|
||||
}, [setValue, userName]);
|
||||
|
||||
const handleDelete = React.useCallback(
|
||||
(commentId: string) => {
|
||||
deleteCommentMutation({ pollId, commentId });
|
||||
},
|
||||
[deleteCommentMutation, pollId],
|
||||
);
|
||||
|
||||
if (!comments) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="border-t border-b md:border md:rounded-lg overflow-hidden shadow-sm">
|
||||
<div className="px-4 py-2 bg-white border-b">
|
||||
<div className="font-medium">Comments</div>
|
||||
</div>
|
||||
{comments.length ? (
|
||||
<Comments
|
||||
comments={comments}
|
||||
canDelete={canDelete}
|
||||
onDelete={handleDelete}
|
||||
deletedComments={deletedComments}
|
||||
/>
|
||||
) : null}
|
||||
<form
|
||||
className="bg-white p-4"
|
||||
onSubmit={handleSubmit((data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
createCommentMutation(
|
||||
{
|
||||
...data,
|
||||
pollId,
|
||||
},
|
||||
{
|
||||
onSuccess: () => {
|
||||
setUserName(data.authorName);
|
||||
setValue("content", "");
|
||||
resolve(data);
|
||||
},
|
||||
onError: reject,
|
||||
},
|
||||
);
|
||||
});
|
||||
})}
|
||||
>
|
||||
<textarea
|
||||
id="comment"
|
||||
placeholder="Add your comment…"
|
||||
className="input pl-3 pr-4 py-2 w-full"
|
||||
{...register("content", { validate: requiredString })}
|
||||
/>
|
||||
<div className="flex mt-1 space-x-3">
|
||||
<Controller
|
||||
name="authorName"
|
||||
control={control}
|
||||
rules={{ validate: requiredString }}
|
||||
render={({ field }) => <NameInput className="w-full" {...field} />}
|
||||
/>
|
||||
<Button
|
||||
htmlType="submit"
|
||||
loading={formState.isSubmitting}
|
||||
type="primary"
|
||||
>
|
||||
Send
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(Discussion);
|
1
components/discussion/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from "./discussion";
|
99
components/dropdown.tsx
Normal file
|
@ -0,0 +1,99 @@
|
|||
import { Menu } from "@headlessui/react";
|
||||
import { Placement } from "@popperjs/core";
|
||||
import clsx from "clsx";
|
||||
import * as React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { usePopper } from "react-popper";
|
||||
export interface DropdownProps {
|
||||
trigger?: React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
placement?: Placement;
|
||||
}
|
||||
|
||||
const Dropdown: React.VoidFunctionComponent<DropdownProps> = ({
|
||||
children,
|
||||
className,
|
||||
trigger,
|
||||
placement,
|
||||
}) => {
|
||||
const [referenceElement, setReferenceElement] =
|
||||
React.useState<HTMLDivElement | null>(null);
|
||||
const [popperElement, setPopperElement] =
|
||||
React.useState<HTMLDivElement | null>(null);
|
||||
|
||||
const { styles, attributes } = usePopper(referenceElement, popperElement, {
|
||||
placement,
|
||||
modifiers: [
|
||||
{
|
||||
name: "offset",
|
||||
options: {
|
||||
offset: [0, 5],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const portal = document.getElementById("portal");
|
||||
return (
|
||||
<Menu>
|
||||
<Menu.Button
|
||||
ref={setReferenceElement}
|
||||
as="div"
|
||||
className={clsx("inline-block", className)}
|
||||
>
|
||||
{trigger}
|
||||
</Menu.Button>
|
||||
{portal &&
|
||||
ReactDOM.createPortal(
|
||||
<Menu.Items
|
||||
as="div"
|
||||
ref={setPopperElement}
|
||||
style={styles.popper}
|
||||
{...attributes.popper}
|
||||
className="z-30 p-1 bg-white divide-gray-100 rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"
|
||||
>
|
||||
{children}
|
||||
</Menu.Items>,
|
||||
portal,
|
||||
)}
|
||||
</Menu>
|
||||
);
|
||||
};
|
||||
|
||||
export const DropdownItem: React.VoidFunctionComponent<{
|
||||
icon?: React.ComponentType<{ className?: string }>;
|
||||
label?: React.ReactNode;
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
}> = ({ icon: Icon, label, onClick, disabled }) => {
|
||||
return (
|
||||
<Menu.Item disabled={disabled}>
|
||||
{({ active }) => (
|
||||
<button
|
||||
onClick={onClick}
|
||||
className={clsx(
|
||||
"group flex rounded items-center w-full py-2 pl-2 pr-4",
|
||||
{
|
||||
"bg-indigo-500 text-white": active,
|
||||
"text-gray-700": !active,
|
||||
"opacity-50": disabled,
|
||||
},
|
||||
)}
|
||||
>
|
||||
{Icon && (
|
||||
<Icon
|
||||
className={clsx("w-5 h-5 mr-2", {
|
||||
"text-white": active,
|
||||
"text-indigo-500": !disabled,
|
||||
})}
|
||||
/>
|
||||
)}
|
||||
{label}
|
||||
</button>
|
||||
)}
|
||||
</Menu.Item>
|
||||
);
|
||||
};
|
||||
|
||||
export default Dropdown;
|
50
components/error-page.tsx
Normal file
|
@ -0,0 +1,50 @@
|
|||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import * as React from "react";
|
||||
import StandardLayout from "./standard-layout";
|
||||
import Button from "@/components/button";
|
||||
import Chat from "@/components/icons/chat.svg";
|
||||
import EmojiSad from "@/components/icons/emoji-sad.svg";
|
||||
import { showCrispChat } from "./crisp-chat";
|
||||
|
||||
export interface ComponentProps {
|
||||
icon?: React.ComponentType<{ className?: string }>;
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
const ErrorPage: React.VoidFunctionComponent<ComponentProps> = ({
|
||||
icon: Icon = EmojiSad,
|
||||
title,
|
||||
description,
|
||||
}) => {
|
||||
return (
|
||||
<StandardLayout>
|
||||
<div className="h-full bg-gray-50 px-4 py-8 flex items-center justify-center lg:w-[1024px] max-w-full">
|
||||
<Head>
|
||||
<title>{title}</title>
|
||||
<meta name="robots" content="noindex,nofollow" />
|
||||
</Head>
|
||||
<div className="flex items-start">
|
||||
<div className="text-center">
|
||||
<Icon className="w-24 inline-block mb-4 text-slate-400" />
|
||||
<div className="text-3xl font-bold uppercase text-indigo-500 ">
|
||||
{title}
|
||||
</div>
|
||||
<p>{description}</p>
|
||||
<div className="flex space-x-3 justify-center">
|
||||
<Link href="/" passHref={true}>
|
||||
<a className="btn-default">Go to home</a>
|
||||
</Link>
|
||||
<Button icon={<Chat />} onClick={showCrispChat}>
|
||||
Start chat
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</StandardLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default ErrorPage;
|
7
components/forms/index.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export type { PollDetailsData } from "./poll-details-form";
|
||||
export { PollDetailsForm } from "./poll-details-form";
|
||||
export type { PollOptionsData } from "./poll-options-form/poll-options-form";
|
||||
export { default as PollOptionsForm } from "./poll-options-form/poll-options-form";
|
||||
export * from "./types";
|
||||
export type { UserDetailsData } from "./user-details-form";
|
||||
export { UserDetailsForm } from "./user-details-form";
|
76
components/forms/poll-details-form.tsx
Normal file
|
@ -0,0 +1,76 @@
|
|||
import clsx from "clsx";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import * as React from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import { requiredString } from "../../utils/form-validation";
|
||||
import { PollFormProps } from "./types";
|
||||
|
||||
export interface PollDetailsData {
|
||||
title: string;
|
||||
location: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export const PollDetailsForm: React.VoidFunctionComponent<
|
||||
PollFormProps<PollDetailsData>
|
||||
> = ({ name, defaultValues, onSubmit, onChange, className }) => {
|
||||
const { t } = useTranslation("app");
|
||||
const {
|
||||
handleSubmit,
|
||||
register,
|
||||
watch,
|
||||
formState: { errors },
|
||||
} = useForm<PollDetailsData>({ defaultValues });
|
||||
|
||||
React.useEffect(() => {
|
||||
if (onChange) {
|
||||
const subscription = watch(onChange);
|
||||
return () => {
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
}
|
||||
}, [onChange, watch]);
|
||||
|
||||
return (
|
||||
<form
|
||||
id={name}
|
||||
className={clsx("max-w-full", className)}
|
||||
style={{ width: 500 }}
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
>
|
||||
<div className="formField">
|
||||
<label htmlFor="title">{t("title")}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="title"
|
||||
className={clsx("input w-full", {
|
||||
"input-error": errors.title,
|
||||
})}
|
||||
placeholder={t("titlePlaceholder")}
|
||||
{...register("title", { validate: requiredString })}
|
||||
/>
|
||||
</div>
|
||||
<div className="formField">
|
||||
<label htmlFor="location">{t("location")}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="location"
|
||||
className="input w-full"
|
||||
placeholder={t("locationPlaceholder")}
|
||||
{...register("location")}
|
||||
/>
|
||||
</div>
|
||||
<div className="formField">
|
||||
<label htmlFor="description">{t("description")}</label>
|
||||
<textarea
|
||||
id="description"
|
||||
className="input w-full"
|
||||
placeholder={t("descriptionPlaceholder")}
|
||||
rows={5}
|
||||
{...register("description")}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
};
|
|
@ -0,0 +1,39 @@
|
|||
import * as React from "react";
|
||||
|
||||
import ChevronLeft from "../../icons/chevron-left.svg";
|
||||
import ChevronRight from "../../icons/chevron-right.svg";
|
||||
|
||||
export interface DateNavigationToolbarProps {
|
||||
year: number;
|
||||
label: string;
|
||||
onPrevious: () => void;
|
||||
onNext: () => void;
|
||||
onToday: () => void;
|
||||
}
|
||||
|
||||
const DateNavigationToolbar: React.VoidFunctionComponent<DateNavigationToolbarProps> =
|
||||
({ year, label, onPrevious, onToday, onNext }) => {
|
||||
return (
|
||||
<div className="flex border-b items-center w-full px-4 h-14 shrink-0">
|
||||
<div className="grow">
|
||||
<span className="text-sm font-bold text-gray-400 mr-2">{year}</span>
|
||||
<span className="text-lg font-bold text-gray-700">{label}</span>
|
||||
</div>
|
||||
<div className="flex space-x-2 items-center">
|
||||
<div className="segment-button">
|
||||
<button type="button" onClick={onPrevious}>
|
||||
<ChevronLeft className="h-5" />
|
||||
</button>
|
||||
<button type="button" onClick={onToday}>
|
||||
Today
|
||||
</button>
|
||||
<button type="button" onClick={onNext}>
|
||||
<ChevronRight className="h-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DateNavigationToolbar;
|
2
components/forms/poll-options-form/index.ts
Normal file
|
@ -0,0 +1,2 @@
|
|||
export { default } from "./poll-options-form";
|
||||
export * from "./types";
|
|
@ -0,0 +1 @@
|
|||
export { default } from "./month-calendar";
|
|
@ -0,0 +1,426 @@
|
|||
import clsx from "clsx";
|
||||
import differenceInMinutes from "date-fns/differenceInMinutes";
|
||||
import { addMinutes, setHours } from "date-fns/esm";
|
||||
import isSameDay from "date-fns/isSameDay";
|
||||
import { usePlausible } from "next-plausible";
|
||||
import * as React from "react";
|
||||
import { DateTimeOption } from "..";
|
||||
import {
|
||||
expectTimeOption,
|
||||
getDateProps,
|
||||
removeAllOptionsForDay,
|
||||
} from "../../../../utils/date-time-utils";
|
||||
import Button from "../../../button";
|
||||
import CompactButton from "../../../compact-button";
|
||||
import DateCard from "../../../date-card";
|
||||
import Dropdown, { DropdownItem } from "../../../dropdown";
|
||||
import { useHeadlessDatePicker } from "../../../headless-date-picker";
|
||||
import Calendar from "../../../icons/calendar.svg";
|
||||
import ChevronLeft from "../../../icons/chevron-left.svg";
|
||||
import ChevronRight from "../../../icons/chevron-right.svg";
|
||||
import DotsHorizontal from "../../../icons/dots-horizontal.svg";
|
||||
import Magic from "../../../icons/magic.svg";
|
||||
import PlusSm from "../../../icons/plus-sm.svg";
|
||||
import Trash from "../../../icons/trash.svg";
|
||||
import X from "../../../icons/x.svg";
|
||||
import Switch from "../../../switch";
|
||||
import { DateTimePickerProps } from "../types";
|
||||
import { formatDateWithoutTime, formatDateWithoutTz } from "../utils";
|
||||
import TimePicker from "./time-picker";
|
||||
|
||||
const MonthCalendar: React.VoidFunctionComponent<DateTimePickerProps> = ({
|
||||
options,
|
||||
onNavigate,
|
||||
date,
|
||||
onChange,
|
||||
duration,
|
||||
onChangeDuration,
|
||||
}) => {
|
||||
const isTimedEvent = options.some((option) => option.type === "timeSlot");
|
||||
|
||||
const plausible = usePlausible();
|
||||
|
||||
const optionsByDay = React.useMemo(() => {
|
||||
const res: Record<
|
||||
string,
|
||||
[
|
||||
{
|
||||
option: DateTimeOption;
|
||||
index: number;
|
||||
},
|
||||
]
|
||||
> = {};
|
||||
|
||||
options.forEach((option, index) => {
|
||||
const dateString =
|
||||
option.type === "date"
|
||||
? option.date
|
||||
: option.start.substring(0, option.start.indexOf("T"));
|
||||
|
||||
if (res[dateString]) {
|
||||
res[dateString].push({ option, index });
|
||||
} else {
|
||||
res[dateString] = [{ option, index }];
|
||||
}
|
||||
});
|
||||
|
||||
return res;
|
||||
}, [options]);
|
||||
|
||||
const datepickerSelection = React.useMemo(() => {
|
||||
return Object.keys(optionsByDay).map(
|
||||
(dateString) => new Date(dateString + "T12:00:00"),
|
||||
);
|
||||
}, [optionsByDay]);
|
||||
|
||||
const datepicker = useHeadlessDatePicker({
|
||||
selection: datepickerSelection,
|
||||
onNavigationChange: onNavigate,
|
||||
date,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="lg:flex overflow-hidden">
|
||||
<div className="p-4 border-b lg:border-r lg:border-b-0 shrink-0">
|
||||
<div>
|
||||
<div className="w-full flex flex-col">
|
||||
<div className="flex space-x-4 items-center justify-center mb-3">
|
||||
<Button
|
||||
icon={<ChevronLeft />}
|
||||
title="Previous month"
|
||||
onClick={datepicker.prev}
|
||||
/>
|
||||
<div className="grow text-center font-medium text-lg">
|
||||
{datepicker.label}
|
||||
</div>
|
||||
<Button
|
||||
title="Next month"
|
||||
icon={<ChevronRight />}
|
||||
onClick={datepicker.next}
|
||||
/>
|
||||
</div>
|
||||
<div className="grid grid-cols-7">
|
||||
{datepicker.daysOfWeek.map((dayOfWeek) => {
|
||||
return (
|
||||
<div
|
||||
key={dayOfWeek}
|
||||
className="flex items-center justify-center pb-2 text-slate-400 text-sm font-medium"
|
||||
>
|
||||
{dayOfWeek.substring(0, 2)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<div className="grid grid-cols-7 grow border shadow-sm rounded-lg overflow-hidden bg-white">
|
||||
{datepicker.days.map((day, i) => {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
key={i}
|
||||
onClick={() => {
|
||||
if (
|
||||
datepicker.selection.some((selectedDate) =>
|
||||
isSameDay(selectedDate, day.date),
|
||||
)
|
||||
) {
|
||||
onChange(removeAllOptionsForDay(options, day.date));
|
||||
} else {
|
||||
const selectedDate = setHours(day.date, 12);
|
||||
const newOption: DateTimeOption = !isTimedEvent
|
||||
? {
|
||||
type: "date",
|
||||
date: formatDateWithoutTime(selectedDate),
|
||||
}
|
||||
: {
|
||||
type: "timeSlot",
|
||||
start: formatDateWithoutTz(selectedDate),
|
||||
end: formatDateWithoutTz(
|
||||
addMinutes(selectedDate, duration),
|
||||
),
|
||||
};
|
||||
|
||||
onChange([...options, newOption]);
|
||||
onNavigate(selectedDate);
|
||||
}
|
||||
if (day.outOfMonth) {
|
||||
if (i < 6) {
|
||||
datepicker.prev();
|
||||
} else {
|
||||
datepicker.next();
|
||||
}
|
||||
}
|
||||
}}
|
||||
className={clsx(
|
||||
"flex items-center relative lg:w-14 justify-center focus:ring-0 focus:ring-offset-0 hover:bg-slate-50 px-4 py-3 text-sm active:bg-slate-100",
|
||||
{
|
||||
"text-slate-400 bg-slate-50": day.outOfMonth,
|
||||
"font-bold text-indigo-500": day.today,
|
||||
"border-r": (i + 1) % 7 !== 0,
|
||||
"border-b": i < datepicker.days.length - 7,
|
||||
"font-normal after:content-[''] after:animate-popIn after:absolute after:w-8 after:h-8 after:rounded-full after:bg-green-500 after:-z-0 text-white":
|
||||
day.selected,
|
||||
},
|
||||
)}
|
||||
>
|
||||
<span className="z-10">{day.day}</span>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<Button className="mt-3" onClick={datepicker.today}>
|
||||
Today
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grow flex flex-col">
|
||||
<div
|
||||
className={clsx("border-b", {
|
||||
hidden: datepicker.selection.length === 0,
|
||||
})}
|
||||
>
|
||||
<div className="p-4 flex space-x-3 items-center">
|
||||
<div className="grow">
|
||||
<div className="font-medium">Specify times</div>
|
||||
<div className="text-sm text-slate-400">
|
||||
Include start and end times for each option
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Switch
|
||||
checked={isTimedEvent}
|
||||
onChange={(checked) => {
|
||||
if (checked) {
|
||||
// convert dates to time slots
|
||||
onChange(
|
||||
options.map((option) => {
|
||||
if (option.type === "timeSlot") {
|
||||
throw new Error(
|
||||
"Expected option to be a date but received timeSlot",
|
||||
);
|
||||
}
|
||||
const startDate = new Date(`${option.date}T12:00:00`);
|
||||
const endDate = addMinutes(startDate, duration);
|
||||
return {
|
||||
type: "timeSlot",
|
||||
start: formatDateWithoutTz(startDate),
|
||||
end: formatDateWithoutTz(endDate),
|
||||
};
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
onChange(
|
||||
datepicker.selection.map((date) => ({
|
||||
type: "date",
|
||||
date: formatDateWithoutTime(date),
|
||||
})),
|
||||
);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grow px-4">
|
||||
{isTimedEvent ? (
|
||||
<div className="divide-y">
|
||||
{Object.keys(optionsByDay)
|
||||
.sort((a, b) => (a > b ? 1 : -1))
|
||||
.map((dateString) => {
|
||||
const optionsForDay = optionsByDay[dateString];
|
||||
return (
|
||||
<div
|
||||
key={dateString}
|
||||
className="py-4 space-y-3 xs:space-y-0 xs:space-x-4 xs:flex"
|
||||
>
|
||||
<div>
|
||||
<DateCard
|
||||
{...getDateProps(new Date(dateString + "T12:00:00"))}
|
||||
/>
|
||||
</div>
|
||||
<div className="grow space-y-3">
|
||||
{optionsForDay.map(({ option, index }) => {
|
||||
if (option.type === "date") {
|
||||
throw new Error("Expected timeSlot but got date");
|
||||
}
|
||||
const startDate = new Date(option.start);
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="flex space-x-3 items-center"
|
||||
>
|
||||
<TimePicker
|
||||
value={startDate}
|
||||
onChange={(newStart) => {
|
||||
const newEnd = addMinutes(newStart, duration);
|
||||
// replace enter with updated start time
|
||||
onChange([
|
||||
...options.slice(0, index),
|
||||
{
|
||||
...option,
|
||||
start: formatDateWithoutTz(newStart),
|
||||
end: formatDateWithoutTz(newEnd),
|
||||
},
|
||||
...options.slice(index + 1),
|
||||
]);
|
||||
onNavigate(newStart);
|
||||
onChangeDuration(
|
||||
differenceInMinutes(newEnd, newStart),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<TimePicker
|
||||
value={new Date(option.end)}
|
||||
startFrom={addMinutes(startDate, 15)}
|
||||
onChange={(newEnd) => {
|
||||
onChange([
|
||||
...options.slice(0, index),
|
||||
{
|
||||
...option,
|
||||
end: formatDateWithoutTz(newEnd),
|
||||
},
|
||||
...options.slice(index + 1),
|
||||
]);
|
||||
onNavigate(newEnd);
|
||||
onChangeDuration(
|
||||
differenceInMinutes(newEnd, startDate),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<CompactButton
|
||||
icon={X}
|
||||
onClick={() => {
|
||||
onChange([
|
||||
...options.slice(0, index),
|
||||
...options.slice(index + 1),
|
||||
]);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="flex space-x-3 items-center">
|
||||
<Button
|
||||
icon={<PlusSm />}
|
||||
onClick={() => {
|
||||
const lastOption = expectTimeOption(
|
||||
optionsForDay[optionsForDay.length - 1].option,
|
||||
);
|
||||
const startTime = lastOption.start;
|
||||
|
||||
onChange([
|
||||
...options,
|
||||
{
|
||||
type: "timeSlot",
|
||||
start: startTime,
|
||||
end: formatDateWithoutTz(
|
||||
addMinutes(new Date(startTime), duration),
|
||||
),
|
||||
},
|
||||
]);
|
||||
}}
|
||||
>
|
||||
Add time option
|
||||
</Button>
|
||||
<Dropdown
|
||||
trigger={<CompactButton icon={DotsHorizontal} />}
|
||||
placement="bottom-start"
|
||||
>
|
||||
<DropdownItem
|
||||
icon={Magic}
|
||||
disabled={datepicker.selection.length < 2}
|
||||
label="Apply to all dates"
|
||||
onClick={() => {
|
||||
plausible("Applied options to all dates");
|
||||
const times = optionsForDay.map(
|
||||
({ option }) => {
|
||||
if (option.type === "date") {
|
||||
throw new Error(
|
||||
"Expected timeSlot but got date",
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
startTime: option.start.substring(
|
||||
option.start.indexOf("T"),
|
||||
),
|
||||
endTime: option.end.substring(
|
||||
option.end.indexOf("T"),
|
||||
),
|
||||
};
|
||||
},
|
||||
);
|
||||
const newOptions: DateTimeOption[] = [];
|
||||
Object.keys(optionsByDay).forEach(
|
||||
(dateString) => {
|
||||
times.forEach((time) => {
|
||||
newOptions.push({
|
||||
type: "timeSlot",
|
||||
start: dateString + time.startTime,
|
||||
end: dateString + time.endTime,
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
onChange(newOptions);
|
||||
}}
|
||||
/>
|
||||
<DropdownItem
|
||||
label="Delete date"
|
||||
icon={Trash}
|
||||
onClick={() => {
|
||||
onChange(
|
||||
removeAllOptionsForDay(
|
||||
options,
|
||||
new Date(dateString),
|
||||
),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</Dropdown>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : datepicker.selection.length ? (
|
||||
<div className="grid grid-cols-[repeat(auto-fill,60px)] gap-5 py-4">
|
||||
{datepicker.selection
|
||||
.sort((a, b) => a.getTime() - b.getTime())
|
||||
.map((selectedDate, i) => {
|
||||
return (
|
||||
<DateCard
|
||||
key={i}
|
||||
{...getDateProps(selectedDate)}
|
||||
annotation={
|
||||
<CompactButton
|
||||
icon={X}
|
||||
onClick={() => {
|
||||
// TODO (Luke Vella) [2022-03-19]: Find cleaner way to manage this state
|
||||
// Quite tedious right now to remove a single element
|
||||
onChange(
|
||||
removeAllOptionsForDay(options, selectedDate),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex h-full items-center justify-center py-12">
|
||||
<div className="text-center font-medium text-gray-400">
|
||||
<Calendar className="inline-block h-12 w-12 mb-2" />
|
||||
<div>No dates selected</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MonthCalendar;
|
|
@ -0,0 +1,107 @@
|
|||
import { Combobox } from "@headlessui/react";
|
||||
import clsx from "clsx";
|
||||
import { addMinutes, format, isSameDay, setHours, setMinutes } from "date-fns";
|
||||
import * as React from "react";
|
||||
import ReactDOM from "react-dom";
|
||||
import { usePopper } from "react-popper";
|
||||
|
||||
import ChevronDown from "../../../icons/chevron-down.svg";
|
||||
import { styleMenuItem } from "../../../menu-styles";
|
||||
|
||||
export interface TimePickerProps {
|
||||
value: Date;
|
||||
startFrom?: Date;
|
||||
className?: string;
|
||||
onChange?: (value: Date) => void;
|
||||
}
|
||||
|
||||
const TimePicker: React.VoidFunctionComponent<TimePickerProps> = ({
|
||||
value,
|
||||
onChange,
|
||||
className,
|
||||
startFrom = setMinutes(setHours(value, 0), 0),
|
||||
}) => {
|
||||
const [referenceElement, setReferenceElement] =
|
||||
React.useState<HTMLDivElement | null>(null);
|
||||
const [popperElement, setPopperElement] =
|
||||
React.useState<HTMLUListElement | null>(null);
|
||||
|
||||
const { styles, attributes } = usePopper(referenceElement, popperElement, {
|
||||
modifiers: [
|
||||
{
|
||||
name: "offset",
|
||||
options: {
|
||||
offset: [0, 5],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const [query, setQuery] = React.useState("");
|
||||
const options: React.ReactNode[] = [];
|
||||
for (let i = 0; i < 96; i++) {
|
||||
const optionValue = addMinutes(startFrom, i * 15);
|
||||
if (!isSameDay(value, optionValue)) {
|
||||
// we only support event that start and end on the same day for now
|
||||
// because react-big-calendar does not support events that span days
|
||||
break;
|
||||
}
|
||||
if (query && !format(optionValue, "hhmma").includes(query)) {
|
||||
continue;
|
||||
}
|
||||
options.push(
|
||||
<Combobox.Option
|
||||
key={i}
|
||||
className={styleMenuItem}
|
||||
value={optionValue.toISOString()}
|
||||
>
|
||||
{format(optionValue, "p")}
|
||||
</Combobox.Option>,
|
||||
);
|
||||
}
|
||||
|
||||
const portal = document.getElementById("portal");
|
||||
|
||||
return (
|
||||
<Combobox
|
||||
value={value.toISOString()}
|
||||
onChange={(newValue) => {
|
||||
setQuery("");
|
||||
onChange?.(new Date(newValue));
|
||||
}}
|
||||
>
|
||||
<div ref={setReferenceElement} className={clsx("relative", className)}>
|
||||
{/* Remove generic params once Combobox.Input can infer the types */}
|
||||
<Combobox.Input<"input">
|
||||
className="input w-28 pr-8"
|
||||
displayValue={() => ""}
|
||||
onChange={(e) => {
|
||||
setQuery(e.target.value.toUpperCase().replace(/[\:\s]/g, ""));
|
||||
}}
|
||||
/>
|
||||
<Combobox.Button className="absolute inset-0 flex items-center cursor-default px-2 h-9 text-left">
|
||||
<span className="grow truncate">
|
||||
{!query ? format(value, "p") : null}
|
||||
</span>
|
||||
<span className="flex pointer-events-none">
|
||||
<ChevronDown className="w-5 h-5" />
|
||||
</span>
|
||||
</Combobox.Button>
|
||||
{portal &&
|
||||
ReactDOM.createPortal(
|
||||
<Combobox.Options
|
||||
style={styles.popper}
|
||||
{...attributes.popper}
|
||||
ref={setPopperElement}
|
||||
className="z-50 w-32 py-1 overflow-auto bg-white rounded-md shadow-lg max-h-72 ring-1 ring-black ring-opacity-5 focus:outline-none"
|
||||
>
|
||||
{options}
|
||||
</Combobox.Options>,
|
||||
portal,
|
||||
)}
|
||||
</div>
|
||||
</Combobox>
|
||||
);
|
||||
};
|
||||
|
||||
export default TimePicker;
|
233
components/forms/poll-options-form/poll-options-form.tsx
Normal file
|
@ -0,0 +1,233 @@
|
|||
import clsx from "clsx";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import * as React from "react";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
|
||||
import { getBrowserTimeZone } from "../../../utils/date-time-utils";
|
||||
import FullPageLoader from "../../full-page-loader";
|
||||
import Calendar from "../../icons/calendar.svg";
|
||||
import Table from "../../icons/table.svg";
|
||||
import { useModal } from "../../modal";
|
||||
import TimeZonePicker from "../../time-zone-picker";
|
||||
import { PollFormProps } from "../types";
|
||||
import { DateTimeOption } from "./types";
|
||||
|
||||
const WeekCalendar = React.lazy(() => import("./week-calendar"));
|
||||
const MonthCalendar = React.lazy(() => import("./month-calendar"));
|
||||
|
||||
export type PollOptionsData = {
|
||||
navigationDate: string; // used to navigate to the right part of the calendar
|
||||
duration: number; // duration of the event in minutes
|
||||
timeZone: string;
|
||||
view: string;
|
||||
options: DateTimeOption[];
|
||||
};
|
||||
|
||||
const PollOptionsForm: React.VoidFunctionComponent<
|
||||
PollFormProps<PollOptionsData> & { title?: string }
|
||||
> = ({ name, defaultValues, onSubmit, onChange, title, className }) => {
|
||||
const { t } = useTranslation("app");
|
||||
const { control, handleSubmit, watch, setValue, formState } =
|
||||
useForm<PollOptionsData>({
|
||||
defaultValues: {
|
||||
options: [],
|
||||
duration: 30,
|
||||
timeZone: "",
|
||||
navigationDate: new Date().toISOString(),
|
||||
...defaultValues,
|
||||
},
|
||||
resolver: (values) => {
|
||||
return {
|
||||
values,
|
||||
errors:
|
||||
values.options.length === 0
|
||||
? {
|
||||
options: true,
|
||||
}
|
||||
: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
const views = React.useMemo(() => {
|
||||
const res = [
|
||||
{
|
||||
label: "Month view",
|
||||
value: "month",
|
||||
Component: MonthCalendar,
|
||||
},
|
||||
{
|
||||
label: "Week view",
|
||||
value: "week",
|
||||
Component: WeekCalendar,
|
||||
},
|
||||
];
|
||||
return res;
|
||||
}, []);
|
||||
|
||||
const watchView = watch("view");
|
||||
|
||||
const selectedView = React.useMemo(
|
||||
() => views.find((view) => view.value === watchView) ?? views[0],
|
||||
[views, watchView],
|
||||
);
|
||||
|
||||
const watchOptions = watch("options");
|
||||
const watchDuration = watch("duration");
|
||||
const watchTimeZone = watch("timeZone");
|
||||
|
||||
const datesOnly = watchOptions.every((option) => option.type === "date");
|
||||
|
||||
const [dateOrTimeRangeModal, openDateOrTimeRangeModal] = useModal({
|
||||
title: "Wait a minute… 🤔",
|
||||
description:
|
||||
"You can't have both time and date options in the same poll. Which would you like to keep?",
|
||||
okText: "Keep time options",
|
||||
onOk: () => {
|
||||
setValue(
|
||||
"options",
|
||||
watchOptions.filter((option) => option.type === "timeSlot"),
|
||||
);
|
||||
if (!watchTimeZone) {
|
||||
setValue("timeZone", getBrowserTimeZone());
|
||||
}
|
||||
},
|
||||
cancelText: "Keep date options",
|
||||
onCancel: () => {
|
||||
setValue(
|
||||
"options",
|
||||
watchOptions.filter((option) => option.type === "date"),
|
||||
);
|
||||
setValue("timeZone", "");
|
||||
},
|
||||
});
|
||||
|
||||
React.useEffect(() => {
|
||||
if (onChange) {
|
||||
const subscription = watch(({ options = [], ...rest }) => {
|
||||
// Watch returns a deep partial here which is not really accurate and messes up
|
||||
// the types a bit. Repackaging it to keep the types sane.
|
||||
onChange({ options: options as DateTimeOption[], ...rest });
|
||||
});
|
||||
return () => {
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
}
|
||||
}, [watch, onChange]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (watchOptions.length > 1) {
|
||||
const optionType = watchOptions[0].type;
|
||||
// all options needs to be the same type
|
||||
if (watchOptions.some((option) => option.type !== optionType)) {
|
||||
openDateOrTimeRangeModal();
|
||||
}
|
||||
}
|
||||
}, [watchOptions, openDateOrTimeRangeModal]);
|
||||
|
||||
const watchNavigationDate = watch("navigationDate");
|
||||
const navigationDate = new Date(watchNavigationDate);
|
||||
|
||||
const [calendarHelpModal, openHelpModal] = useModal({
|
||||
overlayClosable: true,
|
||||
title: "Forget something?",
|
||||
description: t("calendarHelp"),
|
||||
okText: t("ok"),
|
||||
});
|
||||
|
||||
return (
|
||||
<form
|
||||
id={name}
|
||||
className={clsx("max-w-full", className)}
|
||||
style={{ width: 1024 }}
|
||||
onSubmit={handleSubmit(onSubmit, openHelpModal)}
|
||||
>
|
||||
{calendarHelpModal}
|
||||
{dateOrTimeRangeModal}
|
||||
<div className="py-3 space-y-2 lg:space-y-0 border-b w-full lg:space-x-2 bg-slate-50 items-center lg:flex px-4">
|
||||
<div className="grow">
|
||||
<Controller
|
||||
control={control}
|
||||
name="timeZone"
|
||||
render={({ field }) => (
|
||||
<TimeZonePicker
|
||||
value={field.value}
|
||||
onBlur={field.onBlur}
|
||||
onChange={(timeZone) => {
|
||||
setValue("timeZone", timeZone, { shouldTouch: true });
|
||||
}}
|
||||
disabled={datesOnly}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex space-x-3">
|
||||
<div className="segment-button w-full">
|
||||
<button
|
||||
className={clsx({
|
||||
"segment-button-active": selectedView.value === "month",
|
||||
})}
|
||||
onClick={() => {
|
||||
setValue("view", "month");
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
<Calendar className="h-5 w-5 mr-2" /> Month view
|
||||
</button>
|
||||
<button
|
||||
className={clsx({
|
||||
"segment-button-active": selectedView.value === "week",
|
||||
})}
|
||||
type="button"
|
||||
onClick={() => {
|
||||
setValue("view", "week");
|
||||
}}
|
||||
>
|
||||
<Table className="h-5 w-5 mr-2" /> Week view
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full relative">
|
||||
<React.Suspense
|
||||
fallback={
|
||||
<FullPageLoader className="h-[400px]">Loading…</FullPageLoader>
|
||||
}
|
||||
>
|
||||
<selectedView.Component
|
||||
title={title}
|
||||
options={watchOptions}
|
||||
date={navigationDate}
|
||||
onNavigate={(date) => {
|
||||
setValue("navigationDate", date.toISOString());
|
||||
}}
|
||||
onChange={(options) => {
|
||||
setValue("options", options);
|
||||
if (
|
||||
options.length === 0 ||
|
||||
options.every((option) => option.type === "date")
|
||||
) {
|
||||
// unset the timeZone if we only have date option
|
||||
setValue("timeZone", "");
|
||||
}
|
||||
if (
|
||||
options.length > 0 &&
|
||||
!formState.touchedFields.timeZone &&
|
||||
options.every((option) => option.type === "timeSlot")
|
||||
) {
|
||||
// set timeZone if we are adding time ranges and we haven't touched the timeZone field
|
||||
setValue("timeZone", getBrowserTimeZone());
|
||||
}
|
||||
}}
|
||||
duration={watchDuration}
|
||||
onChangeDuration={(duration) => {
|
||||
setValue("duration", duration);
|
||||
}}
|
||||
/>
|
||||
</React.Suspense>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
};
|
||||
|
||||
export default React.memo(PollOptionsForm);
|
23
components/forms/poll-options-form/types.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
export type DateOption = {
|
||||
type: "date";
|
||||
date: string;
|
||||
};
|
||||
|
||||
export type TimeOption = {
|
||||
type: "timeSlot";
|
||||
start: string;
|
||||
end: string;
|
||||
};
|
||||
|
||||
export type DateTimeOption = DateOption | TimeOption;
|
||||
|
||||
export interface DateTimePickerProps {
|
||||
title?: string;
|
||||
options: DateTimeOption[];
|
||||
date: Date;
|
||||
onNavigate: (date: Date) => void;
|
||||
onChange: (options: DateTimeOption[]) => void;
|
||||
duration: number;
|
||||
onChangeDuration: (duration: number) => void;
|
||||
scrollToTime?: Date;
|
||||
}
|
9
components/forms/poll-options-form/utils.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { format } from "date-fns";
|
||||
|
||||
export const formatDateWithoutTz = (date: Date): string => {
|
||||
return format(date, "yyyy-MM-dd'T'HH:mm:ss");
|
||||
};
|
||||
|
||||
export const formatDateWithoutTime = (date: Date): string => {
|
||||
return format(date, "yyyy-MM-dd");
|
||||
};
|
193
components/forms/poll-options-form/week-calendar.tsx
Normal file
|
@ -0,0 +1,193 @@
|
|||
import clsx from "clsx";
|
||||
import {
|
||||
addMinutes,
|
||||
differenceInMinutes,
|
||||
format,
|
||||
getDay,
|
||||
parse,
|
||||
startOfWeek,
|
||||
} from "date-fns";
|
||||
import React from "react";
|
||||
import { Calendar, dateFnsLocalizer } from "react-big-calendar";
|
||||
import { useMount } from "react-use";
|
||||
|
||||
import DateNavigationToolbar from "./date-navigation-toolbar";
|
||||
import { DateTimeOption, DateTimePickerProps } from "./types";
|
||||
import { formatDateWithoutTime, formatDateWithoutTz } from "./utils";
|
||||
|
||||
const localizer = dateFnsLocalizer({
|
||||
format,
|
||||
parse,
|
||||
startOfWeek: (date: Date | number) => startOfWeek(date, { weekStartsOn: 1 }),
|
||||
getDay,
|
||||
locales: {},
|
||||
});
|
||||
|
||||
const WeekCalendar: React.VoidFunctionComponent<DateTimePickerProps> = ({
|
||||
title,
|
||||
options,
|
||||
onNavigate,
|
||||
date,
|
||||
onChange,
|
||||
duration,
|
||||
onChangeDuration,
|
||||
}) => {
|
||||
const [scrollToTime, setScrollToTime] = React.useState<Date>();
|
||||
|
||||
useMount(() => {
|
||||
// Bit of a hack to force rbc to scroll to the right time when we close/open a modal
|
||||
setScrollToTime(addMinutes(date, -60));
|
||||
});
|
||||
|
||||
return (
|
||||
<Calendar
|
||||
events={options.map((option) => {
|
||||
if (option.type === "date") {
|
||||
return { title, start: new Date(option.date) };
|
||||
} else {
|
||||
return {
|
||||
title,
|
||||
start: new Date(option.start),
|
||||
end: new Date(option.end),
|
||||
};
|
||||
}
|
||||
})}
|
||||
onNavigate={onNavigate}
|
||||
date={date}
|
||||
className="h-[calc(100vh-220px)] max-h-[800px] min-h-[400px] w-full"
|
||||
defaultView="week"
|
||||
views={["week"]}
|
||||
selectable={true}
|
||||
localizer={localizer}
|
||||
onSelectEvent={(event) => {
|
||||
onChange(
|
||||
options.filter(
|
||||
(option) =>
|
||||
!(
|
||||
option.type === "timeSlot" &&
|
||||
option.start === formatDateWithoutTz(event.start) &&
|
||||
event.end &&
|
||||
option.end === formatDateWithoutTz(event.end)
|
||||
),
|
||||
),
|
||||
);
|
||||
}}
|
||||
components={{
|
||||
toolbar: (props) => {
|
||||
return (
|
||||
<DateNavigationToolbar
|
||||
year={props.date.getFullYear()}
|
||||
label={props.label}
|
||||
onPrevious={() => {
|
||||
props.onNavigate("PREV");
|
||||
}}
|
||||
onToday={() => {
|
||||
props.onNavigate("TODAY");
|
||||
}}
|
||||
onNext={() => {
|
||||
props.onNavigate("NEXT");
|
||||
}}
|
||||
/>
|
||||
);
|
||||
},
|
||||
eventWrapper: (props) => {
|
||||
return (
|
||||
<div
|
||||
// onClick prop doesn't work properly. Seems like some other element is cancelling the event before it reaches this element
|
||||
onMouseUp={props.onClick}
|
||||
className="absolute p-1 ml-1 max-h-full hover:bg-opacity-50 transition-colors cursor-pointer overflow-hidden bg-green-100 bg-opacity-80 text-green-500 rounded-md text-xs"
|
||||
style={{
|
||||
top: `calc(${props.style?.top}% + 4px)`,
|
||||
height: `calc(${props.style?.height}% - 8px)`,
|
||||
left: `${props.style?.xOffset}%`,
|
||||
width: `calc(${props.style?.width}%)`,
|
||||
}}
|
||||
>
|
||||
<div>{format(props.event.start, "p")}</div>
|
||||
<div className="font-bold w-full truncate">
|
||||
{props.event.title}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
week: {
|
||||
header: ({ date }: any) => {
|
||||
const dateString = formatDateWithoutTime(date);
|
||||
const selectedOption = options.find((option) => {
|
||||
return option.type === "date" && option.date === dateString;
|
||||
});
|
||||
return (
|
||||
<span
|
||||
onClick={() => {
|
||||
if (!selectedOption) {
|
||||
onChange([
|
||||
...options,
|
||||
{
|
||||
type: "date",
|
||||
date: formatDateWithoutTime(date),
|
||||
},
|
||||
]);
|
||||
} else {
|
||||
onChange(
|
||||
options.filter((option) => option !== selectedOption),
|
||||
);
|
||||
}
|
||||
}}
|
||||
className={clsx(
|
||||
"inline-flex w-full justify-center hover:text-gray-700 hover:bg-slate-50 rounded-md items-center text-sm py-2",
|
||||
{
|
||||
"bg-green-50 text-green-600 hover:bg-opacity-75 hover:bg-green-50 hover:text-green-600":
|
||||
!!selectedOption,
|
||||
},
|
||||
)}
|
||||
>
|
||||
<span className="font-normal opacity-50 mr-1">
|
||||
{format(date, "E")}
|
||||
</span>
|
||||
<span className="font-medium">{format(date, "dd")}</span>
|
||||
</span>
|
||||
);
|
||||
},
|
||||
},
|
||||
timeSlotWrapper: ({ children }) => {
|
||||
return <div className="h-12 text-xs text-gray-500">{children}</div>;
|
||||
},
|
||||
}}
|
||||
step={15}
|
||||
onSelectSlot={({ start, end, action }) => {
|
||||
// on select slot
|
||||
const startDate = new Date(start);
|
||||
const endDate = new Date(end);
|
||||
|
||||
const newEvent: DateTimeOption = {
|
||||
type: "timeSlot",
|
||||
start: formatDateWithoutTz(startDate),
|
||||
end: formatDateWithoutTz(endDate),
|
||||
};
|
||||
|
||||
if (action === "select") {
|
||||
const diff = differenceInMinutes(endDate, startDate);
|
||||
if (diff < 60 * 24) {
|
||||
onChangeDuration(diff);
|
||||
}
|
||||
} else {
|
||||
newEvent.end = formatDateWithoutTz(addMinutes(startDate, duration));
|
||||
}
|
||||
|
||||
const alreadyExists = options.some(
|
||||
(option) =>
|
||||
option.type === "timeSlot" &&
|
||||
option.start === newEvent.start &&
|
||||
option.end === newEvent.end,
|
||||
);
|
||||
|
||||
if (!alreadyExists) {
|
||||
onChange([...options, newEvent]);
|
||||
}
|
||||
}}
|
||||
scrollToTime={scrollToTime}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default WeekCalendar;
|
17
components/forms/types.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { PollDetailsData } from "./poll-details-form";
|
||||
import { PollOptionsData } from "./poll-options-form/poll-options-form";
|
||||
import { UserDetailsData } from "./user-details-form";
|
||||
|
||||
export interface NewEventData {
|
||||
currentStep: number;
|
||||
eventDetails?: Partial<PollDetailsData>;
|
||||
options?: Partial<PollOptionsData>;
|
||||
userDetails?: Partial<UserDetailsData>;
|
||||
}
|
||||
export interface PollFormProps<T extends Record<string, any>> {
|
||||
onSubmit: (data: T) => void;
|
||||
onChange?: (data: Partial<T>) => void;
|
||||
defaultValues?: Partial<T>;
|
||||
name?: string;
|
||||
className?: string;
|
||||
}
|
71
components/forms/user-details-form.tsx
Normal file
|
@ -0,0 +1,71 @@
|
|||
import clsx from "clsx";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import * as React from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import { requiredString } from "../../utils/form-validation";
|
||||
import { PollFormProps } from "./types";
|
||||
|
||||
export interface UserDetailsData {
|
||||
name: string;
|
||||
contact: string;
|
||||
}
|
||||
|
||||
export const UserDetailsForm: React.VoidFunctionComponent<
|
||||
PollFormProps<UserDetailsData>
|
||||
> = ({ name, defaultValues, onSubmit, onChange, className }) => {
|
||||
const { t } = useTranslation("app");
|
||||
const {
|
||||
handleSubmit,
|
||||
register,
|
||||
watch,
|
||||
formState: { errors },
|
||||
} = useForm<UserDetailsData>({ defaultValues });
|
||||
|
||||
React.useEffect(() => {
|
||||
if (onChange) {
|
||||
const subscription = watch(onChange);
|
||||
return () => {
|
||||
subscription.unsubscribe();
|
||||
};
|
||||
}
|
||||
}, [watch, onChange]);
|
||||
|
||||
return (
|
||||
<form
|
||||
id={name}
|
||||
className={className}
|
||||
style={{ width: 400 }}
|
||||
onSubmit={handleSubmit(onSubmit)}
|
||||
>
|
||||
<div className="formField">
|
||||
<label htmlFor="name">{t("name")}</label>
|
||||
<input
|
||||
type="text"
|
||||
id="name"
|
||||
className={clsx("input w-full", {
|
||||
"input-error": errors.name,
|
||||
})}
|
||||
placeholder={t("namePlaceholder")}
|
||||
{...register("name", { validate: requiredString })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="formField">
|
||||
<label htmlFor="contact">{t("email")}</label>
|
||||
<input
|
||||
id="contact"
|
||||
className={clsx("input w-full", {
|
||||
"input-error": errors.contact,
|
||||
})}
|
||||
placeholder={t("emailPlaceholder")}
|
||||
{...register("contact", {
|
||||
validate: (value) => {
|
||||
return /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(value);
|
||||
},
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
};
|
27
components/full-page-loader.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import clsx from "clsx";
|
||||
import * as React from "react";
|
||||
|
||||
import Spinner from "./icons/spinner.svg";
|
||||
|
||||
interface FullPageLoaderProps {
|
||||
className?: string;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
const FullPageLoader: React.VoidFunctionComponent<FullPageLoaderProps> = ({
|
||||
children,
|
||||
className,
|
||||
}) => {
|
||||
return (
|
||||
<div
|
||||
className={clsx(" h-full flex items-center justify-center", className)}
|
||||
>
|
||||
<div className="bg-indigo-500 text-white text-sm px-4 py-3 shadow-sm rounded-lg flex items-center">
|
||||
<Spinner className="h-5 mr-3 animate-spin" />
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default FullPageLoader;
|
19
components/header.tsx
Normal file
|
@ -0,0 +1,19 @@
|
|||
import { useTranslation } from "next-i18next";
|
||||
import React from "react";
|
||||
|
||||
const Header: React.FunctionComponent<{ className?: string }> = (props) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div
|
||||
className="h-10 shrink-0 border-gray-200 px-6 flex items-center"
|
||||
{...props}
|
||||
>
|
||||
<div className="text-base font-bold text-gray-400 uppercase">
|
||||
{t("appName")}
|
||||
</div>
|
||||
<div className="ml-2 text-xs text-gray-400">v2-alpha</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Header;
|
119
components/headless-date-picker.tsx
Normal file
|
@ -0,0 +1,119 @@
|
|||
import {
|
||||
addDays,
|
||||
addMonths,
|
||||
format,
|
||||
getMonth,
|
||||
isSameDay,
|
||||
isWeekend,
|
||||
startOfMonth,
|
||||
startOfWeek,
|
||||
} from "date-fns";
|
||||
import React from "react";
|
||||
|
||||
interface DayProps {
|
||||
date: Date;
|
||||
day: string;
|
||||
weekend: boolean;
|
||||
outOfMonth: boolean;
|
||||
today: boolean;
|
||||
selected: boolean;
|
||||
}
|
||||
|
||||
interface HeadlessDatePickerOptions {
|
||||
onSelectionChange?: (selection: Date[]) => void;
|
||||
date?: Date;
|
||||
selection?: Date[];
|
||||
onNavigationChange?: (date: Date) => void;
|
||||
}
|
||||
|
||||
const today = new Date();
|
||||
|
||||
export const useHeadlessDatePicker = (
|
||||
options?: HeadlessDatePickerOptions,
|
||||
): {
|
||||
label: string;
|
||||
next: () => void;
|
||||
prev: () => void;
|
||||
today: () => void;
|
||||
daysOfWeek: string[];
|
||||
days: DayProps[];
|
||||
navigationDate: Date;
|
||||
selection: Date[];
|
||||
toggle: (date: Date) => void;
|
||||
} => {
|
||||
const [localSelection, setSelection] = React.useState<Date[]>([]);
|
||||
const selection = options?.selection ?? localSelection;
|
||||
const [localNavigationDate, setNavigationDate] = React.useState(today);
|
||||
const navigationDate = options?.date ?? localNavigationDate;
|
||||
|
||||
const firstDayOfMonth = startOfMonth(navigationDate);
|
||||
const firstDayOfFirstWeek = startOfWeek(firstDayOfMonth, { weekStartsOn: 1 });
|
||||
|
||||
const currentMonth = getMonth(navigationDate);
|
||||
|
||||
const days: DayProps[] = [];
|
||||
|
||||
const daysOfWeek: string[] = [];
|
||||
|
||||
for (let i = 0; i < 7; i++) {
|
||||
daysOfWeek.push(format(addDays(firstDayOfFirstWeek, i), "EE"));
|
||||
}
|
||||
|
||||
let reachedEnd = false;
|
||||
let i = 0;
|
||||
do {
|
||||
const d = addDays(firstDayOfFirstWeek, i);
|
||||
days.push({
|
||||
date: d,
|
||||
day: format(d, "d"),
|
||||
weekend: isWeekend(d),
|
||||
outOfMonth: getMonth(d) !== currentMonth,
|
||||
today: isSameDay(d, today),
|
||||
selected: selection.some((selectedDate) => isSameDay(selectedDate, d)),
|
||||
});
|
||||
i++;
|
||||
reachedEnd =
|
||||
i > 34 && i % 7 === 0 && addDays(d, 1).getMonth() !== currentMonth;
|
||||
} while (reachedEnd === false);
|
||||
|
||||
return {
|
||||
navigationDate,
|
||||
label: format(navigationDate, "MMMM yyyy"),
|
||||
next: () => {
|
||||
const newDate = startOfMonth(addMonths(navigationDate, 1));
|
||||
if (!options?.date) {
|
||||
setNavigationDate(newDate);
|
||||
}
|
||||
options?.onNavigationChange?.(newDate);
|
||||
},
|
||||
prev: () => {
|
||||
const newDate = startOfMonth(addMonths(navigationDate, -1));
|
||||
if (!options?.date) {
|
||||
setNavigationDate(newDate);
|
||||
}
|
||||
options?.onNavigationChange?.(newDate);
|
||||
},
|
||||
today: () => {
|
||||
const newDate = today;
|
||||
if (!options?.date) {
|
||||
setNavigationDate(newDate);
|
||||
}
|
||||
options?.onNavigationChange?.(newDate);
|
||||
},
|
||||
days,
|
||||
daysOfWeek,
|
||||
selection: options?.selection ?? selection,
|
||||
toggle: (date) => {
|
||||
if (options?.selection) {
|
||||
// ignore, selection is controlled externally
|
||||
return;
|
||||
}
|
||||
const index = selection.indexOf(date);
|
||||
if (index === -1) {
|
||||
setSelection((s) => [...s, date]);
|
||||
} else {
|
||||
setSelection((s) => s.splice(index, 1));
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
3
components/home/ban-ads.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M10 0a10 10 0 110 20 10 10 0 010-20zm4.905 3.68A8 8 0 003.68 14.906l3.296-3.296-.007-.022H5.531l-.253.835H4L5.44 8.06h1.62l.86 2.606.64-.64V8.06h1.662c.1 0 .197.004.291.013l4.393-4.393zm-4.908 7.738l1.222-1.223v.046c0 .305-.04.542-.121.712a.703.703 0 01-.35.36 1.32 1.32 0 01-.551.105h-.2zM8.99 12.423h1.248c.443 0 .828-.086 1.153-.26.325-.174.577-.424.754-.75.178-.326.266-.717.266-1.171 0-.395-.067-.74-.202-1.038l4.11-4.11A8 8 0 015.095 16.32l3.896-3.897zm5.802-3.332a.46.46 0 01.16.332h1.134a1.34 1.34 0 00-.214-.748 1.367 1.367 0 00-.594-.498A2.177 2.177 0 0014.365 8c-.345 0-.651.058-.918.175-.266.116-.474.279-.625.488a1.2 1.2 0 00-.221.726c-.002.341.108.61.33.808.223.196.528.336.914.42l.435.093c.162.036.29.074.385.115.096.04.164.086.205.137a.27.27 0 01.066.174.307.307 0 01-.068.19.43.43 0 01-.194.13.931.931 0 01-.318.047.985.985 0 01-.39-.07.558.558 0 01-.251-.207.668.668 0 01-.1-.337H12.49c.001.365.08.665.234.9.156.232.375.405.656.517.283.112.614.168.993.168.37 0 .686-.051.949-.155.264-.104.467-.255.609-.454.142-.199.214-.442.215-.729a1.337 1.337 0 00-.08-.46 1.055 1.055 0 00-.242-.38 1.475 1.475 0 00-.421-.295 2.691 2.691 0 00-.62-.203l-.358-.076a1.988 1.988 0 01-.269-.073.836.836 0 01-.185-.09.345.345 0 01-.107-.112.278.278 0 01-.028-.143.289.289 0 01.058-.17.361.361 0 01.17-.118.854.854 0 01.3-.044c.193 0 .335.04.43.119zm-8.526.17l.435 1.44h-.904l.435-1.44h.034z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
59
components/home/bonus.tsx
Normal file
|
@ -0,0 +1,59 @@
|
|||
import * as React from "react";
|
||||
import Ban from "./ban-ads.svg";
|
||||
import Code from "@/components/icons/code.svg";
|
||||
import Server from "@/components/icons/server.svg";
|
||||
import CursorClick from "@/components/icons/cursor-click.svg";
|
||||
|
||||
const Bonus: React.VoidFunctionComponent = () => {
|
||||
return (
|
||||
<div className="py-16 max-w-7xl mx-auto px-8">
|
||||
<h2 className="heading">Principles</h2>
|
||||
<p className="subheading">We're not like the others</p>
|
||||
<div className="grid grid-cols-4 gap-16">
|
||||
<div className="col-span-4 md:col-span-2 lg:col-span-1">
|
||||
<div className="mb-4 text-slate-400">
|
||||
<CursorClick className="w-16" />
|
||||
</div>
|
||||
<h3 className="heading-sm">No login required</h3>
|
||||
<div className="text text-base leading-relaxed">
|
||||
We keep things simple and don't ask for more than what we need.
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-4 md:col-span-2 lg:col-span-1">
|
||||
<div className="mb-4 text-slate-400">
|
||||
<Code className="w-16" />
|
||||
</div>
|
||||
<h3 className="heading-sm">Open-source</h3>
|
||||
<div className="text text-base leading-relaxed">
|
||||
The codebase is fully open-source and{" "}
|
||||
<a href="https://github.com/lukevella/Rallly">
|
||||
available on github
|
||||
</a>
|
||||
.
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-4 md:col-span-2 lg:col-span-1">
|
||||
<div className="mb-4 text-slate-400">
|
||||
<Server className="w-16" />
|
||||
</div>
|
||||
<h3 className="heading-sm">Self-hostable</h3>
|
||||
<div className="text text-base leading-relaxed">
|
||||
Run it on your own server to get full control of your data.
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-span-4 md:col-span-2 lg:col-span-1">
|
||||
<div className="mb-4 text-slate-400">
|
||||
<Ban className="w-16" />
|
||||
</div>
|
||||
<h3 className="heading-sm">Ad-free</h3>
|
||||
<div className="text text-base leading-relaxed">
|
||||
You can give your ad-blocker a rest – You won't need it
|
||||
here.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Bonus;
|
64
components/home/features.tsx
Normal file
|
@ -0,0 +1,64 @@
|
|||
import Bell from "@/components/icons/bell.svg";
|
||||
import Chat from "@/components/icons/chat.svg";
|
||||
import Clock from "@/components/icons/clock.svg";
|
||||
import DeviceMobile from "@/components/icons/device-mobile.svg";
|
||||
import * as React from "react";
|
||||
|
||||
const Features: React.VoidFunctionComponent = () => {
|
||||
return (
|
||||
<div className="py-16 px-8 max-w-7xl mx-auto">
|
||||
<h2 className="heading">Features</h2>
|
||||
<p className="subheading">Everything you need to get the job done</p>
|
||||
<div className="grid grid-cols-2 gap-12">
|
||||
<div className="col-span-2 md:col-span-1">
|
||||
<div className="p-3 bg-green-100/50 text-green-400 inline-block rounded-2xl mb-4">
|
||||
<Clock className="w-8 h-8" />
|
||||
</div>
|
||||
<h3 className="heading-sm flex items-center">
|
||||
Time slots
|
||||
<span className="ml-2 font-normal text-sm bg-green-500 text-white rounded-full px-2 py-1">
|
||||
New
|
||||
</span>
|
||||
</h3>
|
||||
<p className="text">
|
||||
If you need more granular options, Rallly lets you choose time slots
|
||||
as options. If your participants are international, they can see
|
||||
times in on their own time zone.
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-span-2 md:col-span-1">
|
||||
<div className="p-3 bg-cyan-100/50 text-cyan-400 inline-block rounded-2xl mb-4">
|
||||
<DeviceMobile className="w-8 h-8" />
|
||||
</div>
|
||||
<h3 className="heading-sm">Mobile friendly design</h3>
|
||||
<p className="text">
|
||||
Rallly is optimized to look and work great on mobile devices so you
|
||||
and your participants can use it on the go.
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-span-2 md:col-span-1">
|
||||
<div className="p-3 bg-rose-100/50 text-rose-400 inline-block rounded-2xl mb-4">
|
||||
<Bell className="w-8 h-8" />
|
||||
</div>
|
||||
<h3 className="heading-sm">Notifications</h3>
|
||||
<p className="text">
|
||||
Need help staying on top of things? Rallly can send you an email
|
||||
whenever participants vote or comment on your poll.
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-span-2 md:col-span-1">
|
||||
<div className="p-3 bg-yellow-100/50 text-yellow-400 inline-block rounded-2xl mb-4">
|
||||
<Chat className="w-8 h-8" />
|
||||
</div>
|
||||
<h3 className="heading-sm">Comments</h3>
|
||||
<p className="text">
|
||||
Got a question or just have something to say? You and your
|
||||
participants can comment on polls to start a discussion.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Features;
|
3
components/home/github.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg width="24" height="24" fill="currentColor" class="text-purple-600 mr-3 text-opacity-50 transform">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 2C6.477 2 2 6.463 2 11.97c0 4.404 2.865 8.14 6.839 9.458.5.092.682-.216.682-.48 0-.236-.008-.864-.013-1.695-2.782.602-3.369-1.337-3.369-1.337-.454-1.151-1.11-1.458-1.11-1.458-.908-.618.069-.606.069-.606 1.003.07 1.531 1.027 1.531 1.027.892 1.524 2.341 1.084 2.91.828.092-.643.35-1.083.636-1.332-2.22-.251-4.555-1.107-4.555-4.927 0-1.088.39-1.979 1.029-2.675-.103-.252-.446-1.266.098-2.638 0 0 .84-.268 2.75 1.022A9.606 9.606 0 0112 6.82c.85.004 1.705.114 2.504.336 1.909-1.29 2.747-1.022 2.747-1.022.546 1.372.202 2.386.1 2.638.64.696 1.028 1.587 1.028 2.675 0 3.83-2.339 4.673-4.566 4.92.359.307.678.915.678 1.846 0 1.332-.012 2.407-.012 2.734 0 .267.18.577.688.48C19.137 20.107 22 16.373 22 11.969 22 6.463 17.522 2 12 2z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 898 B |
80
components/home/hero.tsx
Normal file
|
@ -0,0 +1,80 @@
|
|||
import { motion } from "framer-motion";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import Link from "next/link";
|
||||
import * as React from "react";
|
||||
import { UserAvatarProvider } from "../poll/user-avatar";
|
||||
import PollDemo from "./poll-demo";
|
||||
import ScribbleArrow from "./scribble-arrow.svg";
|
||||
|
||||
const Hero: React.VoidFunctionComponent = () => {
|
||||
const { t } = useTranslation("homepage");
|
||||
const names = ["Peter", "Christine", "Samantha", "Joseph"];
|
||||
|
||||
return (
|
||||
<div className="lg:flex p-8 items-end max-w-7xl mx-auto">
|
||||
<div className="my-8 text-center lg:text-left">
|
||||
<h1 className="text-5xl font-bold">
|
||||
Schedule
|
||||
<br />
|
||||
<span className="text-indigo-500">group meetings</span>
|
||||
<br />
|
||||
with ease
|
||||
</h1>
|
||||
<div className="text-xl text-gray-400 mb-12">
|
||||
Find the right date without the back and forth.
|
||||
</div>
|
||||
<div className="space-x-3">
|
||||
<Link href="/new">
|
||||
<a className="focus:ring-2 focus:ring-indigo-200 transition-all text-white bg-indigo-500 hover:bg-indigo-500/90 active:bg-indigo-600/90 px-5 py-3 font-semibold hover:text-white hover:no-underline shadow-sm hover:shadow-md rounded-lg">
|
||||
{t("getStarted")}
|
||||
</a>
|
||||
</Link>
|
||||
<Link href="/demo">
|
||||
<a
|
||||
className="text-white focus:ring-2 focus:ring-indigo-200 transition-all bg-slate-500 hover:bg-slate-500/90 active:bg-slate-600/90 px-5 py-3 font-semibold hover:text-white hover:no-underline shadow-sm hover:shadow-md rounded-lg"
|
||||
rel="nofollow"
|
||||
>
|
||||
{t("viewDemo")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
<div className="hidden mt-16 lg:mt-0 lg:ml-24 pointer-events-none select-none h-[380px] md:flex items-end justify-center">
|
||||
<UserAvatarProvider seed="mock" names={names}>
|
||||
<div className="inline-block relative">
|
||||
<motion.div
|
||||
className="absolute z-20 border-4 shadow-md bg-indigo-200/10 rounded-2xl border-indigo-500 h-full"
|
||||
initial={{ opacity: 0, width: 100, scale: 1.2, translateX: 384 }}
|
||||
animate={{ opacity: 1, scale: 1.1 }}
|
||||
transition={{ type: "spring", delay: 1 }}
|
||||
/>
|
||||
<motion.div
|
||||
className="absolute bg-indigo-500 text-slate-100 py-1 px-3 rounded-full z-20 text-sm"
|
||||
initial={{
|
||||
opacity: 0,
|
||||
right: 190,
|
||||
top: -65,
|
||||
translateY: 50,
|
||||
}}
|
||||
animate={{ opacity: 1, translateY: 0 }}
|
||||
transition={{ type: "spring", delay: 2 }}
|
||||
>
|
||||
Perfect! 🤩
|
||||
<ScribbleArrow className="absolute text-slate-400 -right-8 top-3" />
|
||||
</motion.div>
|
||||
<motion.div
|
||||
className="shadow-lg rounded-lg"
|
||||
transition={{ type: "spring", delay: 0.5 }}
|
||||
initial={{ opacity: 0, translateY: -100 }}
|
||||
animate={{ opacity: 1, translateY: 0 }}
|
||||
>
|
||||
<PollDemo />
|
||||
</motion.div>
|
||||
</div>
|
||||
</UserAvatarProvider>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Hero;
|
25
components/home/home.tsx
Normal file
|
@ -0,0 +1,25 @@
|
|||
import Head from "next/head";
|
||||
import React from "react";
|
||||
import PageLayout from "../page-layout";
|
||||
import Bonus from "./bonus";
|
||||
import Features from "./features";
|
||||
import Hero from "./hero";
|
||||
|
||||
const Home: React.VoidFunctionComponent = () => {
|
||||
return (
|
||||
<PageLayout>
|
||||
<Head>
|
||||
<title>Rallly - Schedule group meetings</title>
|
||||
</Head>
|
||||
<Hero />
|
||||
<div className="bg-gradient-to-b from-transparent via-white to-white">
|
||||
<Features />
|
||||
</div>
|
||||
<div className="bg-gradient-to-b from-white via-white to-transparent pb-16">
|
||||
<Bonus />
|
||||
</div>
|
||||
</PageLayout>
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
36
components/home/how-it-works.tsx
Normal file
|
@ -0,0 +1,36 @@
|
|||
import * as React from "react";
|
||||
|
||||
const HowItWorks: React.VoidFunctionComponent = () => {
|
||||
return (
|
||||
<div className="bg-gradient-to-b from-transparent via-white to-white">
|
||||
<div className="py-16 px-8 mx-auto max-w-7xl">
|
||||
<h2 className="heading text-center">How it works</h2>
|
||||
<p className="subheading text-center">It's simple!</p>
|
||||
<div className="grid grid-cols-3 gap-16">
|
||||
<div className="col-span-1">
|
||||
<h3 className="text-xl">Create a poll</h3>
|
||||
<p className="text">
|
||||
Choose options you would like your participants to choose from.
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-span-1">
|
||||
<h3 className="text-xl">Share your link</h3>
|
||||
<p className="text">
|
||||
Share your unique link with your participants to give them access
|
||||
to the page.
|
||||
</p>
|
||||
</div>
|
||||
<div className="col-span-1">
|
||||
<h3 className="text-xl">Vote</h3>
|
||||
<p className="text">
|
||||
Participants vote for the dates they prefer. The option with the
|
||||
most votes wins!
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default HowItWorks;
|
1
components/home/index.ts
Normal file
|
@ -0,0 +1 @@
|
|||
export { default } from './home';
|
121
components/home/poll-demo.tsx
Normal file
|
@ -0,0 +1,121 @@
|
|||
import { format } from "date-fns";
|
||||
import { useTranslation } from "next-i18next";
|
||||
import * as React from "react";
|
||||
import { useTimeoutFn } from "react-use";
|
||||
import DateCard from "../date-card";
|
||||
import Score from "../poll/score";
|
||||
import UserAvater from "../poll/user-avatar";
|
||||
import VoteIcon from "../poll/vote-icon";
|
||||
|
||||
const sidebarWidth = 180;
|
||||
const participants = [
|
||||
{
|
||||
name: "Reed",
|
||||
color: "bg-sky-400",
|
||||
votes: [0, 2],
|
||||
},
|
||||
{
|
||||
name: "Susan",
|
||||
color: "bg-blue-400",
|
||||
votes: [0, 1, 2],
|
||||
},
|
||||
{
|
||||
name: "Johnny",
|
||||
color: "bg-indigo-400",
|
||||
votes: [2, 3],
|
||||
},
|
||||
{
|
||||
name: "Ben",
|
||||
color: "bg-purple-400",
|
||||
votes: [0, 1, 2, 3],
|
||||
},
|
||||
];
|
||||
|
||||
const options = ["2022-12-14", "2022-12-15", "2022-12-16", "2022-12-17"];
|
||||
|
||||
const PollDemo: React.VoidFunctionComponent = () => {
|
||||
const { t } = useTranslation("app");
|
||||
const [bestOption, setBestOption] = React.useState<number>();
|
||||
useTimeoutFn(() => {
|
||||
setBestOption(2);
|
||||
}, 1500);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="rounded-lg bg-white border shadow-md"
|
||||
style={{ width: 600 }}
|
||||
>
|
||||
<div className="flex border-b shadow-sm">
|
||||
<div
|
||||
className="flex items-center pl-4 pr-2 py-4 shrink-0 font-medium"
|
||||
style={{ width: sidebarWidth }}
|
||||
>
|
||||
<div className="grow h-full flex items-end">
|
||||
{t("participantCount", { count: participants.length })}
|
||||
</div>
|
||||
</div>
|
||||
{options.map((option, i) => {
|
||||
const d = new Date(option);
|
||||
let score = 0;
|
||||
participants.forEach((participant) => {
|
||||
if (participant.votes.includes(i)) {
|
||||
score++;
|
||||
}
|
||||
});
|
||||
return (
|
||||
<div
|
||||
key={i}
|
||||
className="py-4 text-center shrink-0 transition-colors"
|
||||
style={{ width: 100 }}
|
||||
>
|
||||
<DateCard
|
||||
day={format(d, "dd")}
|
||||
dow={format(d, "E")}
|
||||
month={format(d, "MMM")}
|
||||
annotation={
|
||||
<Score count={score} highlight={i === bestOption} />
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{participants.map((participant, i) => (
|
||||
<div className="flex h-14" key={i}>
|
||||
<div
|
||||
className="flex items-center px-4 shrink-0"
|
||||
style={{ width: sidebarWidth }}
|
||||
>
|
||||
<UserAvater
|
||||
className="mr-2"
|
||||
color={participant.color}
|
||||
name={participant.name}
|
||||
/>
|
||||
<span className="truncate" title={participant.name}>
|
||||
{participant.name}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex">
|
||||
{options.map((_, i) => {
|
||||
return (
|
||||
<div
|
||||
key={i}
|
||||
className="justify-center items-center flex shrink-0"
|
||||
style={{ width: 100 }}
|
||||
>
|
||||
{participant.votes.some((vote) => vote === i) ? (
|
||||
<VoteIcon type="yes" />
|
||||
) : (
|
||||
<VoteIcon type="no" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default PollDemo;
|
3
components/home/scribble-arrow.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" viewBox="0 0 30 30">
|
||||
<path fill-rule="evenodd" d="M1.11 2.994h.001l.014-.002a17.546 17.546 0 011.383-.055c.902 0 2.175.06 3.643.3 2.944.48 6.612 1.674 9.67 4.498 1.464 1.35 2.55 3.281 3.339 5.492.787 2.204 1.259 4.626 1.535 6.894.27 2.224.35 4.275.36 5.788l-4.245-4.83a1 1 0 10-1.502 1.32l5.94 6.761a1 1 0 001.412.091l6.76-5.94a1 1 0 10-1.32-1.503l-5.045 4.433v-.262a53.57 53.57 0 00-.375-6.1c-.287-2.357-.783-4.935-1.637-7.325-.85-2.383-2.078-4.64-3.865-6.289-3.44-3.176-7.523-4.483-10.704-5.002A24.842 24.842 0 002.508.938a19.54 19.54 0 00-1.492.056 7.207 7.207 0 00-.089.008l-.025.003H.89v.001L1 2l-.11-.994a1 1 0 00.22 1.988" clip-rule="evenodd"/>
|
||||
</svg>
|
After Width: | Height: | Size: 744 B |
30
components/home/stats.tsx
Normal file
|
@ -0,0 +1,30 @@
|
|||
import Link from "next/link";
|
||||
import * as React from "react";
|
||||
import { useTranslation } from "next-i18next";
|
||||
|
||||
const Stats: React.VoidFunctionComponent = () => {
|
||||
const { t } = useTranslation("homepage");
|
||||
return (
|
||||
<div className="py-16">
|
||||
<h2 className="heading text-center">Stats</h2>
|
||||
<p className="subheading text-center">100,000+ polls created</p>
|
||||
<div className="flex space-x-3 justify-center">
|
||||
<Link href="/new">
|
||||
<a className="focus:ring-2 focus:ring-indigo-200 transition-all text-white bg-indigo-500 hover:bg-indigo-500/90 active:bg-indigo-600/90 px-5 py-3 font-semibold hover:text-white hover:no-underline shadow-sm hover:shadow-md rounded-lg">
|
||||
{t("getStarted")}
|
||||
</a>
|
||||
</Link>
|
||||
<Link href="/demo">
|
||||
<a
|
||||
className="text-white focus:ring-2 focus:ring-indigo-200 transition-all bg-slate-500 hover:bg-slate-500/90 active:bg-slate-600/90 px-5 py-3 font-semibold hover:text-white hover:no-underline shadow-sm hover:shadow-md rounded-lg"
|
||||
rel="nofollow"
|
||||
>
|
||||
{t("viewDemo")}
|
||||
</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Stats;
|
3
components/icons/annotation.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M18 13V5a2 2 0 00-2-2H4a2 2 0 00-2 2v8a2 2 0 002 2h3l3 3 3-3h3a2 2 0 002-2zM5 7a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1zm1 3a1 1 0 100 2h3a1 1 0 100-2H6z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 313 B |
3
components/icons/arrow-left.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M9.707 16.707a1 1 0 01-1.414 0l-6-6a1 1 0 010-1.414l6-6a1 1 0 011.414 1.414L5.414 9H17a1 1 0 110 2H5.414l4.293 4.293a1 1 0 010 1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 292 B |
3
components/icons/arrow-right.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 295 B |
3
components/icons/ban.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636" />
|
||||
</svg>
|
After Width: | Height: | Size: 291 B |
4
components/icons/bell-crossed.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path fill-rule="evenodd" d="M17.613 15.538a1.188 1.188 0 01-1.673.155L2.996 4.933a1.188 1.188 0 111.519-1.827l12.944 10.759c.505.42.574 1.169.154 1.673z" clip-rule="evenodd"/>
|
||||
<path d="M16 11.202V8a6 6 0 00-9.614-4.79L16 11.203zM4.046 7.256A6 6 0 004 8v3.586l-.707.707A1 1 0 004 14h8.16L4.045 7.256zM7.878 17.121A3 3 0 0013 15H7a3 3 0 00.878 2.121z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 468 B |
4
components/icons/bell.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
||||
<path d="M10 2a6 6 0 00-6 6v3.586l-.707.707A1 1 0 004 14h12a1 1 0 00.707-1.707L16 11.586V8a6 6 0 00-6-6zm0 16a3 3 0 01-3-3h6a3 3 0 01-3 3z" />
|
||||
<path fill-rule="evenodd" d="M1.845 8.877c-.552.009-1.012-.434-.973-.985.22-3.078 1.666-5.148 2.891-6.215.417-.363 1.03-.198 1.305.281.274.48.11 1.102-.277 1.496-.778.795-1.712 2.244-1.91 4.408-.05.55-.484 1.006-1.036 1.015zM18.069 8.553c.552-.007.999-.462.944-1.012-.308-3.07-1.811-5.098-3.067-6.13-.426-.351-1.035-.168-1.296.319-.26.486-.078 1.103.32 1.487.8.772 1.775 2.194 2.034 4.351.066.548.512.992 1.064.985z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 674 B |
3
components/icons/calendar.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||
</svg>
|
After Width: | Height: | Size: 283 B |
3
components/icons/chat.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M17 8h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4l-4-4H9a1.994 1.994 0 01-1.414-.586m0 0L11 14h4a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2v4l.586-.586z" />
|
||||
</svg>
|
After Width: | Height: | Size: 354 B |
3
components/icons/check-circle.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 292 B |
3
components/icons/check.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 273 B |
3
components/icons/chevron-down.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 273 B |
3
components/icons/chevron-left.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fillRule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clipRule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 274 B |
3
components/icons/chevron-right.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 273 B |
3
components/icons/clock.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
After Width: | Height: | Size: 240 B |
3
components/icons/code.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4" />
|
||||
</svg>
|
After Width: | Height: | Size: 234 B |
3
components/icons/cog.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 667 B |
3
components/icons/cursor-click.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122" />
|
||||
</svg>
|
After Width: | Height: | Size: 326 B |
3
components/icons/device-mobile.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z" />
|
||||
</svg>
|
After Width: | Height: | Size: 272 B |
3
components/icons/document-search.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M10 21h7a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v11m0 5l4.879-4.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242z" />
|
||||
</svg>
|
After Width: | Height: | Size: 352 B |
3
components/icons/dots-horizontal.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z" />
|
||||
</svg>
|
After Width: | Height: | Size: 213 B |
3
components/icons/dots-vertical.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" />
|
||||
</svg>
|
After Width: | Height: | Size: 215 B |
4
components/icons/duplicate.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M7 9a2 2 0 012-2h6a2 2 0 012 2v6a2 2 0 01-2 2H9a2 2 0 01-2-2V9z" />
|
||||
<path d="M5 3a2 2 0 00-2 2v6a2 2 0 002 2V5h8a2 2 0 00-2-2H5z" />
|
||||
</svg>
|
After Width: | Height: | Size: 249 B |
3
components/icons/emoji-sad.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
After Width: | Height: | Size: 279 B |
3
components/icons/exclamation.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 272 B |
3
components/icons/graph1.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M2 11a1 1 0 011-1h2a1 1 0 011 1v5a1 1 0 01-1 1H3a1 1 0 01-1-1v-5zM8 7a1 1 0 011-1h2a1 1 0 011 1v9a1 1 0 01-1 1H9a1 1 0 01-1-1V7zM14 4a1 1 0 011-1h2a1 1 0 011 1v12a1 1 0 01-1 1h-2a1 1 0 01-1-1V4z" />
|
||||
</svg>
|
After Width: | Height: | Size: 313 B |
3
components/icons/hand.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M7 11.5V14m0-2.5v-6a1.5 1.5 0 113 0m-3 6a1.5 1.5 0 00-3 0v2a7.5 7.5 0 0015 0v-5a1.5 1.5 0 00-3 0m-6-3V11m0-5.5v-1a1.5 1.5 0 013 0v1m0 0V11m0-5.5a1.5 1.5 0 013 0v3m0 0V11" />
|
||||
</svg>
|
After Width: | Height: | Size: 366 B |
3
components/icons/home.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
|
||||
</svg>
|
After Width: | Height: | Size: 341 B |
3
components/icons/location-marker.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fillRule="evenodd" d="M5.05 4.05a7 7 0 119.9 9.9L10 18.9l-4.95-4.95a7 7 0 010-9.9zM10 11a2 2 0 100-4 2 2 0 000 4z" clipRule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 252 B |
3
components/icons/lock-closed.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
|
||||
</svg>
|
After Width: | Height: | Size: 297 B |
3
components/icons/lock-open.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z" />
|
||||
</svg>
|
After Width: | Height: | Size: 289 B |
3
components/icons/magic.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
|
||||
</svg>
|
After Width: | Height: | Size: 301 B |
3
components/icons/newspaper.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h10a2 2 0 012 2v1m2 13a2 2 0 01-2-2V7m2 13a2 2 0 002-2V9a2 2 0 00-2-2h-2m-4-3H9M7 16h6M7 8h6v4H7V8z" />
|
||||
</svg>
|
After Width: | Height: | Size: 331 B |
3
components/icons/pencil-alt.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z" />
|
||||
</svg>
|
After Width: | Height: | Size: 293 B |
4
components/icons/pencil.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z" />
|
||||
<path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 338 B |
3
components/icons/plus-circle.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm1-11a1 1 0 10-2 0v2H7a1 1 0 100 2h2v2a1 1 0 102 0v-2h2a1 1 0 100-2h-2V7z" clip-rule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 265 B |
3
components/icons/plus-sm.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path fillRule="evenodd" d="M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z" clipRule="evenodd" />
|
||||
</svg>
|
After Width: | Height: | Size: 246 B |
3
components/icons/save.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" />
|
||||
</svg>
|
After Width: | Height: | Size: 288 B |
3
components/icons/server.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01" />
|
||||
</svg>
|
After Width: | Height: | Size: 349 B |
3
components/icons/share.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||
<path d="M15 8a3 3 0 10-2.977-2.63l-4.94 2.47a3 3 0 100 4.319l4.94 2.47a3 3 0 10.895-1.789l-4.94-2.47a3.027 3.027 0 000-.74l4.94-2.47C13.456 7.68 14.19 8 15 8z" />
|
||||
</svg>
|
After Width: | Height: | Size: 269 B |
3
components/icons/smile.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
</svg>
|
After Width: | Height: | Size: 281 B |
3
components/icons/speakerphone.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M11 5.882V19.24a1.76 1.76 0 01-3.417.592l-2.147-6.15M18 13a3 3 0 100-6M5.436 13.683A4.001 4.001 0 017 6h1.832c4.1 0 7.625-1.234 9.168-3v14c-1.543-1.766-5.067-3-9.168-3H7a3.988 3.988 0 01-1.564-.317z" />
|
||||
</svg>
|
After Width: | Height: | Size: 395 B |
4
components/icons/spinner.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
||||
<circle opacity="0.25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
||||
<path fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
||||
</svg>
|
After Width: | Height: | Size: 328 B |
3
components/icons/support.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M18.364 5.636l-3.536 3.536m0 5.656l3.536 3.536M9.172 9.172L5.636 5.636m3.536 9.192l-3.536 3.536M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-5 0a4 4 0 11-8 0 4 4 0 018 0z" />
|
||||
</svg>
|
After Width: | Height: | Size: 357 B |
3
components/icons/table.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" />
|
||||
</svg>
|
After Width: | Height: | Size: 285 B |
3
components/icons/trash.svg
Normal file
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
|
||||
</svg>
|
After Width: | Height: | Size: 321 B |