I don't know tbh
Signed-off-by: Filipe Medeiros <hello@filipesm.eu>
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"extends": "next/core-web-vitals"
|
||||
}
|
36
.gitignore
vendored
|
@ -1,36 +0,0 @@
|
|||
# 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*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
22
.prettierrc
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"semi": false,
|
||||
|
||||
"plugins": [
|
||||
"@trivago/prettier-plugin-sort-imports",
|
||||
"prettier-plugin-tailwindcss"
|
||||
],
|
||||
"pluginSearchDirs": false,
|
||||
|
||||
"importOrder": [
|
||||
"<THIRD_PARTY_MODULES>",
|
||||
"^@/",
|
||||
"^(./)",
|
||||
"(.*).(css|.min.js)",
|
||||
"(.*).(jpeg|jpg|png|webp|gif)"
|
||||
],
|
||||
"importOrderSeparation": true,
|
||||
"importOrderSortSpecifiers": true
|
||||
}
|
4
.vscode/settings.json
vendored
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"typescript.tsdk": "node_modules/.pnpm/typescript@4.9.4/node_modules/typescript/lib",
|
||||
"typescript.enablePromptUseWorkspaceTsdk": true
|
||||
}
|
674
LICENSE
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
34
README.md
|
@ -1,34 +0,0 @@
|
|||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
||||
|
||||
[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`.
|
||||
|
||||
The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
@ -1,52 +0,0 @@
|
|||
import { notFound } from 'next/navigation'
|
||||
|
||||
import CommonHead from '@/components/server/CommonHead'
|
||||
import { getBlogPostBySlug } from '@/lib/notion/content/blogPosts'
|
||||
import getProxiedAssetUrl from '@/lib/notion/utils/getProxiedAssetUrl'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
export default async function Head({
|
||||
params: { slug },
|
||||
}: {
|
||||
params: { slug: string }
|
||||
}) {
|
||||
const blogPost = await getBlogPostBySlug({ slug })
|
||||
|
||||
if (!blogPost) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const title = `${richTextAsPlainText(
|
||||
blogPost.properties.Name.title,
|
||||
)} - Filipe Medeiros`
|
||||
const description = richTextAsPlainText(
|
||||
blogPost.properties.MetaDescription.rich_text,
|
||||
)
|
||||
|
||||
return (
|
||||
<>
|
||||
<CommonHead />
|
||||
<title>{title}</title>
|
||||
<meta name="description" content={description} />
|
||||
<meta
|
||||
name="og:image"
|
||||
content={`https://filipesm.eu${getProxiedAssetUrl({
|
||||
pageId: blogPost.id,
|
||||
lastEditedTime: blogPost.last_edited_time,
|
||||
})}`}
|
||||
/>
|
||||
<link rel="canonical" href={`https://filipesm.eu/blog/${slug}`} />
|
||||
<meta
|
||||
name="twitter:card"
|
||||
content={
|
||||
blogPost.properties.MetaTwitterCard.select?.name ??
|
||||
'summary_large_image'
|
||||
}
|
||||
/>
|
||||
<meta property="og:url" content={`https://filipesm.eu/blog/${slug}`} />
|
||||
<meta property="og:title" content={title} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:type" content="article" />
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
import Image from 'next/image'
|
||||
import { notFound } from 'next/navigation'
|
||||
|
||||
import BackButton from '@/components/client/BackButton'
|
||||
import Container from '@/components/server/Container'
|
||||
import { Prose } from '@/components/server/Prose'
|
||||
import Tag from '@/components/server/Tag'
|
||||
import { RenderBlockList } from '@/components/server/renderNotionContent'
|
||||
import formatDate from '@/lib/formatDate'
|
||||
import generateRssFeed from '@/lib/generateRssFeed'
|
||||
import {
|
||||
getBlogPostBySlug,
|
||||
getFirstBlogPosts,
|
||||
} from '@/lib/notion/content/blogPosts'
|
||||
import getBlockRecursively from '@/lib/notion/utils/getBlockRecursively'
|
||||
import getProxiedAssetUrl from '@/lib/notion/utils/getProxiedAssetUrl'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
export const revalidate = 600
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const rssPromise = generateRssFeed()
|
||||
|
||||
const blogPosts = await getFirstBlogPosts()
|
||||
|
||||
const paths = blogPosts.results
|
||||
.filter(({ properties: { Slug } }) => Slug.rich_text.length === 0)
|
||||
.map(({ properties: { Slug } }) => ({
|
||||
slug: richTextAsPlainText(Slug.rich_text),
|
||||
}))
|
||||
|
||||
await rssPromise
|
||||
|
||||
return paths
|
||||
}
|
||||
|
||||
export default async function BlogPost({
|
||||
params,
|
||||
}: {
|
||||
params: { slug: string }
|
||||
}) {
|
||||
const blogPost = await getBlogPostBySlug({ slug: params.slug })
|
||||
|
||||
if (!blogPost) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
const publishDate =
|
||||
blogPost.properties.PublishDate.date?.start ?? blogPost.last_edited_time
|
||||
|
||||
const content = await getBlockRecursively(blogPost.id)
|
||||
|
||||
return (
|
||||
<Container className="mt-16 lg:mt-32">
|
||||
<div className="xl:relative">
|
||||
<div className="mx-auto max-w-2xl">
|
||||
<BackButton />
|
||||
<article>
|
||||
<header className="flex flex-col gap-5">
|
||||
<h1 className="text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 sm:text-5xl">
|
||||
{richTextAsPlainText(blogPost.properties.Name.title)}
|
||||
</h1>
|
||||
<div className="z-10 mt-2 flex gap-1 text-sm">
|
||||
{blogPost.properties.Topics.multi_select.map((topic) => (
|
||||
<Tag key={topic.name} notionColorName={topic.color}>
|
||||
{topic.name}
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
<Image
|
||||
src={getProxiedAssetUrl({
|
||||
pageId: blogPost.id,
|
||||
lastEditedTime: blogPost.last_edited_time,
|
||||
})}
|
||||
alt=""
|
||||
width="9999"
|
||||
height="9999"
|
||||
className="aspect-[6/3] rounded-t-lg object-cover"
|
||||
/>
|
||||
<time
|
||||
dateTime={publishDate}
|
||||
className="flex items-center text-base text-zinc-400 dark:text-zinc-500"
|
||||
>
|
||||
<span className="h-4 w-0.5 rounded-full bg-zinc-200 dark:bg-zinc-500" />
|
||||
<span className="ml-3">{formatDate(publishDate)}</span>
|
||||
</time>
|
||||
</header>
|
||||
<Prose className="mt-8 dark:text-white">
|
||||
<RenderBlockList blockList={content} />
|
||||
</Prose>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
import CommonHead from '@/components/server/CommonHead'
|
||||
|
||||
export default function Head() {
|
||||
return (
|
||||
<>
|
||||
<CommonHead />
|
||||
<title>Blog - Filipe Medeiros</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Todos os meus pensamentos que são demasiado grandes para meter num toot e demasiado curtos para escrever um livro."
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
import Card, {
|
||||
CardCta,
|
||||
CardDescription,
|
||||
CardEyebrow,
|
||||
CardTags,
|
||||
CardTitle,
|
||||
} from '@/components/server/Card'
|
||||
import SimpleLayout from '@/components/server/SimpleLayout'
|
||||
import Tag from '@/components/server/Tag'
|
||||
import formatDate from '@/lib/formatDate'
|
||||
import { getFirstBlogPosts } from '@/lib/notion/content/blogPosts'
|
||||
import { SelectColor } from '@/lib/notion/types'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
export const revalidate = 600
|
||||
|
||||
function BlogPost({
|
||||
slug,
|
||||
title,
|
||||
description,
|
||||
publishDate,
|
||||
topics,
|
||||
}: {
|
||||
slug: string
|
||||
title: string
|
||||
description: string
|
||||
publishDate: string
|
||||
topics: { name: string; color: SelectColor }[]
|
||||
}) {
|
||||
return (
|
||||
<article className="md:grid md:grid-cols-4 md:items-baseline">
|
||||
<Card className="md:col-span-3">
|
||||
<CardTitle href={`/blog/${slug}`}>{title}</CardTitle>
|
||||
<CardEyebrow
|
||||
as="time"
|
||||
dateTime={publishDate}
|
||||
className="relative z-10 order-first mb-3 flex items-center pl-3.5 text-sm text-zinc-400 dark:text-zinc-500 md:hidden"
|
||||
decorate
|
||||
>
|
||||
{formatDate(publishDate)}
|
||||
</CardEyebrow>
|
||||
<CardDescription>{description}</CardDescription>
|
||||
<CardTags>
|
||||
{topics.map((topic) => (
|
||||
<Tag notionColorName={topic.color} key={topic.name}>
|
||||
{topic.name}
|
||||
</Tag>
|
||||
))}
|
||||
</CardTags>
|
||||
<CardCta>Lê o artigo</CardCta>
|
||||
</Card>
|
||||
<CardEyebrow
|
||||
as="time"
|
||||
dateTime={publishDate}
|
||||
className="relative z-10 order-first mt-1 mb-3 items-center text-sm text-zinc-400 dark:text-zinc-500 max-md:hidden md:block"
|
||||
>
|
||||
{formatDate(publishDate)}
|
||||
</CardEyebrow>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
|
||||
export default async function Blog() {
|
||||
const { results: blogPosts } = await getFirstBlogPosts()
|
||||
|
||||
return (
|
||||
<SimpleLayout
|
||||
title="Os meus artigos"
|
||||
intro="Todos os meus pensamentos que são demasiado grandes para meter num toot e demasiado curtos para escrever um livro. Por ordem cronológica."
|
||||
>
|
||||
<div className="md:border-l md:border-zinc-100 md:pl-6 md:dark:border-zinc-700/40">
|
||||
<div className="flex max-w-3xl flex-col space-y-16">
|
||||
{blogPosts.map((blogPost) => (
|
||||
<BlogPost
|
||||
key={richTextAsPlainText(blogPost.properties.Slug.rich_text)}
|
||||
title={richTextAsPlainText(blogPost.properties.Name.title)}
|
||||
description={richTextAsPlainText(
|
||||
blogPost.properties.Description.rich_text,
|
||||
)}
|
||||
topics={blogPost.properties.Topics.multi_select.map(
|
||||
({ name, color }) => ({ name, color }),
|
||||
)}
|
||||
slug={richTextAsPlainText(blogPost.properties.Slug.rich_text)}
|
||||
publishDate={richTextAsPlainText(
|
||||
blogPost.properties.PublishDate.date?.start ??
|
||||
blogPost.created_time,
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</SimpleLayout>
|
||||
)
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
@import 'tailwindcss/base';
|
||||
@import 'tailwindcss/components';
|
||||
@import 'tailwindcss/utilities';
|
27
app/head.tsx
|
@ -1,27 +0,0 @@
|
|||
import CommonHead from '@/components/server/CommonHead'
|
||||
|
||||
export default function Head() {
|
||||
return (
|
||||
<>
|
||||
<CommonHead />
|
||||
<title>Filipe Medeiros - O meu espaço na internet</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="O meu site pessoal, onde podes ler artigos que escrevo e saber mais sobre mim."
|
||||
/>
|
||||
<meta name="og:image" content="https://filipesm.eu/me.jpeg" />
|
||||
<link rel="canonical" href="https://filipesm.eu" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta property="og:url" content="https://filipesm.eu" />
|
||||
<meta
|
||||
property="og:title"
|
||||
content="Filipe Medeiros - O meu espaço na internet"
|
||||
/>
|
||||
<meta
|
||||
property="og:description"
|
||||
content="O meu site pessoal, onde podes ler artigos que escrevo e saber mais sobre mim."
|
||||
/>
|
||||
<meta property="og:type" content="site" />
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
import { PropsWithChildren } from 'react'
|
||||
|
||||
import Header from '@/components/client/Header'
|
||||
import Footer from '@/components/server/Footer'
|
||||
import colorMap from '@/lib/notion/utils/colorMap'
|
||||
|
||||
import './globals.css'
|
||||
|
||||
const notionColorsCssVars = Object.entries(colorMap)
|
||||
.map(([name, colors]) =>
|
||||
[
|
||||
`--notion-${name}-dark-text:${colors.dark.text};`,
|
||||
`--notion-${name}-dark-bg:${colors.dark.bg};`,
|
||||
`--notion-${name}-light-text:${colors.light.text};`,
|
||||
`--notion-${name}-light-bg:${colors.light.bg};`,
|
||||
].join(''),
|
||||
)
|
||||
.join('')
|
||||
|
||||
const notionEachColorClass = Object.entries(colorMap)
|
||||
.map(
|
||||
([name]) =>
|
||||
`.notion-color-${name}{--dark-text:var(--notion-${name}-dark-text);--dark-bg:var(--notion-${name}-dark-bg);--light-text:var(--notion-${name}-light-text);--light-bg:var(--notion-${name}-light-bg);}`,
|
||||
)
|
||||
.join('')
|
||||
|
||||
export default function BaseLayout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<html className="h-full antialiased" lang="pt-PT">
|
||||
<head>
|
||||
<style
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `:root{${notionColorsCssVars}} ${notionEachColorClass}`,
|
||||
}}
|
||||
/>
|
||||
</head>
|
||||
<body className="flex h-full flex-col bg-zinc-50 font-serif dark:bg-black">
|
||||
<div className="fixed inset-0 flex justify-center sm:px-8">
|
||||
<div className="flex w-full max-w-7xl lg:px-8">
|
||||
<div className="w-full bg-white ring-1 ring-zinc-100 dark:bg-zinc-900 dark:ring-zinc-300/20" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="relative">
|
||||
<Header />
|
||||
<main>{children}</main>
|
||||
<Footer />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
355
app/page.tsx
|
@ -1,355 +0,0 @@
|
|||
import Image, { ImageProps } from 'next/image'
|
||||
import { type ElementType } from 'react'
|
||||
|
||||
import Button from '@/components/client/Button'
|
||||
import Card, {
|
||||
CardCta,
|
||||
CardDescription,
|
||||
CardEyebrow,
|
||||
CardTags,
|
||||
CardTitle,
|
||||
} from '@/components/server/Card'
|
||||
import Container from '@/components/server/Container'
|
||||
import HybridLink, {
|
||||
type Props as HybridLinkProps,
|
||||
} from '@/components/server/HybridLink'
|
||||
import Tag from '@/components/server/Tag'
|
||||
import {
|
||||
CodebergIcon,
|
||||
GitHubIcon,
|
||||
type IconProps,
|
||||
MastodonLogo,
|
||||
RSSIcon,
|
||||
} from '@/components/server/icons'
|
||||
import EmmaLogo from '@/images/logos/emma.jpeg'
|
||||
import FarfetchLogo from '@/images/logos/farfetch.png'
|
||||
import ThreeSigmaLogo from '@/images/logos/threeSigma.png'
|
||||
import formatDate from '@/lib/formatDate'
|
||||
import { getFirstBlogPosts } from '@/lib/notion/content/blogPosts'
|
||||
import { SelectColor } from '@/lib/notion/types'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
function BriefcaseIcon(props: IconProps) {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M2.75 9.75a3 3 0 0 1 3-3h12.5a3 3 0 0 1 3 3v8.5a3 3 0 0 1-3 3H5.75a3 3 0 0 1-3-3v-8.5Z"
|
||||
className="stroke-current"
|
||||
/>
|
||||
<path
|
||||
d="M3 14.25h6.249c.484 0 .952-.002 1.316.319l.777.682a.996.996 0 0 0 1.316 0l.777-.682c.364-.32.832-.319 1.316-.319H21M8.75 6.5V4.75a2 2 0 0 1 2-2h2.5a2 2 0 0 1 2 2V6.5"
|
||||
className="stroke-current"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
function ArrowDownIcon(props: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="M4.75 8.75 8 12.25m0 0 3.25-3.5M8 12.25v-8.5"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
function BlogPost({
|
||||
slug,
|
||||
title,
|
||||
description,
|
||||
publishDate,
|
||||
topics,
|
||||
}: {
|
||||
slug: string
|
||||
title: string
|
||||
description: string
|
||||
publishDate: string
|
||||
|
||||
topics: { name: string; color: SelectColor }[]
|
||||
}) {
|
||||
return (
|
||||
<Card as="article">
|
||||
<CardTitle href={`/blog/${slug}`}>{title}</CardTitle>
|
||||
<CardEyebrow as="time" dateTime={publishDate} decorate>
|
||||
{formatDate(publishDate)}
|
||||
</CardEyebrow>
|
||||
<CardDescription>{description}</CardDescription>
|
||||
<CardTags>
|
||||
{topics.map((topic) => (
|
||||
<Tag notionColorName={topic.color} key={topic.name}>
|
||||
{topic.name}
|
||||
</Tag>
|
||||
))}
|
||||
</CardTags>
|
||||
<CardCta>Lê o artigo</CardCta>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
function SocialLink({
|
||||
icon: Icon,
|
||||
...props
|
||||
}: HybridLinkProps & { icon: ElementType }) {
|
||||
return (
|
||||
<HybridLink className="group -m-1 p-1" {...props}>
|
||||
<Icon className="h-6 w-6 fill-zinc-500 transition group-hover:fill-zinc-600 dark:fill-zinc-400 dark:group-hover:fill-zinc-300" />
|
||||
</HybridLink>
|
||||
)
|
||||
}
|
||||
|
||||
function StayUpToDate() {
|
||||
return (
|
||||
<div className="rounded-2xl border border-zinc-100 p-6 dark:border-zinc-700/40">
|
||||
<h2 className="flex text-sm font-semibold text-zinc-900 dark:text-zinc-100">
|
||||
<RSSIcon className="h-6 w-6 flex-none text-teal-500" />
|
||||
<span className="ml-3">Mantém-te atualizade</span>
|
||||
</h2>
|
||||
<p className="mt-2 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
Subscreve o <i>feed</i> de RSS{' '}
|
||||
<span className="group/rsspopover relative">
|
||||
<span className="pointer-events-none absolute top-0 left-1/2 w-64 -translate-x-1/2 -translate-y-full rounded border px-3 py-2 opacity-0 backdrop-blur transition-all after:absolute after:left-0 after:top-full after:h-4 after:w-full group-hover/rsspopover:pointer-events-auto group-hover/rsspopover:-top-2 group-hover/rsspopover:opacity-100 dark:border-zinc-700/40 dark:text-white">
|
||||
Vais precisar de um leitor de RSS! Pessoalmente, recomendo o{' '}
|
||||
<HybridLink
|
||||
className="underline transition hover:text-teal-500"
|
||||
href="https://hyliu.me/fluent-reader-lite/"
|
||||
>
|
||||
Fluent Reader
|
||||
</HybridLink>{' '}
|
||||
ou o{' '}
|
||||
<HybridLink
|
||||
className="underline transition hover:text-teal-500"
|
||||
href="https://feedly.com"
|
||||
>
|
||||
Feedly
|
||||
</HybridLink>{' '}
|
||||
:)
|
||||
</span>
|
||||
<HybridLink
|
||||
className="underline transition hover:text-teal-500"
|
||||
href={`${process.env.NEXT_PUBLIC_SITE_URL}/rss/feed.xml`}
|
||||
>
|
||||
aqui
|
||||
</HybridLink>
|
||||
</span>
|
||||
!
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function Resume() {
|
||||
const resume: {
|
||||
company: string
|
||||
title: string
|
||||
logo: ImageProps['src']
|
||||
start:
|
||||
| {
|
||||
label: string
|
||||
dateTime: string
|
||||
}
|
||||
| string
|
||||
end:
|
||||
| {
|
||||
label: string
|
||||
dateTime: string
|
||||
}
|
||||
| string
|
||||
}[] = [
|
||||
{
|
||||
company: 'Farfetch',
|
||||
title: 'Junior Frontend Software Eng.',
|
||||
start: '2020',
|
||||
end: '2021',
|
||||
logo: FarfetchLogo,
|
||||
},
|
||||
{
|
||||
company: 'Emma - The Sleep Company',
|
||||
title: 'Frontend Software Eng.',
|
||||
start: '2022',
|
||||
end: '2022',
|
||||
logo: EmmaLogo,
|
||||
},
|
||||
{
|
||||
company: 'Three Sigma',
|
||||
title: 'Frontend Software Eng.',
|
||||
start: '2022',
|
||||
end: 'Present',
|
||||
logo: ThreeSigmaLogo,
|
||||
},
|
||||
]
|
||||
|
||||
return (
|
||||
<div className="rounded-2xl border border-zinc-100 p-6 dark:border-zinc-700/40">
|
||||
<h2 className="flex text-sm font-semibold text-zinc-900 dark:text-zinc-100">
|
||||
<BriefcaseIcon className="h-6 w-6 flex-none text-teal-500" />
|
||||
<span className="ml-3">Trabalho</span>
|
||||
</h2>
|
||||
<ol className="mt-6 space-y-4">
|
||||
{resume.map((role, roleIndex) => (
|
||||
<li key={roleIndex} className="flex gap-4">
|
||||
<Image
|
||||
src={role.logo}
|
||||
alt=""
|
||||
className="h-10 w-10 rounded bg-teal-500 p-1 dark:bg-transparent"
|
||||
/>
|
||||
<dl className="flex flex-auto flex-wrap gap-x-2">
|
||||
<dt className="sr-only">Company</dt>
|
||||
<dd className="w-full flex-none text-sm font-medium text-zinc-900 dark:text-zinc-100">
|
||||
{role.company}
|
||||
</dd>
|
||||
<dt className="sr-only">Role</dt>
|
||||
<dd className="text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{role.title}
|
||||
</dd>
|
||||
<dt className="sr-only">Date</dt>
|
||||
<dd
|
||||
className="ml-auto text-xs text-zinc-400 dark:text-zinc-500"
|
||||
aria-label={`${
|
||||
typeof role.start === 'string' ? role.start : role.start.label
|
||||
} until ${
|
||||
typeof role.end === 'string' ? role.end : role.end.label
|
||||
}`}
|
||||
>
|
||||
<time
|
||||
dateTime={
|
||||
typeof role.start === 'string'
|
||||
? role.start
|
||||
: role.start.dateTime
|
||||
}
|
||||
>
|
||||
{typeof role.start === 'string'
|
||||
? role.start
|
||||
: role.start.label}
|
||||
</time>{' '}
|
||||
<span aria-hidden="true">—</span>{' '}
|
||||
<time
|
||||
dateTime={
|
||||
typeof role.end === 'string' ? role.end : role.end.dateTime
|
||||
}
|
||||
>
|
||||
{typeof role.end === 'string' ? role.end : role.end.label}
|
||||
</time>
|
||||
</dd>
|
||||
</dl>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<Button href="/CV.pdf" variant="colored" className="group mt-6 w-full">
|
||||
O meu CV
|
||||
<ArrowDownIcon className="h-4 w-4 stroke-current" />
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default async function Home() {
|
||||
const { results: blogPosts } = await getFirstBlogPosts()
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container className="mt-9">
|
||||
<div className="max-w-2xl">
|
||||
<h1 className="text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 sm:text-5xl">
|
||||
Olá! Sou o Filipe :)
|
||||
</h1>
|
||||
<p className="mt-6 text-base text-zinc-600 dark:text-zinc-400">
|
||||
Sou um engenheiro de UX (não me perguntem o que é que nem eu sei
|
||||
bem).
|
||||
</p>
|
||||
<p className="mt-2 text-base text-zinc-600 dark:text-zinc-400">
|
||||
Gosto de programar interfaces e aplicações web, mas também de
|
||||
política, de ler sobre economia e de animais. Não gosto de cozinhar
|
||||
nem de vento frio. 🥶
|
||||
</p>
|
||||
<p className="mt-2 text-base text-zinc-600 dark:text-zinc-400">
|
||||
Estou a tentar trazer à superfície o potencial da humanidade. Sou a
|
||||
favor de standards, software de código aberto (como é este site!),
|
||||
licenças{' '}
|
||||
<HybridLink
|
||||
href="https://pt.wikipedia.org/wiki/Copyleft"
|
||||
className="underline transition-colors hover:text-teal-500"
|
||||
>
|
||||
<i>copyleft</i>
|
||||
</HybridLink>{' '}
|
||||
e de cooperativas em vez de monopólios. ✊
|
||||
</p>
|
||||
<p className="mt-2 text-base text-zinc-600 dark:text-zinc-400">
|
||||
Sou apaixonado pela{' '}
|
||||
<HybridLink
|
||||
href="https://doughnuteconomics.org/about-doughnut-economics"
|
||||
className="underline transition-colors hover:text-teal-500"
|
||||
>
|
||||
<i>Economia do Donut</i>
|
||||
</HybridLink>{' '}
|
||||
e por economia social e ambiental. Gostava de, um dia, ser
|
||||
economista em vez de programador. Quem sabe, para a União Europeia.
|
||||
🇪🇺
|
||||
</p>
|
||||
<p className="mt-2 text-base text-zinc-600 dark:text-zinc-400">
|
||||
Moro em Oeiras, Lisboa, Portugal.
|
||||
</p>
|
||||
<div className="mt-6 flex gap-6">
|
||||
<SocialLink
|
||||
rel="me"
|
||||
href="https://mastodon.green/@filipesm"
|
||||
aria-label="Segue-me no Fediverse"
|
||||
icon={MastodonLogo}
|
||||
/>
|
||||
<SocialLink
|
||||
href="https://codeberg.org/filipesm"
|
||||
aria-label="Segue-me no Codeberg"
|
||||
icon={CodebergIcon}
|
||||
/>
|
||||
<SocialLink
|
||||
href="https://github.com/filipesmedeiros"
|
||||
aria-label="Segue-me no GitHub"
|
||||
icon={GitHubIcon}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
<Container className="mt-24 md:mt-28">
|
||||
<div className="mx-auto grid max-w-xl grid-cols-1 gap-y-20 lg:max-w-none lg:grid-cols-2">
|
||||
<div className="flex flex-col gap-16">
|
||||
{blogPosts.map((blogPost) => (
|
||||
<BlogPost
|
||||
key={richTextAsPlainText(blogPost.properties.Slug.rich_text)}
|
||||
title={richTextAsPlainText(blogPost.properties.Name.title)}
|
||||
description={richTextAsPlainText(
|
||||
blogPost.properties.Description.rich_text,
|
||||
)}
|
||||
topics={blogPost.properties.Topics.multi_select.map(
|
||||
({ name, color }) => ({
|
||||
name,
|
||||
color,
|
||||
}),
|
||||
)}
|
||||
slug={richTextAsPlainText(blogPost.properties.Slug.rich_text)}
|
||||
publishDate={richTextAsPlainText(
|
||||
blogPost.properties.PublishDate.date?.start ??
|
||||
blogPost.created_time,
|
||||
)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div className="space-y-10 lg:pl-16 xl:pl-24">
|
||||
<StayUpToDate />
|
||||
<Resume />
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
pre[class*='language-'] {
|
||||
color: theme('colors.zinc.100');
|
||||
}
|
||||
|
||||
.token.tag,
|
||||
.token.class-name,
|
||||
.token.selector,
|
||||
.token.selector .class,
|
||||
.token.selector.class,
|
||||
.token.function {
|
||||
color: theme('colors.pink.400');
|
||||
}
|
||||
|
||||
.token.attr-name,
|
||||
.token.keyword,
|
||||
.token.rule,
|
||||
.token.pseudo-class,
|
||||
.token.important {
|
||||
color: theme('colors.zinc.300');
|
||||
}
|
||||
|
||||
.token.module {
|
||||
color: theme('colors.pink.400');
|
||||
}
|
||||
|
||||
.token.attr-value,
|
||||
.token.class,
|
||||
.token.string,
|
||||
.token.property {
|
||||
color: theme('colors.teal.300');
|
||||
}
|
||||
|
||||
.token.punctuation,
|
||||
.token.attr-equals {
|
||||
color: theme('colors.zinc.500');
|
||||
}
|
||||
|
||||
.token.unit,
|
||||
.language-css .token.function {
|
||||
color: theme('colors.sky.200');
|
||||
}
|
||||
|
||||
.token.comment,
|
||||
.token.operator,
|
||||
.token.combinator {
|
||||
color: theme('colors.zinc.400');
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
import CommonHead from '@/components/server/CommonHead'
|
||||
|
||||
export default function Head() {
|
||||
return (
|
||||
<>
|
||||
<CommonHead />
|
||||
<title>Projetos - Filipe Medeiros</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Coisas que já fiz (mesmo que não tenha acabado)"
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
import Image from 'next/image'
|
||||
|
||||
import Card, {
|
||||
CardDescription,
|
||||
CardLink,
|
||||
CardTags,
|
||||
} from '@/components/server/Card'
|
||||
import SimpleLayout from '@/components/server/SimpleLayout'
|
||||
import Tag from '@/components/server/Tag'
|
||||
import { IconProps } from '@/components/server/icons'
|
||||
import {
|
||||
type Project as ProjectType,
|
||||
getProjects,
|
||||
} from '@/lib/notion/content/projects'
|
||||
import getProxiedAssetUrl from '@/lib/notion/utils/getProxiedAssetUrl'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
export const revalidate = 600
|
||||
|
||||
function LinkIcon(props: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="M15.712 11.823a.75.75 0 1 0 1.06 1.06l-1.06-1.06Zm-4.95 1.768a.75.75 0 0 0 1.06-1.06l-1.06 1.06Zm-2.475-1.414a.75.75 0 1 0-1.06-1.06l1.06 1.06Zm4.95-1.768a.75.75 0 1 0-1.06 1.06l1.06-1.06Zm3.359.53-.884.884 1.06 1.06.885-.883-1.061-1.06Zm-4.95-2.12 1.414-1.415L12 6.344l-1.415 1.413 1.061 1.061Zm0 3.535a2.5 2.5 0 0 1 0-3.536l-1.06-1.06a4 4 0 0 0 0 5.656l1.06-1.06Zm4.95-4.95a2.5 2.5 0 0 1 0 3.535L17.656 12a4 4 0 0 0 0-5.657l-1.06 1.06Zm1.06-1.06a4 4 0 0 0-5.656 0l1.06 1.06a2.5 2.5 0 0 1 3.536 0l1.06-1.06Zm-7.07 7.07.176.177 1.06-1.06-.176-.177-1.06 1.06Zm-3.183-.353.884-.884-1.06-1.06-.884.883 1.06 1.06Zm4.95 2.121-1.414 1.414 1.06 1.06 1.415-1.413-1.06-1.061Zm0-3.536a2.5 2.5 0 0 1 0 3.536l1.06 1.06a4 4 0 0 0 0-5.656l-1.06 1.06Zm-4.95 4.95a2.5 2.5 0 0 1 0-3.535L6.344 12a4 4 0 0 0 0 5.656l1.06-1.06Zm-1.06 1.06a4 4 0 0 0 5.657 0l-1.061-1.06a2.5 2.5 0 0 1-3.535 0l-1.061 1.06Zm7.07-7.07-.176-.177-1.06 1.06.176.178 1.06-1.061Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
function Project({ project }: { project: ProjectType }) {
|
||||
return (
|
||||
<Card as="li">
|
||||
<Image
|
||||
src={getProxiedAssetUrl({
|
||||
pageId: project.id,
|
||||
lastEditedTime: project.last_edited_time,
|
||||
propertyId: project.properties.Logo.id,
|
||||
})}
|
||||
height={40}
|
||||
// this is ugly but it's actually the right way to do this (for UX)
|
||||
width={40 / (project.properties.LogoRatio.number ?? 1)}
|
||||
alt=""
|
||||
className="z-10 h-10 w-auto rounded border border-neutral-300/60 p-2 dark:border-neutral-300/20 dark:bg-neutral-800"
|
||||
/>
|
||||
<h2 className="mt-6 text-base font-semibold text-zinc-800 dark:text-zinc-100">
|
||||
<CardLink href={project.properties.URL.url ?? '#'}>
|
||||
{richTextAsPlainText(project.properties.Name.title)}
|
||||
</CardLink>
|
||||
</h2>
|
||||
<CardDescription>
|
||||
{richTextAsPlainText(project.properties.Description.rich_text)}
|
||||
</CardDescription>
|
||||
|
||||
<CardTags>
|
||||
{project.properties.Tags.multi_select.map(({ name, color }) => (
|
||||
<Tag key={name} notionColorName={color}>
|
||||
{name}
|
||||
</Tag>
|
||||
))}
|
||||
</CardTags>
|
||||
|
||||
{/* Hacky way but gets the job done and should be the most performant way! Follows the HTML5 spec :P */}
|
||||
<style
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `#${project.id} { --project-color: ${richTextAsPlainText(
|
||||
project.properties.Color.rich_text,
|
||||
)}; }`,
|
||||
}}
|
||||
/>
|
||||
|
||||
<p
|
||||
className="relative z-10 mt-6 flex text-sm font-medium text-zinc-400 transition group-hover:text-[var(--project-color)] dark:text-zinc-200"
|
||||
id={project.id}
|
||||
>
|
||||
<LinkIcon className="h-6 w-6 flex-none" />
|
||||
<span className="ml-2">
|
||||
{richTextAsPlainText(project.properties.URLName.rich_text)}
|
||||
</span>
|
||||
</p>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
|
||||
export default async function Projects() {
|
||||
const projects = await getProjects()
|
||||
|
||||
return (
|
||||
<SimpleLayout
|
||||
title="Projetos"
|
||||
intro="Coisas que fiz ao longo dos anos. Só aquelas das quais me orgulho :)" // TODO
|
||||
>
|
||||
<ul
|
||||
role="list"
|
||||
className="grid grid-cols-1 gap-x-12 gap-y-16 sm:grid-cols-2 lg:grid-cols-3"
|
||||
>
|
||||
{projects.map((project) => (
|
||||
<Project project={project} key={project.id} />
|
||||
))}
|
||||
</ul>
|
||||
</SimpleLayout>
|
||||
)
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
export default function Head() {
|
||||
return (
|
||||
<>
|
||||
<title>Sobre mim - Filipe Medeiros</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Sou o Filipe! Sou um engenheiro de UX de Oeiras, Lisboa."
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,137 +0,0 @@
|
|||
import clsx from 'clsx'
|
||||
import Image from 'next/image'
|
||||
import { type ElementType, type PropsWithChildren } from 'react'
|
||||
|
||||
import Container from '@/components/server/Container'
|
||||
import HybridLink, {
|
||||
type Props as HybridLinkProps,
|
||||
} from '@/components/server/HybridLink'
|
||||
import {
|
||||
CodebergIcon,
|
||||
GitHubIcon,
|
||||
type IconProps,
|
||||
MastodonLogo,
|
||||
} from '@/components/server/icons'
|
||||
import PortraitImage from '@/images/portrait.jpg'
|
||||
|
||||
function SocialLink({
|
||||
className,
|
||||
href,
|
||||
children,
|
||||
icon: Icon,
|
||||
}: PropsWithChildren<{
|
||||
icon: ElementType
|
||||
href: HybridLinkProps['href']
|
||||
className?: string
|
||||
}>) {
|
||||
return (
|
||||
<li className={clsx('flex', className)}>
|
||||
<HybridLink
|
||||
href={href}
|
||||
className="group flex text-sm font-medium text-zinc-800 transition hover:text-teal-500 dark:text-zinc-200 dark:hover:text-teal-500"
|
||||
>
|
||||
<Icon className="h-6 w-6 flex-none fill-zinc-500 transition group-hover:fill-teal-500" />
|
||||
<span className="ml-4">{children}</span>
|
||||
</HybridLink>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
function MailIcon(props: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M6 5a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h12a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H6Zm.245 2.187a.75.75 0 0 0-.99 1.126l6.25 5.5a.75.75 0 0 0 .99 0l6.25-5.5a.75.75 0 0 0-.99-1.126L12 12.251 6.245 7.187Z"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export default function About() {
|
||||
return (
|
||||
<Container className="mt-16 sm:mt-32">
|
||||
<div className="grid grid-cols-1 gap-y-16 lg:grid-cols-2 lg:grid-rows-[auto_1fr] lg:gap-y-12">
|
||||
<div className="lg:pl-20">
|
||||
<div className="max-w-xs px-2.5 lg:max-w-none">
|
||||
<Image
|
||||
src={PortraitImage}
|
||||
alt=""
|
||||
sizes="(min-width: 1024px) 32rem, 20rem"
|
||||
className="aspect-square rotate-3 rounded-2xl bg-zinc-100 object-cover dark:bg-zinc-800"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="lg:order-first lg:row-span-2">
|
||||
<h1 className="text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 sm:text-5xl">
|
||||
Sou o Filipe. Este é o meu espaço na internet.
|
||||
</h1>
|
||||
<div className="mt-6 space-y-7 text-base text-zinc-600 dark:text-zinc-400">
|
||||
<p>
|
||||
Apanhei o gosto por programação desde muito cedo e há muito que
|
||||
sei que é uma das minhas paixões. Depois do curso, quis logo
|
||||
entrar no mundo do trabalho, ver como era aquilo de que toda a
|
||||
gente falava.
|
||||
</p>
|
||||
<p>
|
||||
De certa forma desiludiu-me. Não me deu a satisfação de que estava
|
||||
à espera. Mas foi estranho, porque continuava (e continuo) a
|
||||
adorar programar e criar. A <i>web</i> - fazer sites e aplicações
|
||||
- é um escape criativo para mim. Mas parece que falta o sentido de
|
||||
propósito.
|
||||
</p>
|
||||
<p>
|
||||
Há uns tempos descobri um novo gosto: a economia. Comecei uns
|
||||
livros, ouvir umas palestras, estar muito mais atento à política.
|
||||
É divertido! Estou a pensar fazer uma mudança de carreira no
|
||||
futuro.
|
||||
</p>
|
||||
<p>
|
||||
Ainda assim, acho mesmo que nunca vou perder o gosto pela
|
||||
tecnologia e pela criação digital. Gostava de criar um produto
|
||||
(tenho várias ideias, de que provavelmente vou falar aqui no
|
||||
site).
|
||||
</p>
|
||||
<p>
|
||||
Quero viajar mais. Principalmente para fora da Europa. Países
|
||||
pouco <i>westernalizados</i> são o meu próximo objetivo (sudeste
|
||||
asiático, América Latina e África).
|
||||
</p>
|
||||
<p>Veremos para onde a vida nos leva.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="lg:pl-20">
|
||||
<ul role="list">
|
||||
<SocialLink
|
||||
href="https://mastodon.green/@filipesm"
|
||||
icon={MastodonLogo}
|
||||
>
|
||||
Segue-me no Fediverse
|
||||
</SocialLink>
|
||||
<SocialLink
|
||||
href="https://codeberg.org/filipesm"
|
||||
icon={CodebergIcon}
|
||||
className="mt-4"
|
||||
>
|
||||
Segue-me no Codeberg
|
||||
</SocialLink>
|
||||
<SocialLink
|
||||
href="https://github.com/filipesmedeiros"
|
||||
icon={GitHubIcon}
|
||||
className="mt-4"
|
||||
>
|
||||
Segue-me no Github
|
||||
</SocialLink>
|
||||
<SocialLink
|
||||
href="mailto:hello@filipesm.eu"
|
||||
icon={MailIcon}
|
||||
className="mt-8 border-t border-zinc-100 pt-8 dark:border-zinc-700/40"
|
||||
>
|
||||
hello@filipesm.eu
|
||||
</SocialLink>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
'use client'
|
||||
|
||||
import { useRouter } from 'next/navigation'
|
||||
|
||||
import { type IconProps } from '@/components/server/icons'
|
||||
|
||||
const ArrowLeftIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="M7.25 11.25 3.75 8m0 0 3.5-3.25M3.75 8h8.5"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
const BackButton = () => {
|
||||
const { back } = useRouter()
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={back}
|
||||
aria-label="Go back to the post gallery"
|
||||
className="group mb-8 flex h-10 w-10 items-center justify-center rounded-full bg-white shadow-md shadow-zinc-800/5 ring-1 ring-zinc-900/5 transition dark:border dark:border-zinc-700/50 dark:bg-zinc-800 dark:ring-0 dark:ring-white/10 dark:hover:border-zinc-700 dark:hover:ring-white/20 lg:absolute lg:-left-5 lg:mb-0 lg:-mt-2 xl:-top-1.5 xl:left-0 xl:mt-0"
|
||||
>
|
||||
<ArrowLeftIcon className="h-4 w-4 stroke-zinc-500 transition group-hover:stroke-zinc-700 dark:stroke-zinc-500 dark:group-hover:stroke-zinc-400" />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
export default BackButton
|
|
@ -1,37 +0,0 @@
|
|||
import clsx from 'clsx'
|
||||
import { type ButtonHTMLAttributes } from 'react'
|
||||
|
||||
import HybridLink, {
|
||||
type Props as HybridLinkProps,
|
||||
} from '@/components/server/HybridLink'
|
||||
|
||||
const variantStyles = {
|
||||
primary:
|
||||
'bg-zinc-800 font-semibold text-zinc-100 hover:bg-zinc-700 active:bg-zinc-800 active:text-zinc-100/70 dark:bg-zinc-700 dark:hover:bg-zinc-600 dark:active:bg-zinc-700 dark:active:text-zinc-100/70',
|
||||
secondary:
|
||||
'bg-zinc-50 font-medium text-zinc-900 hover:bg-zinc-100 active:bg-zinc-100 active:text-zinc-900/60 dark:bg-zinc-800/50 dark:text-zinc-300 dark:hover:bg-zinc-800 dark:hover:text-zinc-50 dark:active:bg-zinc-800/50 dark:active:text-zinc-50/70',
|
||||
colored:
|
||||
'bg-zinc-100 border border-zinc-200 dark:border-none text-teal-500 font-semibold dark:text-zinc-100 hover:bg-teal-500 active:border-teal-500 hover:border-teal-500 active:bg-teal-600 hover:text-zinc-50 dark:hover:text-zinc-900/70 active:text-zinc-100/70 dark:bg-zinc-800 dark:hover:bg-teal-500',
|
||||
} as const
|
||||
|
||||
const Button = ({
|
||||
variant = 'primary',
|
||||
className,
|
||||
...props
|
||||
}: (ButtonHTMLAttributes<HTMLButtonElement> | HybridLinkProps) & {
|
||||
variant?: keyof typeof variantStyles
|
||||
}) => {
|
||||
className = clsx(
|
||||
'inline-flex items-center gap-2 justify-center rounded-md py-2 px-3 text-sm outline-offset-2 transition active:transition-none',
|
||||
variantStyles[variant],
|
||||
className,
|
||||
)
|
||||
|
||||
return 'href' in props ? (
|
||||
<HybridLink className={className} {...props} href={props.href} />
|
||||
) : (
|
||||
<button className={className} {...props} />
|
||||
)
|
||||
}
|
||||
|
||||
export default Button
|
|
@ -1,394 +0,0 @@
|
|||
'use client'
|
||||
|
||||
import { Popover, Transition } from '@headlessui/react'
|
||||
import clsx from 'clsx'
|
||||
import Image from 'next/image'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import {
|
||||
Fragment,
|
||||
type HTMLAttributes,
|
||||
type PropsWithChildren,
|
||||
useEffect,
|
||||
useRef,
|
||||
} from 'react'
|
||||
|
||||
import Container from '@/components/server/Container'
|
||||
import HybridLink, {
|
||||
type Props as HydridLinkProps,
|
||||
} from '@/components/server/HybridLink'
|
||||
import {
|
||||
ChevronDownIcon,
|
||||
CloseIcon,
|
||||
MoonIcon,
|
||||
SunIcon,
|
||||
} from '@/components/server/icons'
|
||||
import avatarImage from '@/images/me.jpeg'
|
||||
import { type PopoverProps } from '@/lib/types'
|
||||
|
||||
function MobileNavItem({
|
||||
href,
|
||||
children,
|
||||
}: PropsWithChildren<{ href: HydridLinkProps['href'] }>) {
|
||||
return (
|
||||
<li>
|
||||
<Popover.Button
|
||||
as={HybridLink}
|
||||
href={href}
|
||||
className="block py-2 transition-colors hover:text-teal-500"
|
||||
>
|
||||
{children}
|
||||
</Popover.Button>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
function MobileNavigation(props: PopoverProps) {
|
||||
return (
|
||||
<Popover {...props}>
|
||||
<Popover.Button className="group flex items-center rounded-full bg-white/90 px-4 py-2 text-sm font-medium text-zinc-800 shadow-lg shadow-zinc-800/5 ring-1 ring-zinc-900/5 backdrop-blur dark:bg-zinc-800/90 dark:text-zinc-200 dark:ring-white/10 dark:hover:ring-white/20">
|
||||
Menu
|
||||
<ChevronDownIcon className="ml-3 h-auto w-2 stroke-zinc-500 group-hover:stroke-zinc-700 dark:group-hover:stroke-zinc-400" />
|
||||
</Popover.Button>
|
||||
<Transition.Root>
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="duration-150 ease-out"
|
||||
enterFrom="opacity-0"
|
||||
enterTo="opacity-100"
|
||||
leave="duration-150 ease-in"
|
||||
leaveFrom="opacity-100"
|
||||
leaveTo="opacity-0"
|
||||
>
|
||||
<Popover.Overlay className="fixed inset-0 z-50 bg-zinc-800/40 backdrop-blur-sm dark:bg-black/80" />
|
||||
</Transition.Child>
|
||||
<Transition.Child
|
||||
as={Fragment}
|
||||
enter="duration-150 ease-out"
|
||||
enterFrom="opacity-0 scale-95"
|
||||
enterTo="opacity-100 scale-100"
|
||||
leave="duration-150 ease-in"
|
||||
leaveFrom="opacity-100 scale-100"
|
||||
leaveTo="opacity-0 scale-95"
|
||||
>
|
||||
<Popover.Panel
|
||||
focus
|
||||
className="fixed inset-x-4 top-8 z-50 origin-top rounded-3xl bg-white p-8 ring-1 ring-zinc-900/5 dark:bg-zinc-900 dark:ring-zinc-800"
|
||||
>
|
||||
<div className="flex flex-row-reverse items-center justify-between">
|
||||
<Popover.Button aria-label="Close menu" className="-m-1 p-1">
|
||||
<CloseIcon className="h-6 w-6 text-zinc-500 dark:text-zinc-400" />
|
||||
</Popover.Button>
|
||||
<h2 className="font-medium text-zinc-600 dark:text-zinc-400">
|
||||
Menu
|
||||
</h2>
|
||||
</div>
|
||||
<nav className="mt-6">
|
||||
<ul className="-my-2 divide-y divide-zinc-100 text-base text-zinc-800 dark:divide-zinc-100/5 dark:text-zinc-300">
|
||||
<MobileNavItem href="/sobre-mim">Sobre mim</MobileNavItem>
|
||||
<MobileNavItem href="/blog">Blog</MobileNavItem>
|
||||
<MobileNavItem href="/projetos">Projetos</MobileNavItem>
|
||||
</ul>
|
||||
</nav>
|
||||
</Popover.Panel>
|
||||
</Transition.Child>
|
||||
</Transition.Root>
|
||||
</Popover>
|
||||
)
|
||||
}
|
||||
|
||||
function NavItem({ href, children }: HydridLinkProps) {
|
||||
const isActive = usePathname() === href
|
||||
|
||||
return (
|
||||
<li>
|
||||
<HybridLink
|
||||
href={href}
|
||||
className={clsx(
|
||||
'relative block whitespace-nowrap px-3 py-2 transition',
|
||||
isActive
|
||||
? 'text-teal-500 dark:text-teal-400'
|
||||
: 'hover:text-teal-500 dark:hover:text-teal-400',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
{isActive && (
|
||||
<span className="absolute inset-x-1 -bottom-px h-px bg-gradient-to-r from-teal-500/0 via-teal-500/40 to-teal-500/0 dark:from-teal-400/0 dark:via-teal-400/40 dark:to-teal-400/0" />
|
||||
)}
|
||||
</HybridLink>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
function DesktopNavigation(props: HTMLAttributes<HTMLElement>) {
|
||||
return (
|
||||
<nav {...props}>
|
||||
<ul className="flex rounded-full bg-white/90 px-3 text-sm font-medium text-zinc-800 shadow-lg shadow-zinc-800/5 ring-1 ring-zinc-900/5 backdrop-blur dark:bg-zinc-800/90 dark:text-zinc-200 dark:ring-white/10">
|
||||
<NavItem href="/sobre-mim">Sobre mim</NavItem>
|
||||
<NavItem href="/blog">Blog</NavItem>
|
||||
<NavItem href="/projetos">Projetos</NavItem>
|
||||
</ul>
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
|
||||
function ModeToggle() {
|
||||
function disableTransitionsTemporarily() {
|
||||
document.documentElement.classList.add('[&_*]:!transition-none')
|
||||
window.setTimeout(() => {
|
||||
document.documentElement.classList.remove('[&_*]:!transition-none')
|
||||
}, 0)
|
||||
}
|
||||
|
||||
function toggleMode() {
|
||||
disableTransitionsTemporarily()
|
||||
|
||||
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
const isSystemDarkMode = darkModeMediaQuery.matches
|
||||
const isDarkMode = document.documentElement.classList.toggle('dark')
|
||||
|
||||
if (isDarkMode === isSystemDarkMode) {
|
||||
delete window.localStorage.isDarkMode
|
||||
} else {
|
||||
window.localStorage.isDarkMode = isDarkMode
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Toggle dark mode"
|
||||
className="group rounded-full bg-white/90 px-3 py-2 shadow-lg shadow-zinc-800/5 ring-1 ring-zinc-900/5 backdrop-blur transition dark:bg-zinc-800/90 dark:ring-white/10 dark:hover:ring-white/20"
|
||||
onClick={toggleMode}
|
||||
>
|
||||
<SunIcon className="h-6 w-6 fill-zinc-100 stroke-zinc-500 transition group-hover:fill-zinc-200 group-hover:stroke-zinc-700 dark:hidden [@media(prefers-color-scheme:dark)]:fill-teal-50 [@media(prefers-color-scheme:dark)]:stroke-teal-500 [@media(prefers-color-scheme:dark)]:group-hover:fill-teal-50 [@media(prefers-color-scheme:dark)]:group-hover:stroke-teal-600" />
|
||||
<MoonIcon className="hidden h-6 w-6 fill-zinc-700 stroke-zinc-500 transition dark:block [@media(prefers-color-scheme:dark)]:group-hover:stroke-zinc-400 [@media_not_(prefers-color-scheme:dark)]:fill-teal-400/10 [@media_not_(prefers-color-scheme:dark)]:stroke-teal-500" />
|
||||
</button>
|
||||
)
|
||||
}
|
||||
|
||||
function clamp(number: number, a: number, b: number) {
|
||||
const min = Math.min(a, b)
|
||||
const max = Math.max(a, b)
|
||||
return Math.min(Math.max(number, min), max)
|
||||
}
|
||||
|
||||
function AvatarContainer({ className, ...props }: HTMLAttributes<HTMLElement>) {
|
||||
return (
|
||||
<div
|
||||
className={clsx(
|
||||
className,
|
||||
'h-10 w-10 rounded-full bg-white/90 p-0.5 shadow-lg shadow-zinc-800/5 ring-1 ring-zinc-900/5 backdrop-blur dark:bg-zinc-800/90 dark:ring-white/10',
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function Avatar({
|
||||
large = false,
|
||||
className,
|
||||
...props
|
||||
}: Omit<HydridLinkProps, 'href'> & { large?: boolean }) {
|
||||
return (
|
||||
<HybridLink
|
||||
href="/"
|
||||
aria-label="Home"
|
||||
className={clsx(className, 'pointer-events-auto')}
|
||||
{...props}
|
||||
>
|
||||
<Image
|
||||
src={avatarImage}
|
||||
alt=""
|
||||
sizes={large ? '4rem' : '2.25rem'}
|
||||
className={clsx(
|
||||
'rounded-full bg-zinc-100 object-cover dark:bg-zinc-800',
|
||||
large ? 'h-16 w-16' : 'h-9 w-9',
|
||||
)}
|
||||
priority
|
||||
/>
|
||||
</HybridLink>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Header() {
|
||||
const isHomePage = usePathname() === '/'
|
||||
|
||||
const headerRef = useRef<HTMLDivElement>(null)
|
||||
const avatarRef = useRef<HTMLDivElement>(null)
|
||||
const isInitial = useRef(true)
|
||||
|
||||
useEffect(() => {
|
||||
const downDelay = avatarRef.current?.offsetTop ?? 0
|
||||
const upDelay = 64
|
||||
|
||||
const setProperty = (property: string, value: string | null) => {
|
||||
document.documentElement.style.setProperty(property, value)
|
||||
}
|
||||
|
||||
const removeProperty = (property: string) => {
|
||||
document.documentElement.style.removeProperty(property)
|
||||
}
|
||||
|
||||
const updateHeaderStyles = () => {
|
||||
const { top, height } = headerRef.current!.getBoundingClientRect()
|
||||
const scrollY = clamp(
|
||||
window.scrollY,
|
||||
0,
|
||||
document.body.scrollHeight - window.innerHeight,
|
||||
)
|
||||
|
||||
if (isInitial.current) {
|
||||
setProperty('--header-position', 'sticky')
|
||||
}
|
||||
|
||||
setProperty('--content-offset', `${downDelay}px`)
|
||||
|
||||
if (isInitial.current || scrollY < downDelay) {
|
||||
setProperty('--header-height', `${downDelay + height}px`)
|
||||
setProperty('--header-mb', `${-downDelay}px`)
|
||||
} else if (top + height < -upDelay) {
|
||||
const offset = Math.max(height, scrollY - upDelay)
|
||||
setProperty('--header-height', `${offset}px`)
|
||||
setProperty('--header-mb', `${height - offset}px`)
|
||||
} else if (top === 0) {
|
||||
setProperty('--header-height', `${scrollY + height}px`)
|
||||
setProperty('--header-mb', `${-scrollY}px`)
|
||||
}
|
||||
|
||||
if (top === 0 && scrollY > 0 && scrollY >= downDelay) {
|
||||
setProperty('--header-inner-position', 'fixed')
|
||||
removeProperty('--header-top')
|
||||
removeProperty('--avatar-top')
|
||||
} else {
|
||||
removeProperty('--header-inner-position')
|
||||
setProperty('--header-top', '0px')
|
||||
setProperty('--avatar-top', '0px')
|
||||
}
|
||||
}
|
||||
|
||||
function updateAvatarStyles() {
|
||||
if (!isHomePage) {
|
||||
return
|
||||
}
|
||||
|
||||
const fromScale = 1
|
||||
const toScale = 36 / 64
|
||||
const fromX = 0
|
||||
const toX = 2 / 16
|
||||
|
||||
const scrollY = downDelay - window.scrollY
|
||||
|
||||
let scale = (scrollY * (fromScale - toScale)) / downDelay + toScale
|
||||
scale = clamp(scale, fromScale, toScale)
|
||||
|
||||
let x = (scrollY * (fromX - toX)) / downDelay + toX
|
||||
x = clamp(x, fromX, toX)
|
||||
|
||||
setProperty(
|
||||
'--avatar-image-transform',
|
||||
`translate3d(${x}rem, 0, 0) scale(${scale})`,
|
||||
)
|
||||
|
||||
const borderScale = 1 / (toScale / scale)
|
||||
const borderX = (-toX + x) * borderScale
|
||||
const borderTransform = `translate3d(${borderX}rem, 0, 0) scale(${borderScale})`
|
||||
|
||||
setProperty('--avatar-border-transform', borderTransform)
|
||||
setProperty('--avatar-border-opacity', scale === toScale ? '1' : '0')
|
||||
}
|
||||
|
||||
function updateStyles() {
|
||||
updateHeaderStyles()
|
||||
updateAvatarStyles()
|
||||
isInitial.current = false
|
||||
}
|
||||
|
||||
updateStyles()
|
||||
window.addEventListener('scroll', updateStyles, { passive: true })
|
||||
window.addEventListener('resize', updateStyles)
|
||||
|
||||
return () => {
|
||||
window.removeEventListener('scroll', updateStyles)
|
||||
window.removeEventListener('resize', updateStyles)
|
||||
}
|
||||
}, [isHomePage])
|
||||
|
||||
return (
|
||||
<>
|
||||
<header
|
||||
className="pointer-events-none relative z-50 flex flex-col"
|
||||
style={{
|
||||
height: 'var(--header-height)',
|
||||
marginBottom: 'var(--header-mb)',
|
||||
}}
|
||||
>
|
||||
{isHomePage && (
|
||||
<>
|
||||
<div
|
||||
ref={avatarRef}
|
||||
className="order-last mt-[calc(theme(spacing.16)-theme(spacing.3))]"
|
||||
/>
|
||||
<Container
|
||||
className="top-0 order-last -mb-3 pt-3"
|
||||
// @ts-expect-error wrong typings on React's side
|
||||
style={{ position: 'var(--header-position)' }}
|
||||
>
|
||||
<div
|
||||
className="top-[var(--avatar-top,theme(spacing.3))] w-full"
|
||||
// @ts-expect-error wrong typings on React's side
|
||||
style={{ position: 'var(--header-inner-position)' }}
|
||||
>
|
||||
<div className="relative">
|
||||
<AvatarContainer
|
||||
className="absolute left-0 top-3 origin-left transition-opacity"
|
||||
style={{
|
||||
opacity: 'var(--avatar-border-opacity, 0)',
|
||||
transform: 'var(--avatar-border-transform)',
|
||||
}}
|
||||
/>
|
||||
<Avatar
|
||||
large
|
||||
className="block h-16 w-16 origin-left"
|
||||
style={{ transform: 'var(--avatar-image-transform)' }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</>
|
||||
)}
|
||||
<div
|
||||
ref={headerRef}
|
||||
className="top-0 z-10 h-16 pt-6"
|
||||
// @ts-expect-error wrong typings on React's side
|
||||
style={{ position: 'var(--header-position)' }}
|
||||
>
|
||||
<Container
|
||||
className="top-[var(--header-top,theme(spacing.6))] w-full"
|
||||
// @ts-expect-error wrong typings on React's side
|
||||
style={{ position: 'var(--header-inner-position)' }}
|
||||
>
|
||||
<div className="relative flex gap-4">
|
||||
<div className="flex flex-1">
|
||||
{!isHomePage && (
|
||||
<AvatarContainer>
|
||||
<Avatar />
|
||||
</AvatarContainer>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex flex-1 justify-end md:justify-center">
|
||||
<MobileNavigation className="pointer-events-auto md:hidden" />
|
||||
<DesktopNavigation className="pointer-events-auto hidden md:block" />
|
||||
</div>
|
||||
<div className="flex justify-end md:flex-1">
|
||||
<div className="pointer-events-auto">
|
||||
<ModeToggle />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
</header>
|
||||
{isHomePage && <div style={{ height: 'var(--content-offset)' }} />}
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
import { type CalloutBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'
|
||||
import Image from 'next/image'
|
||||
import { type PropsWithChildren } from 'react'
|
||||
|
||||
export interface Props {
|
||||
icon: CalloutBlockObjectResponse['callout']['icon']
|
||||
}
|
||||
|
||||
export function CalloutIcon({ icon }: PropsWithChildren<Props>) {
|
||||
return (
|
||||
icon &&
|
||||
(icon.type === 'emoji' ? (
|
||||
<span>{icon.emoji}</span>
|
||||
) : (
|
||||
<Image
|
||||
alt=""
|
||||
className="h-6 w-6"
|
||||
src={icon.type === 'file' ? icon.file.url : icon.external.url}
|
||||
width={24}
|
||||
height={24}
|
||||
/>
|
||||
))
|
||||
)
|
||||
}
|
||||
|
||||
export default function Callout({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<div className="flex rounded dark:bg-white dark:text-black">{children}</div>
|
||||
)
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
import clsx from 'clsx'
|
||||
import {
|
||||
type ComponentProps,
|
||||
type ElementType,
|
||||
type PropsWithChildren,
|
||||
} from 'react'
|
||||
|
||||
import HybridLink, { type Props as HybridLinkProps } from './HybridLink'
|
||||
import { IconProps } from './icons'
|
||||
|
||||
function ChevronRightIcon(props: IconProps) {
|
||||
return (
|
||||
<svg viewBox="0 0 16 16" fill="none" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="M6.75 5.75 9.25 8l-2.5 2.25"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export function CardLink({ children, ...props }: HybridLinkProps) {
|
||||
return (
|
||||
<>
|
||||
<div className="absolute -inset-y-6 -inset-x-4 z-0 scale-95 bg-zinc-50 opacity-0 transition group-hover:scale-100 group-hover:opacity-100 dark:bg-zinc-800/50 sm:-inset-x-6 sm:rounded-2xl" />
|
||||
<HybridLink {...props}>
|
||||
<span className="absolute -inset-y-6 -inset-x-4 z-20 sm:-inset-x-6 sm:rounded-2xl" />
|
||||
<span className="relative z-10">{children}</span>
|
||||
</HybridLink>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function CardTitle({
|
||||
as: Component = 'h2',
|
||||
href,
|
||||
children,
|
||||
}: PropsWithChildren<{
|
||||
href: string
|
||||
as?: ElementType
|
||||
}>) {
|
||||
return (
|
||||
<Component className="text-base font-semibold tracking-tight text-zinc-800 dark:text-zinc-100">
|
||||
{href ? <CardLink href={href}>{children}</CardLink> : children}
|
||||
</Component>
|
||||
)
|
||||
}
|
||||
|
||||
export function CardDescription({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<p className="relative z-10 mt-2 flex-1 text-sm text-zinc-600 dark:text-zinc-400">
|
||||
{children}
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
||||
export function CardTags({ children }: PropsWithChildren) {
|
||||
return <div className="z-10 mt-2 flex w-full gap-1 text-sm">{children}</div>
|
||||
}
|
||||
|
||||
export function CardCta({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="relative z-10 mt-4 flex items-center text-sm font-medium text-teal-500"
|
||||
>
|
||||
{children}
|
||||
<ChevronRightIcon className="ml-1 h-4 w-4 stroke-current" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function CardEyebrow<C extends ElementType>({
|
||||
as: Component = 'p',
|
||||
decorate = false,
|
||||
children,
|
||||
...props
|
||||
}: ComponentProps<C> & {
|
||||
as: C
|
||||
decorate?: boolean
|
||||
}) {
|
||||
return (
|
||||
<Component
|
||||
className={clsx(
|
||||
'className' in props ? props.className : '',
|
||||
'relative z-10 order-first mb-3 flex items-center text-sm text-zinc-400 dark:text-zinc-500',
|
||||
decorate && 'pl-3.5',
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{decorate && (
|
||||
<span
|
||||
className="absolute inset-y-0 left-0 flex items-center"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<span className="h-4 w-0.5 rounded-full bg-zinc-200 dark:bg-zinc-500" />
|
||||
</span>
|
||||
)}
|
||||
{children}
|
||||
</Component>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Card({
|
||||
as: Component = 'div',
|
||||
className,
|
||||
children,
|
||||
id,
|
||||
}: PropsWithChildren<{ id?: string; className?: string; as?: ElementType }>) {
|
||||
return (
|
||||
<Component
|
||||
id={id}
|
||||
className={clsx(className, 'group relative flex flex-col items-start')}
|
||||
>
|
||||
{children}
|
||||
</Component>
|
||||
)
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
import Prism, { highlight } from 'prismjs'
|
||||
import { type PropsWithChildren } from 'react'
|
||||
|
||||
import { RichText } from '@/lib/notion/types'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
export interface Props {
|
||||
language: string
|
||||
codeRichText: RichText
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only used for the RSS feed
|
||||
*/
|
||||
export function SyncCodeSnippet({
|
||||
language,
|
||||
codeRichText,
|
||||
}: PropsWithChildren<Props>) {
|
||||
const highlightedCodeHtml = highlight(
|
||||
richTextAsPlainText(codeRichText),
|
||||
Prism.languages[language],
|
||||
language,
|
||||
)
|
||||
|
||||
return (
|
||||
<pre className="rounded border border-neutral-500 bg-neutral-800 p-4">
|
||||
<code
|
||||
className={`language-${language}`}
|
||||
dangerouslySetInnerHTML={{ __html: highlightedCodeHtml }}
|
||||
/>
|
||||
</pre>
|
||||
)
|
||||
}
|
||||
|
||||
export default async function CodeSnippet(props: PropsWithChildren<Props>) {
|
||||
await import(`prismjs/components/prism-${props.language}.min.js`)
|
||||
// @ts-expect-error CSS not JS
|
||||
await import('prismjs/themes/prism-tomorrow.min.css')
|
||||
// @ts-expect-error CSS not JS
|
||||
await import('prismjs/themes/prism.min.css')
|
||||
|
||||
return <SyncCodeSnippet {...props} />
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
import Script from 'next/script'
|
||||
|
||||
const modeScript = `
|
||||
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)')
|
||||
|
||||
const updateMode = () => {
|
||||
const isSystemDarkMode = darkModeMediaQuery.matches
|
||||
const isDarkMode = window.localStorage.isDarkMode === 'true' || (!('isDarkMode' in window.localStorage) && isSystemDarkMode)
|
||||
|
||||
console.log(isSystemDarkMode)
|
||||
|
||||
if (isDarkMode) {
|
||||
document.documentElement.classList.add('dark')
|
||||
} else {
|
||||
document.documentElement.classList.remove('dark')
|
||||
}
|
||||
|
||||
if (isDarkMode === isSystemDarkMode) {
|
||||
delete window.localStorage.isDarkMode
|
||||
}
|
||||
}
|
||||
|
||||
const disableTransitionsTemporarily = () => {
|
||||
document.documentElement.classList.add('[&_*]:!transition-none')
|
||||
window.setTimeout(() => {
|
||||
document.documentElement.classList.remove('[&_*]:!transition-none')
|
||||
}, 0)
|
||||
}
|
||||
|
||||
const updateModeWithoutTransitions = () => {
|
||||
disableTransitionsTemporarily()
|
||||
updateMode()
|
||||
}
|
||||
|
||||
updateMode()
|
||||
darkModeMediaQuery.addEventListener('change', updateModeWithoutTransitions)
|
||||
window.addEventListener('storage', updateModeWithoutTransitions)
|
||||
`
|
||||
|
||||
export default function CommonHead() {
|
||||
return (
|
||||
<>
|
||||
<link
|
||||
rel="apple-touch-icon"
|
||||
sizes="180x180"
|
||||
href="/favicon/apple-touch-icon.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="32x32"
|
||||
href="/favicon/favicon-32x32.png"
|
||||
/>
|
||||
<link
|
||||
rel="icon"
|
||||
type="image/png"
|
||||
sizes="16x16"
|
||||
href="/favicon/favicon-16x16.png"
|
||||
/>
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
|
||||
<Script
|
||||
id="mode-script"
|
||||
dangerouslySetInnerHTML={{ __html: modeScript }}
|
||||
/>
|
||||
|
||||
<link
|
||||
rel="alternate"
|
||||
type="application/rss+xml"
|
||||
href={`${process.env.NEXT_PUBLIC_SITE_URL}/rss/feed.xml`}
|
||||
/>
|
||||
<link
|
||||
rel="alternate"
|
||||
type="application/feed+json"
|
||||
href={`${process.env.NEXT_PUBLIC_SITE_URL}/rss/feed.json`}
|
||||
/>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
import clsx from 'clsx'
|
||||
import {
|
||||
type ComponentProps,
|
||||
type HTMLAttributes,
|
||||
type PropsWithChildren,
|
||||
forwardRef,
|
||||
} from 'react'
|
||||
|
||||
export const OuterContainer = forwardRef<
|
||||
HTMLDivElement,
|
||||
HTMLAttributes<HTMLDivElement>
|
||||
>(function OuterContainer({ className, children, ...props }, ref) {
|
||||
return (
|
||||
<div ref={ref} className={clsx('sm:px-8', className)} {...props}>
|
||||
<div className="mx-auto max-w-7xl lg:px-8">{children}</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
export const InnerContainer = forwardRef<
|
||||
HTMLDivElement,
|
||||
HTMLAttributes<HTMLDivElement>
|
||||
>(function InnerContainer({ className, children, ...props }, ref) {
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={clsx('relative px-4 sm:px-8 lg:px-12', className)}
|
||||
{...props}
|
||||
>
|
||||
<div className="mx-auto max-w-2xl lg:max-w-5xl">{children}</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
|
||||
const Container: ReturnType<
|
||||
typeof forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>
|
||||
> = forwardRef<HTMLDivElement>(function Container(
|
||||
{
|
||||
children,
|
||||
...props
|
||||
}: PropsWithChildren<ComponentProps<typeof OuterContainer>>,
|
||||
ref,
|
||||
) {
|
||||
return (
|
||||
<OuterContainer ref={ref} {...props}>
|
||||
<InnerContainer>{children}</InnerContainer>
|
||||
</OuterContainer>
|
||||
)
|
||||
})
|
||||
|
||||
export default Container
|
|
@ -1,57 +0,0 @@
|
|||
import { type PropsWithChildren } from 'react'
|
||||
|
||||
import { InnerContainer, OuterContainer } from './Container'
|
||||
import HybridLink, { type Props as HybridLinkProps } from './HybridLink'
|
||||
|
||||
function NavLink({
|
||||
href,
|
||||
children,
|
||||
}: PropsWithChildren<{ href: HybridLinkProps['href'] }>) {
|
||||
return (
|
||||
<HybridLink
|
||||
href={href}
|
||||
className="transition hover:text-teal-500 dark:hover:text-teal-400"
|
||||
>
|
||||
{children}
|
||||
</HybridLink>
|
||||
)
|
||||
}
|
||||
|
||||
export default function Footer() {
|
||||
return (
|
||||
<footer className="mt-32">
|
||||
<OuterContainer>
|
||||
<div className="border-t border-zinc-100 pt-10 pb-16 dark:border-zinc-700/40">
|
||||
<InnerContainer>
|
||||
<div className="flex flex-col items-center justify-between gap-6 sm:flex-row">
|
||||
<div className="flex gap-6 text-sm font-medium text-zinc-800 dark:text-zinc-200">
|
||||
<NavLink href="/sobre-mim">Sobre mim</NavLink>
|
||||
<NavLink href="/projetos">Projetos</NavLink>
|
||||
</div>
|
||||
<p className="text-sm text-zinc-400 dark:text-zinc-500">
|
||||
© {new Date().getFullYear()} Filipe Medeiros. Feito, sem
|
||||
vergonha, com{' '}
|
||||
<HybridLink
|
||||
aria-label="Link para o website de TailwindUI"
|
||||
href="https://tailwindui.com"
|
||||
className="underline transition-colors hover:text-teal-500"
|
||||
>
|
||||
TailwindUI
|
||||
</HybridLink>
|
||||
. Código{' '}
|
||||
<HybridLink
|
||||
aria-label="Link para o código do website"
|
||||
href="https://codeberg.org/filipesm/personal-website"
|
||||
className="underline transition-colors hover:text-teal-500"
|
||||
>
|
||||
aqui
|
||||
</HybridLink>
|
||||
.
|
||||
</p>
|
||||
</div>
|
||||
</InnerContainer>
|
||||
</div>
|
||||
</OuterContainer>
|
||||
</footer>
|
||||
)
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
import Link from 'next/link'
|
||||
import { type ComponentProps, type PropsWithChildren, forwardRef } from 'react'
|
||||
|
||||
export type Props = ComponentProps<typeof Link>
|
||||
|
||||
const HybridLink = forwardRef<HTMLAnchorElement, Props>(function HybridLink(
|
||||
{ href, children, ...rest }: PropsWithChildren<Props>,
|
||||
ref,
|
||||
) {
|
||||
if (href && (typeof href !== 'string' || href.startsWith('/')))
|
||||
return (
|
||||
<Link href={href} {...rest} ref={ref}>
|
||||
{children}
|
||||
</Link>
|
||||
)
|
||||
else
|
||||
return (
|
||||
<a href={href} {...rest} ref={ref}>
|
||||
{children}
|
||||
</a>
|
||||
)
|
||||
})
|
||||
|
||||
export default HybridLink
|
|
@ -1,9 +0,0 @@
|
|||
import { PropsWithChildren } from 'react'
|
||||
|
||||
export interface Props {
|
||||
as: 'ol' | 'ul'
|
||||
}
|
||||
|
||||
export default function List({ as: Tag, children }: PropsWithChildren<Props>) {
|
||||
return <Tag>{children}</Tag>
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
import clsx from 'clsx'
|
||||
import { type PropsWithChildren } from 'react'
|
||||
|
||||
export function Prose({
|
||||
children,
|
||||
className,
|
||||
}: PropsWithChildren<{ className?: string }>) {
|
||||
return (
|
||||
<div className={clsx(className, 'prose dark:prose-invert')}>{children}</div>
|
||||
)
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
import {
|
||||
type RichTextItemResponse,
|
||||
type TextRichTextItemResponse,
|
||||
} from '@notionhq/client/build/src/api-endpoints'
|
||||
import clsx from 'clsx'
|
||||
import { type ElementType, type PropsWithChildren } from 'react'
|
||||
|
||||
import HybridLink from './HybridLink'
|
||||
import TeX, { SyncTeX } from './TeX'
|
||||
|
||||
function wrapWithTag(Element: ElementType, Tag: keyof JSX.IntrinsicElements) {
|
||||
return function Wrapped({ children }: PropsWithChildren) {
|
||||
return (
|
||||
<Tag>
|
||||
<Element>{children}</Element>
|
||||
</Tag>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function getWrapperFromAnnotations(
|
||||
annotations: TextRichTextItemResponse['annotations'],
|
||||
) {
|
||||
let Wrapper = ({ children }: PropsWithChildren) => {
|
||||
return <>{children}</>
|
||||
}
|
||||
|
||||
if (annotations.italic) {
|
||||
Wrapper = wrapWithTag(Wrapper, 'i')
|
||||
}
|
||||
if (annotations.bold) {
|
||||
Wrapper = wrapWithTag(Wrapper, 'b')
|
||||
}
|
||||
if (annotations.underline) {
|
||||
Wrapper = wrapWithTag(Wrapper, 'u')
|
||||
}
|
||||
if (annotations.code) {
|
||||
Wrapper = wrapWithTag(Wrapper, 'code')
|
||||
}
|
||||
if (annotations.code) {
|
||||
Wrapper = wrapWithTag(Wrapper, 's')
|
||||
}
|
||||
|
||||
return Wrapper
|
||||
}
|
||||
|
||||
export default function RichText({
|
||||
richText,
|
||||
rss = false,
|
||||
}: {
|
||||
richText: RichTextItemResponse[]
|
||||
rss?: boolean
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
{richText.map((text, index) => {
|
||||
if (text.type === 'mention') return null // TODO
|
||||
else if (text.type === 'text') {
|
||||
const Wrapper = getWrapperFromAnnotations(text.annotations)
|
||||
|
||||
const className = clsx({
|
||||
italic: text.annotations.italic,
|
||||
'font-bold': text.annotations.bold,
|
||||
underline: text.annotations.underline,
|
||||
'dark:bg-neutral-800 border-1 dark:border-neutral-500 font-mono dark:text-red-400 p-1 rounded':
|
||||
text.annotations.code,
|
||||
strikethrough: text.annotations.strikethrough,
|
||||
})
|
||||
|
||||
if (text.href)
|
||||
return (
|
||||
<Wrapper key={index}>
|
||||
<HybridLink
|
||||
href={text.href}
|
||||
className={clsx(
|
||||
'underline transition-colors hover:text-teal-500',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
{text.plain_text}
|
||||
</HybridLink>
|
||||
</Wrapper>
|
||||
)
|
||||
else
|
||||
return className ? (
|
||||
<Wrapper key={index}>
|
||||
<span className={className}>{text.plain_text}</span>
|
||||
</Wrapper>
|
||||
) : (
|
||||
<Wrapper key={index}>{text.plain_text}</Wrapper>
|
||||
)
|
||||
} else if (text.type === 'equation') {
|
||||
const Component = rss ? SyncTeX : TeX
|
||||
// @ts-expect-error Server Component
|
||||
return <Component key={index} math={text.equation.expression} />
|
||||
}
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
import { type PropsWithChildren, useId } from 'react'
|
||||
|
||||
export default function Section({
|
||||
title,
|
||||
children,
|
||||
}: PropsWithChildren<{ title: string }>) {
|
||||
let id = useId()
|
||||
|
||||
return (
|
||||
<section
|
||||
aria-labelledby={id}
|
||||
className="md:border-l md:border-zinc-100 md:pl-6 md:dark:border-zinc-700/40"
|
||||
>
|
||||
<div className="grid max-w-3xl grid-cols-1 items-baseline gap-y-8 md:grid-cols-4">
|
||||
<h2
|
||||
id={id}
|
||||
className="text-sm font-semibold text-zinc-800 dark:text-zinc-100"
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
<div className="md:col-span-3">{children}</div>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
import { type PropsWithChildren } from 'react'
|
||||
|
||||
import Container from './Container'
|
||||
|
||||
export default function SimpleLayout({
|
||||
title,
|
||||
intro,
|
||||
children,
|
||||
}: PropsWithChildren<{ title: string; intro: string }>) {
|
||||
return (
|
||||
<Container className="mt-16 sm:mt-32">
|
||||
<header className="max-w-2xl">
|
||||
<h1 className="text-4xl font-bold tracking-tight text-zinc-800 dark:text-zinc-100 sm:text-5xl">
|
||||
{title}
|
||||
</h1>
|
||||
<p className="mt-6 text-base text-zinc-600 dark:text-zinc-400">
|
||||
{intro}
|
||||
</p>
|
||||
</header>
|
||||
<div className="mt-16 sm:mt-20">{children}</div>
|
||||
</Container>
|
||||
)
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
import clsx from 'clsx'
|
||||
import { type PropsWithChildren } from 'react'
|
||||
|
||||
import { type SelectColor } from '@/lib/notion/types'
|
||||
|
||||
export default function Tag({
|
||||
notionColorName,
|
||||
children,
|
||||
}: PropsWithChildren<{ notionColorName?: SelectColor }>) {
|
||||
return (
|
||||
<span
|
||||
className={clsx(
|
||||
notionColorName && `notion-color-${notionColorName}`,
|
||||
'whitespace-nowrap rounded bg-[var(--light-bg)] py-1 px-2 text-[var(--light-text)] dark:bg-[var(--dark-bg)] dark:text-[var(--dark-text)]',
|
||||
)}
|
||||
>
|
||||
{children}
|
||||
</span>
|
||||
)
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
import katex, { type KatexOptions, ParseError } from 'katex'
|
||||
import { type ComponentProps, type ReactElement } from 'react'
|
||||
|
||||
export type Props<T extends keyof JSX.IntrinsicElements = 'div'> =
|
||||
ComponentProps<T> &
|
||||
Partial<{
|
||||
as: T
|
||||
block: boolean
|
||||
errorColor: string
|
||||
renderError: (error: ParseError | TypeError) => ReactElement
|
||||
settings: KatexOptions
|
||||
}> & {
|
||||
math: string
|
||||
}
|
||||
|
||||
/**
|
||||
* This is only used for the RSS feed
|
||||
*/
|
||||
export function SyncTeX({
|
||||
children,
|
||||
math,
|
||||
block,
|
||||
errorColor,
|
||||
renderError,
|
||||
settings,
|
||||
as: asComponent,
|
||||
...props
|
||||
}: Props) {
|
||||
const Component = asComponent || (block ? 'div' : 'span')
|
||||
const content = (children ?? math) as string
|
||||
|
||||
let innerHtml: string
|
||||
try {
|
||||
innerHtml = katex.renderToString(content, {
|
||||
displayMode: !!block,
|
||||
errorColor,
|
||||
throwOnError: !!renderError,
|
||||
...settings,
|
||||
})
|
||||
} catch (error) {
|
||||
if (error instanceof ParseError || error instanceof TypeError) {
|
||||
if (renderError) {
|
||||
return renderError(error)
|
||||
} else {
|
||||
innerHtml = error.message
|
||||
}
|
||||
} else {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<Component {...props} dangerouslySetInnerHTML={{ __html: innerHtml }} />
|
||||
)
|
||||
}
|
||||
|
||||
export default async function TeX(props: Props) {
|
||||
// @ts-expect-error CSS not JS
|
||||
await import('katex/dist/katex.min.css')
|
||||
|
||||
return <SyncTeX {...props} />
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
import { type SVGAttributes } from 'react'
|
||||
|
||||
export type IconProps = SVGAttributes<HTMLOrSVGElement>
|
||||
|
||||
export const CloseIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="m17.25 6.75-10.5 10.5M6.75 6.75l10.5 10.5"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const ChevronDownIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 8 6" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="M1.75 1.75 4 4.25l2.25-2.5"
|
||||
fill="none"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const SunIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
{...props}
|
||||
>
|
||||
<path d="M8 12.25A4.25 4.25 0 0 1 12.25 8v0a4.25 4.25 0 0 1 4.25 4.25v0a4.25 4.25 0 0 1-4.25 4.25v0A4.25 4.25 0 0 1 8 12.25v0Z" />
|
||||
<path
|
||||
d="M12.25 3v1.5M21.5 12.25H20M18.791 18.791l-1.06-1.06M18.791 5.709l-1.06 1.06M12.25 20v1.5M4.5 12.25H3M6.77 6.77 5.709 5.709M6.77 17.73l-1.061 1.061"
|
||||
fill="none"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const MoonIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path
|
||||
d="M17.25 16.22a6.937 6.937 0 0 1-9.47-9.47 7.451 7.451 0 1 0 9.47 9.47ZM12.75 7C17 7 17 2.75 17 2.75S17 7 21.25 7C17 7 17 11.25 17 11.25S17 7 12.75 7Z"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const CodebergIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="-0.2 -0.2 4.7 4.7" {...props}>
|
||||
<title>Codeberg logo</title>
|
||||
<g transform="matrix(0.06551432,0,0,0.06551432,-2.232417,-1.431776)">
|
||||
<path
|
||||
d="m 42519.285,-7078.7891 a 0.76086879,0.56791688 0 0 0 -0.738,0.6739 l 33.586,125.8886 a 87.182358,87.182358 0 0 0 39.381,-33.7636 l -71.565,-92.5196 a 0.76086879,0.56791688 0 0 0 -0.664,-0.2793 z"
|
||||
transform="matrix(0.37058478,0,0,0.37058478,-15690.065,2662.0533)"
|
||||
/>
|
||||
<path
|
||||
d="m 11249.461,-1883.6961 c -12.74,0 -23.067,10.3275 -23.067,23.0671 0,4.3335 1.22,8.5795 3.522,12.2514 l 19.232,-24.8636 c 0.138,-0.1796 0.486,-0.1796 0.624,0 l 19.233,24.8646 c 2.302,-3.6721 3.523,-7.9185 3.523,-12.2524 0,-12.7396 -10.327,-23.0671 -23.067,-23.0671 z"
|
||||
transform="matrix(1.4006354,0,0,1.4006354,-15690.065,2662.0533)"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const TwitterIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path d="M20.055 7.983c.011.174.011.347.011.523 0 5.338-3.92 11.494-11.09 11.494v-.003A10.755 10.755 0 0 1 3 18.186c.308.038.618.057.928.058a7.655 7.655 0 0 0 4.841-1.733c-1.668-.032-3.13-1.16-3.642-2.805a3.753 3.753 0 0 0 1.76-.07C5.07 13.256 3.76 11.6 3.76 9.676v-.05a3.77 3.77 0 0 0 1.77.505C3.816 8.945 3.288 6.583 4.322 4.737c1.98 2.524 4.9 4.058 8.034 4.22a4.137 4.137 0 0 1 1.128-3.86A3.807 3.807 0 0 1 19 5.274a7.657 7.657 0 0 0 2.475-.98c-.29.934-.9 1.729-1.713 2.233A7.54 7.54 0 0 0 22 5.89a8.084 8.084 0 0 1-1.945 2.093Z" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const InstagramIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path d="M12 3c-2.444 0-2.75.01-3.71.054-.959.044-1.613.196-2.185.418A4.412 4.412 0 0 0 4.51 4.511c-.5.5-.809 1.002-1.039 1.594-.222.572-.374 1.226-.418 2.184C3.01 9.25 3 9.556 3 12s.01 2.75.054 3.71c.044.959.196 1.613.418 2.185.23.592.538 1.094 1.039 1.595.5.5 1.002.808 1.594 1.038.572.222 1.226.374 2.184.418C9.25 20.99 9.556 21 12 21s2.75-.01 3.71-.054c.959-.044 1.613-.196 2.185-.419a4.412 4.412 0 0 0 1.595-1.038c.5-.5.808-1.002 1.038-1.594.222-.572.374-1.226.418-2.184.044-.96.054-1.267.054-3.711s-.01-2.75-.054-3.71c-.044-.959-.196-1.613-.419-2.185A4.412 4.412 0 0 0 19.49 4.51c-.5-.5-1.002-.809-1.594-1.039-.572-.222-1.226-.374-2.184-.418C14.75 3.01 14.444 3 12 3Zm0 1.622c2.403 0 2.688.009 3.637.052.877.04 1.354.187 1.67.31.421.163.72.358 1.036.673.315.315.51.615.673 1.035.123.317.27.794.31 1.671.043.95.052 1.234.052 3.637s-.009 2.688-.052 3.637c-.04.877-.187 1.354-.31 1.67-.163.421-.358.72-.673 1.036a2.79 2.79 0 0 1-1.035.673c-.317.123-.794.27-1.671.31-.95.043-1.234.052-3.637.052s-2.688-.009-3.637-.052c-.877-.04-1.354-.187-1.67-.31a2.789 2.789 0 0 1-1.036-.673 2.79 2.79 0 0 1-.673-1.035c-.123-.317-.27-.794-.31-1.671-.043-.95-.052-1.234-.052-3.637s.009-2.688.052-3.637c.04-.877.187-1.354.31-1.67.163-.421.358-.72.673-1.036.315-.315.615-.51 1.035-.673.317-.123.794-.27 1.671-.31.95-.043 1.234-.052 3.637-.052Z" />
|
||||
<path d="M12 15a3 3 0 1 1 0-6 3 3 0 0 1 0 6Zm0-7.622a4.622 4.622 0 1 0 0 9.244 4.622 4.622 0 0 0 0-9.244Zm5.884-.182a1.08 1.08 0 1 1-2.16 0 1.08 1.08 0 0 1 2.16 0Z" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const GitHubIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M12 2C6.475 2 2 6.588 2 12.253c0 4.537 2.862 8.369 6.838 9.727.5.09.687-.218.687-.487 0-.243-.013-1.05-.013-1.91C7 20.059 6.35 18.957 6.15 18.38c-.113-.295-.6-1.205-1.025-1.448-.35-.192-.85-.667-.013-.68.788-.012 1.35.744 1.538 1.051.9 1.551 2.338 1.116 2.912.846.088-.666.35-1.115.638-1.371-2.225-.256-4.55-1.14-4.55-5.062 0-1.115.387-2.038 1.025-2.756-.1-.256-.45-1.307.1-2.717 0 0 .837-.269 2.75 1.051.8-.23 1.65-.346 2.5-.346.85 0 1.7.115 2.5.346 1.912-1.333 2.75-1.05 2.75-1.05.55 1.409.2 2.46.1 2.716.637.718 1.025 1.628 1.025 2.756 0 3.934-2.337 4.806-4.562 5.062.362.32.675.936.675 1.897 0 1.371-.013 2.473-.013 2.82 0 .268.188.589.688.486a10.039 10.039 0 0 0 4.932-3.74A10.447 10.447 0 0 0 22 12.253C22 6.588 17.525 2 12 2Z"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const LinkedInIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" {...props}>
|
||||
<path d="M18.335 18.339H15.67v-4.177c0-.996-.02-2.278-1.39-2.278-1.389 0-1.601 1.084-1.601 2.205v4.25h-2.666V9.75h2.56v1.17h.035c.358-.674 1.228-1.387 2.528-1.387 2.7 0 3.2 1.778 3.2 4.091v4.715zM7.003 8.575a1.546 1.546 0 01-1.548-1.549 1.548 1.548 0 111.547 1.549zm1.336 9.764H5.666V9.75H8.34v8.589zM19.67 3H4.329C3.593 3 3 3.58 3 4.297v15.406C3 20.42 3.594 21 4.328 21h15.338C20.4 21 21 20.42 21 19.703V4.297C21 3.58 20.4 3 19.666 3h.003z" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const MastodonLogo = (props: IconProps) => {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
aria-hidden="true"
|
||||
viewBox="-10 -10 90 93"
|
||||
{...props}
|
||||
>
|
||||
<path d="M73.7014 17.4323C72.5616 9.05152 65.1774 2.4469 56.424 1.1671C54.9472 0.950843 49.3518 0.163818 36.3901 0.163818H36.2933C23.3281 0.163818 20.5465 0.950843 19.0697 1.1671C10.56 2.41145 2.78877 8.34604 0.903306 16.826C-0.00357854 21.0022 -0.100361 25.6322 0.068112 29.8793C0.308275 35.9699 0.354874 42.0498 0.91406 48.1156C1.30064 52.1448 1.97502 56.1419 2.93215 60.0769C4.72441 67.3445 11.9795 73.3925 19.0876 75.86C26.6979 78.4332 34.8821 78.8603 42.724 77.0937C43.5866 76.8952 44.4398 76.6647 45.2833 76.4024C47.1867 75.8033 49.4199 75.1332 51.0616 73.9562C51.0841 73.9397 51.1026 73.9184 51.1156 73.8938C51.1286 73.8693 51.1359 73.8421 51.1368 73.8144V67.9366C51.1364 67.9107 51.1302 67.8852 51.1186 67.862C51.1069 67.8388 51.0902 67.8184 51.0695 67.8025C51.0489 67.7865 51.0249 67.7753 50.9994 67.7696C50.9738 67.764 50.9473 67.7641 50.9218 67.7699C45.8976 68.9569 40.7491 69.5519 35.5836 69.5425C26.694 69.5425 24.3031 65.3699 23.6184 63.6327C23.0681 62.1314 22.7186 60.5654 22.5789 58.9744C22.5775 58.9477 22.5825 58.921 22.5934 58.8965C22.6043 58.8721 22.621 58.8505 22.6419 58.8336C22.6629 58.8167 22.6876 58.8049 22.714 58.7992C22.7404 58.7934 22.7678 58.794 22.794 58.8007C27.7345 59.9796 32.799 60.5746 37.8813 60.5733C39.1036 60.5733 40.3223 60.5733 41.5447 60.5414C46.6562 60.3996 52.0437 60.1408 57.0728 59.1694C57.1983 59.1446 57.3237 59.1233 57.4313 59.0914C65.3638 57.5847 72.9128 52.8555 73.6799 40.8799C73.7086 40.4084 73.7803 35.9415 73.7803 35.4523C73.7839 33.7896 74.3216 23.6576 73.7014 17.4323ZM61.4925 47.3144H53.1514V27.107C53.1514 22.8528 51.3591 20.6832 47.7136 20.6832C43.7061 20.6832 41.6988 23.2499 41.6988 28.3194V39.3803H33.4078V28.3194C33.4078 23.2499 31.3969 20.6832 27.3894 20.6832C23.7654 20.6832 21.9552 22.8528 21.9516 27.107V47.3144H13.6176V26.4937C13.6176 22.2395 14.7157 18.8598 16.9118 16.3545C19.1772 13.8552 22.1488 12.5719 25.8373 12.5719C30.1064 12.5719 33.3325 14.1955 35.4832 17.4394L37.5587 20.8853L39.6377 17.4394C41.7884 14.1955 45.0145 12.5719 49.2765 12.5719C52.9614 12.5719 55.9329 13.8552 58.2055 16.3545C60.4017 18.8574 61.4997 22.2371 61.4997 26.4937L61.4925 47.3144Z" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export const RSSIcon = (props: IconProps) => {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="currentColor"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
clipRule="evenodd"
|
||||
d="M3.75 4.5a.75.75 0 01.75-.75h.75c8.284 0 15 6.716 15 15v.75a.75.75 0 01-.75.75h-.75a.75.75 0 01-.75-.75v-.75C18 11.708 12.292 6 5.25 6H4.5a.75.75 0 01-.75-.75V4.5zm0 6.75a.75.75 0 01.75-.75h.75a8.25 8.25 0 018.25 8.25v.75a.75.75 0 01-.75.75H12a.75.75 0 01-.75-.75v-.75a6 6 0 00-6-6H4.5a.75.75 0 01-.75-.75v-.75zm0 7.5a1.5 1.5 0 113 0 1.5 1.5 0 01-3 0z"
|
||||
/>
|
||||
</svg>
|
||||
)
|
||||
}
|
|
@ -1,306 +0,0 @@
|
|||
import { type BlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'
|
||||
import clsx from 'clsx'
|
||||
import Image from 'next/image'
|
||||
import { type FC } from 'react'
|
||||
|
||||
import Callout, { CalloutIcon } from '@/components/server/Callout'
|
||||
import CodeSnippet, { SyncCodeSnippet } from '@/components/server/CodeSnippet'
|
||||
import List from '@/components/server/List'
|
||||
import RichText from '@/components/server/RichText'
|
||||
import TeX, { SyncTeX } from '@/components/server/TeX'
|
||||
import { type Block, type BlockType } from '@/lib/notion/types'
|
||||
import extractCurrentListItems from '@/lib/notion/utils/extractCurrentListItems'
|
||||
import getProxiedAssetUrl from '@/lib/notion/utils/getProxiedAssetUrl'
|
||||
import richTextAsPlainText from '@/lib/notion/utils/richTextToPlainText'
|
||||
|
||||
export const blockRenderMap: {
|
||||
[T in BlockType]: FC<{ block: Block<T> }>
|
||||
} = {
|
||||
paragraph: ({ block }) => (
|
||||
<p className="mb-6 text-justify">
|
||||
<RichText richText={block.paragraph.rich_text} />
|
||||
</p>
|
||||
),
|
||||
heading_1: ({ block }) => (
|
||||
<>
|
||||
<h2
|
||||
id={block.id}
|
||||
className="font-display mb-6 text-4xl before:-mt-40 before:block before:h-40"
|
||||
>
|
||||
<RichText richText={block.heading_1.rich_text} />
|
||||
</h2>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.has_children && <RenderBlockList blockList={block.children} />}
|
||||
</>
|
||||
),
|
||||
heading_2: ({ block }) => (
|
||||
<>
|
||||
<h3
|
||||
id={block.id}
|
||||
className="font-display mb-5 text-2xl before:-mt-40 before:block before:h-40"
|
||||
>
|
||||
<RichText richText={block.heading_2.rich_text} />
|
||||
</h3>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.has_children && <RenderBlockList blockList={block.children} />}
|
||||
</>
|
||||
),
|
||||
heading_3: ({ block }) => (
|
||||
<>
|
||||
<h4
|
||||
id={block.id}
|
||||
className="font-display mb-5 text-xl before:-mt-40 before:block before:h-40"
|
||||
>
|
||||
<RichText richText={block.heading_3.rich_text} />
|
||||
</h4>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.has_children && <RenderBlockList blockList={block.children} />}
|
||||
</>
|
||||
),
|
||||
image: ({ block }) => {
|
||||
const caption = block.image.caption
|
||||
const altText = caption[0]?.plain_text.startsWith('alt: ')
|
||||
? richTextAsPlainText(caption).substring(5)
|
||||
: richTextAsPlainText(caption)
|
||||
return (
|
||||
<figure className="mb-6">
|
||||
<Image
|
||||
alt={altText}
|
||||
className={clsx('h-auto w-full rounded object-cover', {
|
||||
'mb-2': block.image.caption.length > 0,
|
||||
})}
|
||||
src={getProxiedAssetUrl({
|
||||
blockId: block.id,
|
||||
lastEditedTime: block.last_edited_time,
|
||||
})}
|
||||
width={9999} // TODO
|
||||
height={9999} // TODO
|
||||
/>
|
||||
{block.image.caption.length > 0 && (
|
||||
<figcaption className="text-sm font-light">
|
||||
<RichText richText={block.image.caption} />
|
||||
</figcaption>
|
||||
)}
|
||||
</figure>
|
||||
)
|
||||
},
|
||||
bulleted_list_item: ({ block }) => (
|
||||
<li>
|
||||
<RichText richText={block.bulleted_list_item.rich_text} />
|
||||
</li>
|
||||
),
|
||||
numbered_list_item: ({ block }) => (
|
||||
<li>
|
||||
<RichText richText={block.numbered_list_item.rich_text} />
|
||||
</li>
|
||||
),
|
||||
quote: ({ block }) => (
|
||||
<blockquote className="border-l-1 mb-6 bg-gradient-to-r from-[#171717] px-10 py-7 text-justify dark:[border-image:linear-gradient(to_bottom,rgba(255,255,255,1),rgba(255,255,255,0))_1]">
|
||||
<RichText richText={block.quote.rich_text} />
|
||||
</blockquote>
|
||||
),
|
||||
toggle: ({ block }) => (
|
||||
<details>
|
||||
<summary>
|
||||
<RichText richText={block.toggle.rich_text} />
|
||||
</summary>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.children && <RenderBlockList blockList={block.children} />}
|
||||
</details>
|
||||
),
|
||||
callout: ({ block }) => (
|
||||
<Callout>
|
||||
<CalloutIcon icon={block.callout.icon} />
|
||||
<RichText richText={block.callout.rich_text} />
|
||||
</Callout>
|
||||
),
|
||||
// @ts-expect-error Server Component
|
||||
equation: ({ block }) => <TeX block math={block.equation.expression} />,
|
||||
divider: () => (
|
||||
<hr className="my-9 [border-image:linear-gradient(to_right,#424242,#FFFFFF00)_1]" />
|
||||
),
|
||||
code: ({ block }) => (
|
||||
// @ts-expect-error Server Component
|
||||
<CodeSnippet
|
||||
language={block.code.language}
|
||||
codeRichText={block.code.rich_text}
|
||||
/>
|
||||
),
|
||||
|
||||
// TODO?
|
||||
table_of_contents: ({ block }) => <></>,
|
||||
column_list: ({ block }) => <></>,
|
||||
column: ({ block }) => <></>,
|
||||
link_to_page: ({ block }) => <></>,
|
||||
table: ({ block }) => <></>,
|
||||
table_row: ({ block }) => <></>,
|
||||
embed: ({ block }) => <></>,
|
||||
bookmark: ({ block }) => <></>,
|
||||
video: ({ block }) => <></>,
|
||||
pdf: ({ block }) => <></>,
|
||||
file: ({ block }) => <></>,
|
||||
audio: ({ block }) => <></>,
|
||||
link_preview: ({ block }) => <></>,
|
||||
breadcrumb: ({ block }) => <></>,
|
||||
synced_block: ({ block }) => <></>,
|
||||
template: ({ block }) => <></>,
|
||||
to_do: ({ block }) => <></>,
|
||||
child_page: ({ block }) => <></>,
|
||||
child_database: ({ block }) => <></>,
|
||||
unsupported: ({ block }) => <></>,
|
||||
}
|
||||
|
||||
export const rssBlockRenderMap: typeof blockRenderMap = {
|
||||
...blockRenderMap,
|
||||
paragraph: ({ block }) => (
|
||||
<p className="mb-6 text-justify">
|
||||
<RichText rss richText={block.paragraph.rich_text} />
|
||||
</p>
|
||||
),
|
||||
heading_1: ({ block }) => (
|
||||
<>
|
||||
<h2
|
||||
id={block.id}
|
||||
className="font-display mb-6 text-4xl before:-mt-40 before:block before:h-40"
|
||||
>
|
||||
<RichText rss richText={block.heading_1.rich_text} />
|
||||
</h2>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.has_children && <RenderBlockList blockList={block.children} />}
|
||||
</>
|
||||
),
|
||||
heading_2: ({ block }) => (
|
||||
<>
|
||||
<h3
|
||||
id={block.id}
|
||||
className="font-display mb-5 text-2xl before:-mt-40 before:block before:h-40"
|
||||
>
|
||||
<RichText rss richText={block.heading_2.rich_text} />
|
||||
</h3>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.has_children && <RenderBlockList blockList={block.children} />}
|
||||
</>
|
||||
),
|
||||
heading_3: ({ block }) => (
|
||||
<>
|
||||
<h4
|
||||
id={block.id}
|
||||
className="font-display mb-5 text-xl before:-mt-40 before:block before:h-40"
|
||||
>
|
||||
<RichText rss richText={block.heading_3.rich_text} />
|
||||
</h4>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.has_children && <RenderBlockList blockList={block.children} />}
|
||||
</>
|
||||
),
|
||||
image: ({ block }) => {
|
||||
const caption = block.image.caption
|
||||
const altText = caption[0]?.plain_text.startsWith('alt: ')
|
||||
? richTextAsPlainText(caption).substring(5)
|
||||
: richTextAsPlainText(caption)
|
||||
return (
|
||||
<figure className="mb-6">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
alt={altText}
|
||||
className={clsx('h-auto w-full rounded object-cover', {
|
||||
'mb-2': block.image.caption.length > 0,
|
||||
})}
|
||||
src={getProxiedAssetUrl({
|
||||
blockId: block.id,
|
||||
lastEditedTime: block.last_edited_time,
|
||||
withBaseUrl: true,
|
||||
})}
|
||||
/>
|
||||
{block.image.caption.length > 0 && (
|
||||
<figcaption className="text-sm font-light">
|
||||
<RichText rss richText={block.image.caption} />
|
||||
</figcaption>
|
||||
)}
|
||||
</figure>
|
||||
)
|
||||
},
|
||||
bulleted_list_item: ({ block }) => (
|
||||
<li>
|
||||
<RichText rss richText={block.bulleted_list_item.rich_text} />
|
||||
</li>
|
||||
),
|
||||
numbered_list_item: ({ block }) => (
|
||||
<li>
|
||||
<RichText rss richText={block.numbered_list_item.rich_text} />
|
||||
</li>
|
||||
),
|
||||
quote: ({ block }) => (
|
||||
<blockquote className="border-l-1 mb-6 bg-gradient-to-r from-[#171717] px-10 py-7 text-justify dark:[border-image:linear-gradient(to_bottom,rgba(255,255,255,1),rgba(255,255,255,0))_1]">
|
||||
<RichText rss richText={block.quote.rich_text} />
|
||||
</blockquote>
|
||||
),
|
||||
toggle: ({ block }) => (
|
||||
<details>
|
||||
<summary>
|
||||
<RichText rss richText={block.toggle.rich_text} />
|
||||
</summary>
|
||||
{/* @ts-expect-error TODO find a way to fix this type */}
|
||||
{block.children && <RenderBlockList blockList={block.children} />}
|
||||
</details>
|
||||
),
|
||||
callout: ({ block }) => (
|
||||
<Callout>
|
||||
<CalloutIcon icon={block.callout.icon} />
|
||||
<RichText rss richText={block.callout.rich_text} />
|
||||
</Callout>
|
||||
),
|
||||
equation: ({ block }) => <SyncTeX block math={block.equation.expression} />,
|
||||
code: ({ block }) => (
|
||||
<SyncCodeSnippet
|
||||
language={block.code.language}
|
||||
codeRichText={block.code.rich_text}
|
||||
/>
|
||||
),
|
||||
}
|
||||
|
||||
export const RenderBlockList = ({
|
||||
blockList,
|
||||
rss = false,
|
||||
}: {
|
||||
blockList: BlockObjectResponse[]
|
||||
rss?: boolean
|
||||
}) => {
|
||||
return (
|
||||
<>
|
||||
{blockList.map((block, index, list) => {
|
||||
const isListItem =
|
||||
block.type === 'bulleted_list_item' ||
|
||||
block.type === 'numbered_list_item'
|
||||
|
||||
if (!isListItem)
|
||||
return <RenderBlock rss={rss} key={block.id} block={block} />
|
||||
else if (list[index - 1].type !== block.type)
|
||||
return (
|
||||
<List
|
||||
key={block.id}
|
||||
as={block.type === 'bulleted_list_item' ? 'ul' : 'ol'}
|
||||
>
|
||||
{extractCurrentListItems({ list, currentIndex: index }).map(
|
||||
(listItem) => (
|
||||
<RenderBlock rss={rss} key={listItem.id} block={listItem} />
|
||||
),
|
||||
)}
|
||||
</List>
|
||||
)
|
||||
})}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export function RenderBlock({
|
||||
block,
|
||||
rss = false,
|
||||
}: {
|
||||
block: BlockObjectResponse
|
||||
rss?: boolean
|
||||
}) {
|
||||
const Component = (rss ? rssBlockRenderMap : blockRenderMap)[block.type]
|
||||
// @ts-expect-error we know this is correct because `block.type` is the name we want to use as a key for `blockRenderMap`
|
||||
return <Component block={block} />
|
||||
}
|
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 1.6 KiB |
BIN
images/me.jpeg
Before Width: | Height: | Size: 104 KiB |
Before Width: | Height: | Size: 185 KiB |
|
@ -1,10 +0,0 @@
|
|||
const formatDate = (dateString: string) => {
|
||||
return new Date(`${dateString}`).toLocaleDateString('pt-PT', {
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
timeZone: 'UTC',
|
||||
})
|
||||
}
|
||||
|
||||
export default formatDate
|
|
@ -1,76 +0,0 @@
|
|||
import { Feed } from 'feed'
|
||||
import { mkdir, writeFile } from 'fs/promises'
|
||||
|
||||
import { RenderBlockList } from '@/components/server/renderNotionContent'
|
||||
|
||||
import { getAllBlogPosts } from './notion/content/blogPosts'
|
||||
import blockContentToPlainText from './notion/utils/blockContentToPlainText'
|
||||
import getBlockRecursively from './notion/utils/getBlockRecursively'
|
||||
import richTextAsPlainText from './notion/utils/richTextToPlainText'
|
||||
|
||||
export default async function generateRssFeed() {
|
||||
const blogPosts = await getAllBlogPosts()
|
||||
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL!
|
||||
|
||||
const author = {
|
||||
name: 'Filipe Medeiros',
|
||||
email: 'hello@filipesm.eu',
|
||||
link: 'https://filipesm.eu',
|
||||
}
|
||||
|
||||
const feed = new Feed({
|
||||
title: author.name,
|
||||
description:
|
||||
'Blog pessoal do Filipe. Escreve sobre tópicos diversos, maioritariamente de tecnologia, política, economia e atualidade.',
|
||||
author,
|
||||
id: siteUrl,
|
||||
link: siteUrl,
|
||||
image: `${siteUrl}/favicon.ico`,
|
||||
favicon: `${siteUrl}/favicon.ico`,
|
||||
copyright: `Todos os direitos reservados ${new Date().getFullYear()}`,
|
||||
feedLinks: {
|
||||
rss2: `${siteUrl}/rss/feed.xml`,
|
||||
json: `${siteUrl}/rss/feed.json`,
|
||||
},
|
||||
})
|
||||
|
||||
await Promise.all(
|
||||
blogPosts.map(async (blogPost) => {
|
||||
const url = `${siteUrl}/blog/${richTextAsPlainText(
|
||||
blogPost.properties.Slug.rich_text,
|
||||
)}`
|
||||
|
||||
const [content, reactDomServer] = await Promise.all([
|
||||
getBlockRecursively(blogPost.id),
|
||||
import('react-dom/server'),
|
||||
])
|
||||
|
||||
const html = reactDomServer.renderToStaticMarkup(
|
||||
<RenderBlockList rss blockList={content} />,
|
||||
)
|
||||
|
||||
feed.addItem({
|
||||
title: richTextAsPlainText(blogPost.properties.Name.title),
|
||||
id: url,
|
||||
link: url,
|
||||
description: richTextAsPlainText(
|
||||
blogPost.properties.Description.rich_text,
|
||||
),
|
||||
category: blogPost.properties.Topics.multi_select.map(({ name }) => ({
|
||||
name,
|
||||
})),
|
||||
contributor: [author],
|
||||
content: html,
|
||||
date: new Date(
|
||||
blogPost.properties.PublishDate.date?.start ?? blogPost.created_time,
|
||||
),
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
await mkdir('./public/rss', { recursive: true })
|
||||
await Promise.all([
|
||||
writeFile('./public/rss/feed.xml', feed.rss2(), 'utf8'),
|
||||
writeFile('./public/rss/feed.json', feed.json1(), 'utf8'),
|
||||
])
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
import { Client } from '@notionhq/client';
|
||||
|
||||
const notion = new Client({ auth: process.env['NOTION_TOKEN'] });
|
||||
|
||||
export default notion;
|
|
@ -1,85 +0,0 @@
|
|||
import notion from '../client'
|
||||
import { type PageWithProps } from '../types'
|
||||
import { and, richTextFilter, statusFilter } from '../utils/filters'
|
||||
import { sortProperty, sortTimestamp } from '../utils/sorts'
|
||||
import { collectPaginatedAPI, isFullPage } from '@notionhq/client'
|
||||
import { QueryDatabaseResponse } from '@notionhq/client/build/src/api-endpoints'
|
||||
import { cache } from 'react'
|
||||
|
||||
export type BlogPost = PageWithProps<{
|
||||
Status: 'status'
|
||||
Slug: 'rich_text'
|
||||
Description: 'rich_text'
|
||||
PublishDate: 'date'
|
||||
Topics: 'multi_select'
|
||||
|
||||
MetaDescription: 'rich_text'
|
||||
MetaTwitterCard: 'select'
|
||||
}>
|
||||
|
||||
export const databaseId = '0d40e441b70942f380c6b599d92018eb'
|
||||
|
||||
export const getFirstBlogPosts = cache(
|
||||
async ({ published = true }: { published?: boolean } = {}) =>
|
||||
notion.databases.query({
|
||||
database_id: databaseId,
|
||||
page_size: 10,
|
||||
sorts: [
|
||||
sortProperty('PublishDate', 'descending'),
|
||||
sortTimestamp('last_edited_time', 'descending'),
|
||||
],
|
||||
filter: published
|
||||
? and(
|
||||
richTextFilter('Slug', 'is_not_empty', true),
|
||||
statusFilter('Status', 'equals', 'Published'),
|
||||
)
|
||||
: undefined,
|
||||
}) as Promise<
|
||||
Omit<QueryDatabaseResponse, 'results'> & {
|
||||
results: BlogPost[]
|
||||
}
|
||||
>,
|
||||
)
|
||||
|
||||
export const getAllBlogPosts = cache(
|
||||
async ({ published = true }: { published?: boolean } = {}) =>
|
||||
collectPaginatedAPI(notion.databases.query, {
|
||||
database_id: databaseId,
|
||||
page_size: 100,
|
||||
sorts: [
|
||||
sortProperty('PublishDate', 'descending'),
|
||||
sortTimestamp('created_time', 'descending'),
|
||||
sortTimestamp('last_edited_time', 'descending'),
|
||||
],
|
||||
filter: published
|
||||
? and(
|
||||
richTextFilter('Slug', 'is_not_empty', true),
|
||||
statusFilter('Status', 'equals', 'Published'),
|
||||
)
|
||||
: undefined,
|
||||
}) as Promise<BlogPost[]>,
|
||||
)
|
||||
|
||||
export const getBlogPostBySlug = cache(
|
||||
async ({ slug, published = true }: { slug: string; published?: boolean }) => {
|
||||
const publishedFilter = statusFilter('Status', 'equals', 'Published')
|
||||
const slugFilter = richTextFilter('Slug', 'equals', slug)
|
||||
|
||||
const { results } = await (notion.databases.query({
|
||||
database_id: databaseId,
|
||||
filter: published ? and(publishedFilter, slugFilter) : slugFilter,
|
||||
}) as Promise<
|
||||
Omit<QueryDatabaseResponse, 'results'> & {
|
||||
results: BlogPost[]
|
||||
}
|
||||
>)
|
||||
|
||||
if (results.length !== 1) return undefined
|
||||
|
||||
if (!isFullPage(results[0])) return undefined
|
||||
|
||||
if (results[0].properties.Slug.rich_text.length === 0) return undefined
|
||||
|
||||
return results[0]
|
||||
},
|
||||
)
|
|
@ -1,23 +0,0 @@
|
|||
import notion from '../client'
|
||||
import { type PageWithProps } from '../types'
|
||||
import { collectPaginatedAPI } from '@notionhq/client'
|
||||
import { cache } from 'react'
|
||||
|
||||
export type Project = PageWithProps<{
|
||||
URL: 'url'
|
||||
URLName: 'rich_text'
|
||||
Description: 'rich_text'
|
||||
Tags: 'multi_select'
|
||||
Logo: 'files'
|
||||
LogoRatio: 'number'
|
||||
Color: 'rich_text'
|
||||
}>
|
||||
|
||||
export const databaseId = '7c9cf026e42e4d549001756d62bb09b7'
|
||||
|
||||
export const getProjects = cache(
|
||||
() =>
|
||||
collectPaginatedAPI(notion.databases.query, {
|
||||
database_id: databaseId,
|
||||
}) as Promise<Project[]>,
|
||||
)
|
|
@ -1,657 +0,0 @@
|
|||
// With some help of https://github.com/justjake/monorepo/blob/d1e87174827005fa7fd6d158a0a1d7e86dd2a396/packages/notion-api/src/lib/notion-api.ts
|
||||
import {
|
||||
GetBlockResponse,
|
||||
PageObjectResponse,
|
||||
} from '@notionhq/client/build/src/api-endpoints'
|
||||
|
||||
export type TimeZoneRequest =
|
||||
| 'Africa/Abidjan'
|
||||
| 'Africa/Accra'
|
||||
| 'Africa/Addis_Ababa'
|
||||
| 'Africa/Algiers'
|
||||
| 'Africa/Asmara'
|
||||
| 'Africa/Asmera'
|
||||
| 'Africa/Bamako'
|
||||
| 'Africa/Bangui'
|
||||
| 'Africa/Banjul'
|
||||
| 'Africa/Bissau'
|
||||
| 'Africa/Blantyre'
|
||||
| 'Africa/Brazzaville'
|
||||
| 'Africa/Bujumbura'
|
||||
| 'Africa/Cairo'
|
||||
| 'Africa/Casablanca'
|
||||
| 'Africa/Ceuta'
|
||||
| 'Africa/Conakry'
|
||||
| 'Africa/Dakar'
|
||||
| 'Africa/Dar_es_Salaam'
|
||||
| 'Africa/Djibouti'
|
||||
| 'Africa/Douala'
|
||||
| 'Africa/El_Aaiun'
|
||||
| 'Africa/Freetown'
|
||||
| 'Africa/Gaborone'
|
||||
| 'Africa/Harare'
|
||||
| 'Africa/Johannesburg'
|
||||
| 'Africa/Juba'
|
||||
| 'Africa/Kampala'
|
||||
| 'Africa/Khartoum'
|
||||
| 'Africa/Kigali'
|
||||
| 'Africa/Kinshasa'
|
||||
| 'Africa/Lagos'
|
||||
| 'Africa/Libreville'
|
||||
| 'Africa/Lome'
|
||||
| 'Africa/Luanda'
|
||||
| 'Africa/Lubumbashi'
|
||||
| 'Africa/Lusaka'
|
||||
| 'Africa/Malabo'
|
||||
| 'Africa/Maputo'
|
||||
| 'Africa/Maseru'
|
||||
| 'Africa/Mbabane'
|
||||
| 'Africa/Mogadishu'
|
||||
| 'Africa/Monrovia'
|
||||
| 'Africa/Nairobi'
|
||||
| 'Africa/Ndjamena'
|
||||
| 'Africa/Niamey'
|
||||
| 'Africa/Nouakchott'
|
||||
| 'Africa/Ouagadougou'
|
||||
| 'Africa/Porto-Novo'
|
||||
| 'Africa/Sao_Tome'
|
||||
| 'Africa/Timbuktu'
|
||||
| 'Africa/Tripoli'
|
||||
| 'Africa/Tunis'
|
||||
| 'Africa/Windhoek'
|
||||
| 'America/Adak'
|
||||
| 'America/Anchorage'
|
||||
| 'America/Anguilla'
|
||||
| 'America/Antigua'
|
||||
| 'America/Araguaina'
|
||||
| 'America/Argentina/Buenos_Aires'
|
||||
| 'America/Argentina/Catamarca'
|
||||
| 'America/Argentina/ComodRivadavia'
|
||||
| 'America/Argentina/Cordoba'
|
||||
| 'America/Argentina/Jujuy'
|
||||
| 'America/Argentina/La_Rioja'
|
||||
| 'America/Argentina/Mendoza'
|
||||
| 'America/Argentina/Rio_Gallegos'
|
||||
| 'America/Argentina/Salta'
|
||||
| 'America/Argentina/San_Juan'
|
||||
| 'America/Argentina/San_Luis'
|
||||
| 'America/Argentina/Tucuman'
|
||||
| 'America/Argentina/Ushuaia'
|
||||
| 'America/Aruba'
|
||||
| 'America/Asuncion'
|
||||
| 'America/Atikokan'
|
||||
| 'America/Atka'
|
||||
| 'America/Bahia'
|
||||
| 'America/Bahia_Banderas'
|
||||
| 'America/Barbados'
|
||||
| 'America/Belem'
|
||||
| 'America/Belize'
|
||||
| 'America/Blanc-Sablon'
|
||||
| 'America/Boa_Vista'
|
||||
| 'America/Bogota'
|
||||
| 'America/Boise'
|
||||
| 'America/Buenos_Aires'
|
||||
| 'America/Cambridge_Bay'
|
||||
| 'America/Campo_Grande'
|
||||
| 'America/Cancun'
|
||||
| 'America/Caracas'
|
||||
| 'America/Catamarca'
|
||||
| 'America/Cayenne'
|
||||
| 'America/Cayman'
|
||||
| 'America/Chicago'
|
||||
| 'America/Chihuahua'
|
||||
| 'America/Coral_Harbour'
|
||||
| 'America/Cordoba'
|
||||
| 'America/Costa_Rica'
|
||||
| 'America/Creston'
|
||||
| 'America/Cuiaba'
|
||||
| 'America/Curacao'
|
||||
| 'America/Danmarkshavn'
|
||||
| 'America/Dawson'
|
||||
| 'America/Dawson_Creek'
|
||||
| 'America/Denver'
|
||||
| 'America/Detroit'
|
||||
| 'America/Dominica'
|
||||
| 'America/Edmonton'
|
||||
| 'America/Eirunepe'
|
||||
| 'America/El_Salvador'
|
||||
| 'America/Ensenada'
|
||||
| 'America/Fort_Nelson'
|
||||
| 'America/Fort_Wayne'
|
||||
| 'America/Fortaleza'
|
||||
| 'America/Glace_Bay'
|
||||
| 'America/Godthab'
|
||||
| 'America/Goose_Bay'
|
||||
| 'America/Grand_Turk'
|
||||
| 'America/Grenada'
|
||||
| 'America/Guadeloupe'
|
||||
| 'America/Guatemala'
|
||||
| 'America/Guayaquil'
|
||||
| 'America/Guyana'
|
||||
| 'America/Halifax'
|
||||
| 'America/Havana'
|
||||
| 'America/Hermosillo'
|
||||
| 'America/Indiana/Indianapolis'
|
||||
| 'America/Indiana/Knox'
|
||||
| 'America/Indiana/Marengo'
|
||||
| 'America/Indiana/Petersburg'
|
||||
| 'America/Indiana/Tell_City'
|
||||
| 'America/Indiana/Vevay'
|
||||
| 'America/Indiana/Vincennes'
|
||||
| 'America/Indiana/Winamac'
|
||||
| 'America/Indianapolis'
|
||||
| 'America/Inuvik'
|
||||
| 'America/Iqaluit'
|
||||
| 'America/Jamaica'
|
||||
| 'America/Jujuy'
|
||||
| 'America/Juneau'
|
||||
| 'America/Kentucky/Louisville'
|
||||
| 'America/Kentucky/Monticello'
|
||||
| 'America/Knox_IN'
|
||||
| 'America/Kralendijk'
|
||||
| 'America/La_Paz'
|
||||
| 'America/Lima'
|
||||
| 'America/Los_Angeles'
|
||||
| 'America/Louisville'
|
||||
| 'America/Lower_Princes'
|
||||
| 'America/Maceio'
|
||||
| 'America/Managua'
|
||||
| 'America/Manaus'
|
||||
| 'America/Marigot'
|
||||
| 'America/Martinique'
|
||||
| 'America/Matamoros'
|
||||
| 'America/Mazatlan'
|
||||
| 'America/Mendoza'
|
||||
| 'America/Menominee'
|
||||
| 'America/Merida'
|
||||
| 'America/Metlakatla'
|
||||
| 'America/Mexico_City'
|
||||
| 'America/Miquelon'
|
||||
| 'America/Moncton'
|
||||
| 'America/Monterrey'
|
||||
| 'America/Montevideo'
|
||||
| 'America/Montreal'
|
||||
| 'America/Montserrat'
|
||||
| 'America/Nassau'
|
||||
| 'America/New_York'
|
||||
| 'America/Nipigon'
|
||||
| 'America/Nome'
|
||||
| 'America/Noronha'
|
||||
| 'America/North_Dakota/Beulah'
|
||||
| 'America/North_Dakota/Center'
|
||||
| 'America/North_Dakota/New_Salem'
|
||||
| 'America/Ojinaga'
|
||||
| 'America/Panama'
|
||||
| 'America/Pangnirtung'
|
||||
| 'America/Paramaribo'
|
||||
| 'America/Phoenix'
|
||||
| 'America/Port-au-Prince'
|
||||
| 'America/Port_of_Spain'
|
||||
| 'America/Porto_Acre'
|
||||
| 'America/Porto_Velho'
|
||||
| 'America/Puerto_Rico'
|
||||
| 'America/Punta_Arenas'
|
||||
| 'America/Rainy_River'
|
||||
| 'America/Rankin_Inlet'
|
||||
| 'America/Recife'
|
||||
| 'America/Regina'
|
||||
| 'America/Resolute'
|
||||
| 'America/Rio_Branco'
|
||||
| 'America/Rosario'
|
||||
| 'America/Santa_Isabel'
|
||||
| 'America/Santarem'
|
||||
| 'America/Santiago'
|
||||
| 'America/Santo_Domingo'
|
||||
| 'America/Sao_Paulo'
|
||||
| 'America/Scoresbysund'
|
||||
| 'America/Shiprock'
|
||||
| 'America/Sitka'
|
||||
| 'America/St_Barthelemy'
|
||||
| 'America/St_Johns'
|
||||
| 'America/St_Kitts'
|
||||
| 'America/St_Lucia'
|
||||
| 'America/St_Thomas'
|
||||
| 'America/St_Vincent'
|
||||
| 'America/Swift_Current'
|
||||
| 'America/Tegucigalpa'
|
||||
| 'America/Thule'
|
||||
| 'America/Thunder_Bay'
|
||||
| 'America/Tijuana'
|
||||
| 'America/Toronto'
|
||||
| 'America/Tortola'
|
||||
| 'America/Vancouver'
|
||||
| 'America/Virgin'
|
||||
| 'America/Whitehorse'
|
||||
| 'America/Winnipeg'
|
||||
| 'America/Yakutat'
|
||||
| 'America/Yellowknife'
|
||||
| 'Antarctica/Casey'
|
||||
| 'Antarctica/Davis'
|
||||
| 'Antarctica/DumontDUrville'
|
||||
| 'Antarctica/Macquarie'
|
||||
| 'Antarctica/Mawson'
|
||||
| 'Antarctica/McMurdo'
|
||||
| 'Antarctica/Palmer'
|
||||
| 'Antarctica/Rothera'
|
||||
| 'Antarctica/South_Pole'
|
||||
| 'Antarctica/Syowa'
|
||||
| 'Antarctica/Troll'
|
||||
| 'Antarctica/Vostok'
|
||||
| 'Arctic/Longyearbyen'
|
||||
| 'Asia/Aden'
|
||||
| 'Asia/Almaty'
|
||||
| 'Asia/Amman'
|
||||
| 'Asia/Anadyr'
|
||||
| 'Asia/Aqtau'
|
||||
| 'Asia/Aqtobe'
|
||||
| 'Asia/Ashgabat'
|
||||
| 'Asia/Ashkhabad'
|
||||
| 'Asia/Atyrau'
|
||||
| 'Asia/Baghdad'
|
||||
| 'Asia/Bahrain'
|
||||
| 'Asia/Baku'
|
||||
| 'Asia/Bangkok'
|
||||
| 'Asia/Barnaul'
|
||||
| 'Asia/Beirut'
|
||||
| 'Asia/Bishkek'
|
||||
| 'Asia/Brunei'
|
||||
| 'Asia/Calcutta'
|
||||
| 'Asia/Chita'
|
||||
| 'Asia/Choibalsan'
|
||||
| 'Asia/Chongqing'
|
||||
| 'Asia/Chungking'
|
||||
| 'Asia/Colombo'
|
||||
| 'Asia/Dacca'
|
||||
| 'Asia/Damascus'
|
||||
| 'Asia/Dhaka'
|
||||
| 'Asia/Dili'
|
||||
| 'Asia/Dubai'
|
||||
| 'Asia/Dushanbe'
|
||||
| 'Asia/Famagusta'
|
||||
| 'Asia/Gaza'
|
||||
| 'Asia/Harbin'
|
||||
| 'Asia/Hebron'
|
||||
| 'Asia/Ho_Chi_Minh'
|
||||
| 'Asia/Hong_Kong'
|
||||
| 'Asia/Hovd'
|
||||
| 'Asia/Irkutsk'
|
||||
| 'Asia/Istanbul'
|
||||
| 'Asia/Jakarta'
|
||||
| 'Asia/Jayapura'
|
||||
| 'Asia/Jerusalem'
|
||||
| 'Asia/Kabul'
|
||||
| 'Asia/Kamchatka'
|
||||
| 'Asia/Karachi'
|
||||
| 'Asia/Kashgar'
|
||||
| 'Asia/Kathmandu'
|
||||
| 'Asia/Katmandu'
|
||||
| 'Asia/Khandyga'
|
||||
| 'Asia/Kolkata'
|
||||
| 'Asia/Krasnoyarsk'
|
||||
| 'Asia/Kuala_Lumpur'
|
||||
| 'Asia/Kuching'
|
||||
| 'Asia/Kuwait'
|
||||
| 'Asia/Macao'
|
||||
| 'Asia/Macau'
|
||||
| 'Asia/Magadan'
|
||||
| 'Asia/Makassar'
|
||||
| 'Asia/Manila'
|
||||
| 'Asia/Muscat'
|
||||
| 'Asia/Nicosia'
|
||||
| 'Asia/Novokuznetsk'
|
||||
| 'Asia/Novosibirsk'
|
||||
| 'Asia/Omsk'
|
||||
| 'Asia/Oral'
|
||||
| 'Asia/Phnom_Penh'
|
||||
| 'Asia/Pontianak'
|
||||
| 'Asia/Pyongyang'
|
||||
| 'Asia/Qatar'
|
||||
| 'Asia/Qostanay'
|
||||
| 'Asia/Qyzylorda'
|
||||
| 'Asia/Rangoon'
|
||||
| 'Asia/Riyadh'
|
||||
| 'Asia/Saigon'
|
||||
| 'Asia/Sakhalin'
|
||||
| 'Asia/Samarkand'
|
||||
| 'Asia/Seoul'
|
||||
| 'Asia/Shanghai'
|
||||
| 'Asia/Singapore'
|
||||
| 'Asia/Srednekolymsk'
|
||||
| 'Asia/Taipei'
|
||||
| 'Asia/Tashkent'
|
||||
| 'Asia/Tbilisi'
|
||||
| 'Asia/Tehran'
|
||||
| 'Asia/Tel_Aviv'
|
||||
| 'Asia/Thimbu'
|
||||
| 'Asia/Thimphu'
|
||||
| 'Asia/Tokyo'
|
||||
| 'Asia/Tomsk'
|
||||
| 'Asia/Ujung_Pandang'
|
||||
| 'Asia/Ulaanbaatar'
|
||||
| 'Asia/Ulan_Bator'
|
||||
| 'Asia/Urumqi'
|
||||
| 'Asia/Ust-Nera'
|
||||
| 'Asia/Vientiane'
|
||||
| 'Asia/Vladivostok'
|
||||
| 'Asia/Yakutsk'
|
||||
| 'Asia/Yangon'
|
||||
| 'Asia/Yekaterinburg'
|
||||
| 'Asia/Yerevan'
|
||||
| 'Atlantic/Azores'
|
||||
| 'Atlantic/Bermuda'
|
||||
| 'Atlantic/Canary'
|
||||
| 'Atlantic/Cape_Verde'
|
||||
| 'Atlantic/Faeroe'
|
||||
| 'Atlantic/Faroe'
|
||||
| 'Atlantic/Jan_Mayen'
|
||||
| 'Atlantic/Madeira'
|
||||
| 'Atlantic/Reykjavik'
|
||||
| 'Atlantic/South_Georgia'
|
||||
| 'Atlantic/St_Helena'
|
||||
| 'Atlantic/Stanley'
|
||||
| 'Australia/ACT'
|
||||
| 'Australia/Adelaide'
|
||||
| 'Australia/Brisbane'
|
||||
| 'Australia/Broken_Hill'
|
||||
| 'Australia/Canberra'
|
||||
| 'Australia/Currie'
|
||||
| 'Australia/Darwin'
|
||||
| 'Australia/Eucla'
|
||||
| 'Australia/Hobart'
|
||||
| 'Australia/LHI'
|
||||
| 'Australia/Lindeman'
|
||||
| 'Australia/Lord_Howe'
|
||||
| 'Australia/Melbourne'
|
||||
| 'Australia/NSW'
|
||||
| 'Australia/North'
|
||||
| 'Australia/Perth'
|
||||
| 'Australia/Queensland'
|
||||
| 'Australia/South'
|
||||
| 'Australia/Sydney'
|
||||
| 'Australia/Tasmania'
|
||||
| 'Australia/Victoria'
|
||||
| 'Australia/West'
|
||||
| 'Australia/Yancowinna'
|
||||
| 'Brazil/Acre'
|
||||
| 'Brazil/DeNoronha'
|
||||
| 'Brazil/East'
|
||||
| 'Brazil/West'
|
||||
| 'CET'
|
||||
| 'CST6CDT'
|
||||
| 'Canada/Atlantic'
|
||||
| 'Canada/Central'
|
||||
| 'Canada/Eastern'
|
||||
| 'Canada/Mountain'
|
||||
| 'Canada/Newfoundland'
|
||||
| 'Canada/Pacific'
|
||||
| 'Canada/Saskatchewan'
|
||||
| 'Canada/Yukon'
|
||||
| 'Chile/Continental'
|
||||
| 'Chile/EasterIsland'
|
||||
| 'Cuba'
|
||||
| 'EET'
|
||||
| 'EST'
|
||||
| 'EST5EDT'
|
||||
| 'Egypt'
|
||||
| 'Eire'
|
||||
| 'Etc/GMT'
|
||||
| 'Etc/GMT+0'
|
||||
| 'Etc/GMT+1'
|
||||
| 'Etc/GMT+10'
|
||||
| 'Etc/GMT+11'
|
||||
| 'Etc/GMT+12'
|
||||
| 'Etc/GMT+2'
|
||||
| 'Etc/GMT+3'
|
||||
| 'Etc/GMT+4'
|
||||
| 'Etc/GMT+5'
|
||||
| 'Etc/GMT+6'
|
||||
| 'Etc/GMT+7'
|
||||
| 'Etc/GMT+8'
|
||||
| 'Etc/GMT+9'
|
||||
| 'Etc/GMT-0'
|
||||
| 'Etc/GMT-1'
|
||||
| 'Etc/GMT-10'
|
||||
| 'Etc/GMT-11'
|
||||
| 'Etc/GMT-12'
|
||||
| 'Etc/GMT-13'
|
||||
| 'Etc/GMT-14'
|
||||
| 'Etc/GMT-2'
|
||||
| 'Etc/GMT-3'
|
||||
| 'Etc/GMT-4'
|
||||
| 'Etc/GMT-5'
|
||||
| 'Etc/GMT-6'
|
||||
| 'Etc/GMT-7'
|
||||
| 'Etc/GMT-8'
|
||||
| 'Etc/GMT-9'
|
||||
| 'Etc/GMT0'
|
||||
| 'Etc/Greenwich'
|
||||
| 'Etc/UCT'
|
||||
| 'Etc/UTC'
|
||||
| 'Etc/Universal'
|
||||
| 'Etc/Zulu'
|
||||
| 'Europe/Amsterdam'
|
||||
| 'Europe/Andorra'
|
||||
| 'Europe/Astrakhan'
|
||||
| 'Europe/Athens'
|
||||
| 'Europe/Belfast'
|
||||
| 'Europe/Belgrade'
|
||||
| 'Europe/Berlin'
|
||||
| 'Europe/Bratislava'
|
||||
| 'Europe/Brussels'
|
||||
| 'Europe/Bucharest'
|
||||
| 'Europe/Budapest'
|
||||
| 'Europe/Busingen'
|
||||
| 'Europe/Chisinau'
|
||||
| 'Europe/Copenhagen'
|
||||
| 'Europe/Dublin'
|
||||
| 'Europe/Gibraltar'
|
||||
| 'Europe/Guernsey'
|
||||
| 'Europe/Helsinki'
|
||||
| 'Europe/Isle_of_Man'
|
||||
| 'Europe/Istanbul'
|
||||
| 'Europe/Jersey'
|
||||
| 'Europe/Kaliningrad'
|
||||
| 'Europe/Kiev'
|
||||
| 'Europe/Kirov'
|
||||
| 'Europe/Lisbon'
|
||||
| 'Europe/Ljubljana'
|
||||
| 'Europe/London'
|
||||
| 'Europe/Luxembourg'
|
||||
| 'Europe/Madrid'
|
||||
| 'Europe/Malta'
|
||||
| 'Europe/Mariehamn'
|
||||
| 'Europe/Minsk'
|
||||
| 'Europe/Monaco'
|
||||
| 'Europe/Moscow'
|
||||
| 'Europe/Nicosia'
|
||||
| 'Europe/Oslo'
|
||||
| 'Europe/Paris'
|
||||
| 'Europe/Podgorica'
|
||||
| 'Europe/Prague'
|
||||
| 'Europe/Riga'
|
||||
| 'Europe/Rome'
|
||||
| 'Europe/Samara'
|
||||
| 'Europe/San_Marino'
|
||||
| 'Europe/Sarajevo'
|
||||
| 'Europe/Saratov'
|
||||
| 'Europe/Simferopol'
|
||||
| 'Europe/Skopje'
|
||||
| 'Europe/Sofia'
|
||||
| 'Europe/Stockholm'
|
||||
| 'Europe/Tallinn'
|
||||
| 'Europe/Tirane'
|
||||
| 'Europe/Tiraspol'
|
||||
| 'Europe/Ulyanovsk'
|
||||
| 'Europe/Uzhgorod'
|
||||
| 'Europe/Vaduz'
|
||||
| 'Europe/Vatican'
|
||||
| 'Europe/Vienna'
|
||||
| 'Europe/Vilnius'
|
||||
| 'Europe/Volgograd'
|
||||
| 'Europe/Warsaw'
|
||||
| 'Europe/Zagreb'
|
||||
| 'Europe/Zaporozhye'
|
||||
| 'Europe/Zurich'
|
||||
| 'GB'
|
||||
| 'GB-Eire'
|
||||
| 'GMT'
|
||||
| 'GMT+0'
|
||||
| 'GMT-0'
|
||||
| 'GMT0'
|
||||
| 'Greenwich'
|
||||
| 'HST'
|
||||
| 'Hongkong'
|
||||
| 'Iceland'
|
||||
| 'Indian/Antananarivo'
|
||||
| 'Indian/Chagos'
|
||||
| 'Indian/Christmas'
|
||||
| 'Indian/Cocos'
|
||||
| 'Indian/Comoro'
|
||||
| 'Indian/Kerguelen'
|
||||
| 'Indian/Mahe'
|
||||
| 'Indian/Maldives'
|
||||
| 'Indian/Mauritius'
|
||||
| 'Indian/Mayotte'
|
||||
| 'Indian/Reunion'
|
||||
| 'Iran'
|
||||
| 'Israel'
|
||||
| 'Jamaica'
|
||||
| 'Japan'
|
||||
| 'Kwajalein'
|
||||
| 'Libya'
|
||||
| 'MET'
|
||||
| 'MST'
|
||||
| 'MST7MDT'
|
||||
| 'Mexico/BajaNorte'
|
||||
| 'Mexico/BajaSur'
|
||||
| 'Mexico/General'
|
||||
| 'NZ'
|
||||
| 'NZ-CHAT'
|
||||
| 'Navajo'
|
||||
| 'PRC'
|
||||
| 'PST8PDT'
|
||||
| 'Pacific/Apia'
|
||||
| 'Pacific/Auckland'
|
||||
| 'Pacific/Bougainville'
|
||||
| 'Pacific/Chatham'
|
||||
| 'Pacific/Chuuk'
|
||||
| 'Pacific/Easter'
|
||||
| 'Pacific/Efate'
|
||||
| 'Pacific/Enderbury'
|
||||
| 'Pacific/Fakaofo'
|
||||
| 'Pacific/Fiji'
|
||||
| 'Pacific/Funafuti'
|
||||
| 'Pacific/Galapagos'
|
||||
| 'Pacific/Gambier'
|
||||
| 'Pacific/Guadalcanal'
|
||||
| 'Pacific/Guam'
|
||||
| 'Pacific/Honolulu'
|
||||
| 'Pacific/Johnston'
|
||||
| 'Pacific/Kiritimati'
|
||||
| 'Pacific/Kosrae'
|
||||
| 'Pacific/Kwajalein'
|
||||
| 'Pacific/Majuro'
|
||||
| 'Pacific/Marquesas'
|
||||
| 'Pacific/Midway'
|
||||
| 'Pacific/Nauru'
|
||||
| 'Pacific/Niue'
|
||||
| 'Pacific/Norfolk'
|
||||
| 'Pacific/Noumea'
|
||||
| 'Pacific/Pago_Pago'
|
||||
| 'Pacific/Palau'
|
||||
| 'Pacific/Pitcairn'
|
||||
| 'Pacific/Pohnpei'
|
||||
| 'Pacific/Ponape'
|
||||
| 'Pacific/Port_Moresby'
|
||||
| 'Pacific/Rarotonga'
|
||||
| 'Pacific/Saipan'
|
||||
| 'Pacific/Samoa'
|
||||
| 'Pacific/Tahiti'
|
||||
| 'Pacific/Tarawa'
|
||||
| 'Pacific/Tongatapu'
|
||||
| 'Pacific/Truk'
|
||||
| 'Pacific/Wake'
|
||||
| 'Pacific/Wallis'
|
||||
| 'Pacific/Yap'
|
||||
| 'Poland'
|
||||
| 'Portugal'
|
||||
| 'ROC'
|
||||
| 'ROK'
|
||||
| 'Singapore'
|
||||
| 'Turkey'
|
||||
| 'UCT'
|
||||
| 'US/Alaska'
|
||||
| 'US/Aleutian'
|
||||
| 'US/Arizona'
|
||||
| 'US/Central'
|
||||
| 'US/East-Indiana'
|
||||
| 'US/Eastern'
|
||||
| 'US/Hawaii'
|
||||
| 'US/Indiana-Starke'
|
||||
| 'US/Michigan'
|
||||
| 'US/Mountain'
|
||||
| 'US/Pacific'
|
||||
| 'US/Pacific-New'
|
||||
| 'US/Samoa'
|
||||
| 'UTC'
|
||||
| 'Universal'
|
||||
| 'W-SU'
|
||||
| 'WET'
|
||||
| 'Zulu'
|
||||
|
||||
export type SelectColor =
|
||||
| 'default'
|
||||
| 'gray'
|
||||
| 'brown'
|
||||
| 'orange'
|
||||
| 'yellow'
|
||||
| 'green'
|
||||
| 'blue'
|
||||
| 'purple'
|
||||
| 'pink'
|
||||
| 'red'
|
||||
|
||||
export interface SelectPropertyResponse {
|
||||
id: string
|
||||
name: string
|
||||
color: SelectColor
|
||||
}
|
||||
|
||||
export type PropertyTypes = ExtractRecordValue<PageObjectResponse['properties']>
|
||||
|
||||
export type ExtractRecordValue<R> = R extends Record<infer _, infer V>
|
||||
? V
|
||||
: never
|
||||
|
||||
export type PageWithProps<Props extends Record<string, PropertyTypes['type']>> =
|
||||
Omit<PageObjectResponse, 'properties'> & {
|
||||
properties: {
|
||||
[Prop in keyof Props]: Extract<PropertyTypes, { type: Props[Prop] }>
|
||||
} & { Name: Extract<PropertyTypes, { type: 'title' }> }
|
||||
}
|
||||
|
||||
export interface DateResponse {
|
||||
start: string
|
||||
end: string | null
|
||||
time_zone: TimeZoneRequest | null
|
||||
}
|
||||
|
||||
export type AnyBlock = Extract<GetBlockResponse, { type: string }>
|
||||
|
||||
/**
|
||||
* Type of any block.
|
||||
*/
|
||||
export type BlockType = AnyBlock['type']
|
||||
|
||||
/**
|
||||
* A full Notion API block.
|
||||
*/
|
||||
export type Block<Type extends BlockType = BlockType> = Extract<
|
||||
AnyBlock,
|
||||
{ type: Type }
|
||||
>
|
||||
|
||||
/**
|
||||
* Notion API rich text. An array of rich text tokens.
|
||||
*/
|
||||
export type RichText = Block<'paragraph'>['paragraph']['rich_text']
|
|
@ -1,20 +0,0 @@
|
|||
import { type BlockWithRecursiveChildren } from './getBlockRecursively'
|
||||
import richToPlainText from './richTextToPlainText'
|
||||
|
||||
const blockContentToPlainText = (
|
||||
blockContent: BlockWithRecursiveChildren[],
|
||||
): string =>
|
||||
blockContent
|
||||
.map((block) => {
|
||||
if (block.type !== 'paragraph') {
|
||||
if (block.children) {
|
||||
return blockContentToPlainText(block.children)
|
||||
} else return null
|
||||
}
|
||||
|
||||
return richToPlainText(block.paragraph.rich_text)
|
||||
})
|
||||
.filter((text) => text)
|
||||
.join(' ')
|
||||
|
||||
export default blockContentToPlainText
|
|
@ -1,44 +0,0 @@
|
|||
const colorMap = {
|
||||
default: {
|
||||
dark: { text: '#FFFFFF', bg: '#2F3437' },
|
||||
light: { text: '#37352F', bg: '#FFFFFF' },
|
||||
},
|
||||
gray: {
|
||||
dark: { text: '#979A9B', bg: '#454B4E' },
|
||||
light: { text: '#9B9A97', bg: '#EBECED' },
|
||||
},
|
||||
brown: {
|
||||
dark: { text: '#937264', bg: '#434040' },
|
||||
light: { text: '#64473A', bg: '#E9E5E3' },
|
||||
},
|
||||
orange: {
|
||||
dark: { text: '#FFA344', bg: '#594A3A' },
|
||||
light: { text: '#D9730D', bg: '#FAEBDD' },
|
||||
},
|
||||
yellow: {
|
||||
dark: { text: '#FFDC49', bg: '#59563B' },
|
||||
light: { text: '#DFAB01', bg: '#FBF3DB' },
|
||||
},
|
||||
green: {
|
||||
dark: { text: '#4DAB9A', bg: '#354C4B' },
|
||||
light: { text: '#0F7B6C', bg: '#DDEDEA' },
|
||||
},
|
||||
blue: {
|
||||
dark: { text: '#529CCA', bg: '#364954' },
|
||||
light: { text: '#0B6E99', bg: '#DDEBF1' },
|
||||
},
|
||||
purple: {
|
||||
dark: { text: '#9A6DD7', bg: '#443F57' },
|
||||
light: { text: '#6940A5', bg: '#EAE4F2' },
|
||||
},
|
||||
pink: {
|
||||
dark: { text: '#E255A1', bg: '#533B4C' },
|
||||
light: { text: '#AD1A72', bg: '#F4DFEB' },
|
||||
},
|
||||
red: {
|
||||
dark: { text: '#FF7369', bg: '#594141' },
|
||||
light: { text: '#E03E3E', bg: '#FBE4E4' },
|
||||
},
|
||||
}
|
||||
|
||||
export default colorMap
|
|
@ -1,18 +0,0 @@
|
|||
import { type BlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'
|
||||
|
||||
const extractCurrentListItems = ({
|
||||
list,
|
||||
currentIndex,
|
||||
}: {
|
||||
list: BlockObjectResponse[]
|
||||
currentIndex: number
|
||||
}) =>
|
||||
list.slice(
|
||||
currentIndex,
|
||||
list.findIndex(
|
||||
({ type }, finalItemIndex) =>
|
||||
type !== 'bulleted_list_item' && finalItemIndex > currentIndex,
|
||||
),
|
||||
)
|
||||
|
||||
export default extractCurrentListItems
|
|
@ -1,22 +0,0 @@
|
|||
const extractUrlFromFile = (
|
||||
image:
|
||||
| {
|
||||
type?: 'external'
|
||||
external: {
|
||||
url: string
|
||||
}
|
||||
}
|
||||
| {
|
||||
type?: 'file'
|
||||
file: {
|
||||
url: string
|
||||
expiry_time: string
|
||||
}
|
||||
},
|
||||
) => {
|
||||
if (image.type === 'external') return image.external.url
|
||||
else if (image.type === 'file') return image.file.url
|
||||
else throw new Error('Notion API returned unexpected result')
|
||||
}
|
||||
|
||||
export default extractUrlFromFile
|
|
@ -1,43 +0,0 @@
|
|||
import { QueryDatabaseParameters } from '@notionhq/client/build/src/api-endpoints'
|
||||
|
||||
export type EqualityPropertyFilterOperator = 'equals' | 'does_not_equal'
|
||||
|
||||
export type ExistencePropertyFilterOperator = 'is_empty' | 'is_not_empty'
|
||||
|
||||
export type TextPropertyFilterOperator =
|
||||
| EqualityPropertyFilterOperator
|
||||
| 'contains'
|
||||
| 'does_not_contain'
|
||||
| 'starts_with'
|
||||
| 'ends_with'
|
||||
| ExistencePropertyFilterOperator
|
||||
|
||||
export const statusFilter = (
|
||||
propertyName: string,
|
||||
operator: EqualityPropertyFilterOperator,
|
||||
compareTo: string,
|
||||
) => ({
|
||||
property: propertyName,
|
||||
status: { [operator]: compareTo } as Extract<
|
||||
Pick<QueryDatabaseParameters, 'filter'>,
|
||||
{ type: 'status' }
|
||||
>,
|
||||
})
|
||||
|
||||
export const richTextFilter = <Operator extends TextPropertyFilterOperator>(
|
||||
propertyName: string,
|
||||
operator: TextPropertyFilterOperator,
|
||||
compareTo: Operator extends ExistencePropertyFilterOperator
|
||||
? boolean
|
||||
: string,
|
||||
) => ({
|
||||
property: propertyName,
|
||||
rich_text: { [operator]: compareTo } as Extract<
|
||||
Pick<QueryDatabaseParameters, 'filter'>,
|
||||
{ type: 'rich_text' }
|
||||
>,
|
||||
})
|
||||
|
||||
export type AllFilters = ReturnType<typeof statusFilter | typeof richTextFilter>
|
||||
|
||||
export const and = (...filters: AllFilters[]) => ({ and: filters })
|
|
@ -1,70 +0,0 @@
|
|||
import notion from '../client'
|
||||
import { collectPaginatedAPI, isFullBlock } from '@notionhq/client'
|
||||
import {
|
||||
BlockObjectResponse,
|
||||
ListBlockChildrenParameters,
|
||||
} from '@notionhq/client/build/src/api-endpoints'
|
||||
import { cache } from 'react'
|
||||
|
||||
type Index = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
||||
type Iterate<I extends Index = 0> = I extends 0
|
||||
? 1
|
||||
: I extends 1
|
||||
? 2
|
||||
: I extends 2
|
||||
? 3
|
||||
: I extends 3
|
||||
? 4
|
||||
: I extends 4
|
||||
? 5
|
||||
: I extends 5
|
||||
? 6
|
||||
: I extends 6
|
||||
? 7
|
||||
: I extends 7
|
||||
? 8
|
||||
: I extends 8
|
||||
? 9
|
||||
: I extends 9
|
||||
? 10
|
||||
: I extends 10
|
||||
? 10
|
||||
: 10
|
||||
|
||||
export type BlockWithRecursiveChildren<I extends Index = 0> =
|
||||
Iterate<I> extends 10
|
||||
? BlockObjectResponse
|
||||
: BlockObjectResponse & {
|
||||
children?: BlockWithRecursiveChildren<Iterate<I>>[]
|
||||
}
|
||||
|
||||
const getBlockRecursively = cache(
|
||||
(blockId: string): Promise<BlockWithRecursiveChildren[]> => {
|
||||
return collectPaginatedAPI(
|
||||
async (args: ListBlockChildrenParameters) => {
|
||||
const { results, ...rest } = await notion.blocks.children.list(args)
|
||||
const recursiveChildren = await Promise.all(
|
||||
results.map(async (block) => {
|
||||
if (isFullBlock(block)) {
|
||||
return block.has_children
|
||||
? {
|
||||
...block,
|
||||
children: await getBlockRecursively(block.id),
|
||||
}
|
||||
: block
|
||||
} else {
|
||||
const error = `Notion API error: couldn't fetch block ${block.id}`
|
||||
throw new Error(error)
|
||||
}
|
||||
}),
|
||||
)
|
||||
return { results: recursiveChildren, ...rest }
|
||||
},
|
||||
{
|
||||
block_id: blockId,
|
||||
},
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
export default getBlockRecursively
|
|
@ -1,24 +0,0 @@
|
|||
// NOTE: this assumes that we are deploying on Vercel
|
||||
const getProxiedAssetUrl = (
|
||||
params:
|
||||
| { blockId: string; lastEditedTime: string; withBaseUrl?: boolean }
|
||||
| {
|
||||
pageId: string
|
||||
propertyId?: string
|
||||
lastEditedTime: string
|
||||
withBaseUrl?: boolean
|
||||
},
|
||||
) => {
|
||||
let path: string
|
||||
if ('blockId' in params)
|
||||
path = `/api/notion-asset/block/${params.blockId}?lastEditedTime=${params.lastEditedTime}`
|
||||
else if (!params.propertyId)
|
||||
path = `/api/notion-asset/page/${params.pageId}?lastEditedTime=${params.lastEditedTime}`
|
||||
else
|
||||
path = `/api/notion-asset/page/${params.pageId}/${params.propertyId}?lastEditedTime=${params.lastEditedTime}`
|
||||
|
||||
if (params.withBaseUrl) return `${process.env.NEXT_PUBLIC_SITE_URL}${path}`
|
||||
else return path
|
||||
}
|
||||
|
||||
export default getProxiedAssetUrl
|
|
@ -1,21 +0,0 @@
|
|||
// This version was taken from https://github.com/justjake/monorepo/blob/d1e87174827005fa7fd6d158a0a1d7e86dd2a396/packages/notion-api/src/lib/notion-api.ts#L455
|
||||
import { type RichText } from '../types'
|
||||
|
||||
/**
|
||||
* @returns Plaintext string of rich text.
|
||||
*/
|
||||
const richTextAsPlainText = (
|
||||
richText: string | RichText | undefined,
|
||||
): string => {
|
||||
if (!richText) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (typeof richText === 'string') {
|
||||
return richText
|
||||
}
|
||||
|
||||
return richText.map((token) => token.plain_text).join('')
|
||||
}
|
||||
|
||||
export default richTextAsPlainText
|
|
@ -1,9 +0,0 @@
|
|||
export const sortProperty = (
|
||||
property: string,
|
||||
direction: 'ascending' | 'descending'
|
||||
) => ({ property, direction });
|
||||
|
||||
export const sortTimestamp = (
|
||||
timestamp: 'last_edited_time' | 'created_time',
|
||||
direction: 'ascending' | 'descending'
|
||||
) => ({ timestamp, direction });
|
17
lib/types.ts
|
@ -1,17 +0,0 @@
|
|||
import { Props } from '@headlessui/react/dist/types'
|
||||
import { MouseEventHandler, MutableRefObject } from 'react'
|
||||
|
||||
export type MouseEvent<T> = Parameters<MouseEventHandler<T>>[0]
|
||||
|
||||
export type PopoverProps = Props<
|
||||
'div',
|
||||
{
|
||||
open: boolean
|
||||
close(
|
||||
focusableElement?:
|
||||
| HTMLElement
|
||||
| MutableRefObject<HTMLElement | null>
|
||||
| MouseEvent<HTMLElement>,
|
||||
): void
|
||||
}
|
||||
>
|
|
@ -1,10 +0,0 @@
|
|||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
reactStrictMode: true,
|
||||
swcMinify: true,
|
||||
experimental: {
|
||||
appDir: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = nextConfig;
|
42
package.json
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"name": "personal-website",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@headlessui/react": "^1.7.7",
|
||||
"@matejmazur/react-katex": "^3.1.3",
|
||||
"@notionhq/client": "^2.2.2",
|
||||
"clsx": "^1.2.1",
|
||||
"feed": "^4.2.2",
|
||||
"katex": "^0.16.4",
|
||||
"next": "13.0.6",
|
||||
"prismjs": "^1.29.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"sharp": "^0.31.3",
|
||||
"tailwindcss": "^3.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@next/env": "^13.0.6",
|
||||
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
||||
"@types/katex": "^0.14.0",
|
||||
"@types/prismjs": "^1.26.0",
|
||||
"@types/react": "18.0.26",
|
||||
"@types/react-dom": "^18.0.9",
|
||||
"@vue/compiler-sfc": "^3.2.45",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "8.29.0",
|
||||
"eslint-config-next": "13.0.6",
|
||||
"postcss": "^8.4.20",
|
||||
"prettier": "^2.8.1",
|
||||
"prettier-plugin-tailwindcss": "^0.2.1",
|
||||
"typescript": "^4.9.4"
|
||||
}
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
// NOTE: this assumes that we are deploying on Vercel
|
||||
// heavy inspiration from https://jake.tl/projects/notion-api
|
||||
import { isFullBlock, isFullPage } from '@notionhq/client'
|
||||
import { type BlockObjectResponse } from '@notionhq/client/build/src/api-endpoints'
|
||||
import { get } from 'https'
|
||||
import { type NextApiHandler } from 'next'
|
||||
|
||||
import notion from '@/lib/notion/client'
|
||||
import extractUrlFromFile from '@/lib/notion/utils/extractUrlFromFile'
|
||||
|
||||
const IMMUTABLE_CACHE_CONTROL = 'public, max-age=31536000, immutable'
|
||||
const REVALIDATE_CACHE_CONTROL = 'public, s-maxage=5, stale-while-revalidate=59'
|
||||
|
||||
const accepttedBlockTypes = ['file', 'image', 'pdf', 'audio', 'video']
|
||||
|
||||
const isBlockOfValidType = (
|
||||
block: BlockObjectResponse,
|
||||
): block is Extract<
|
||||
BlockObjectResponse,
|
||||
{ type: 'file' | 'image' | 'pdf' | 'audio' | 'video' }
|
||||
> => accepttedBlockTypes.includes(block.type)
|
||||
|
||||
const handler: NextApiHandler = async (req, res) => {
|
||||
if (req.method !== 'GET') {
|
||||
res.status(405).send('Method Not Allowed')
|
||||
return
|
||||
}
|
||||
|
||||
const { query } = req
|
||||
|
||||
const [type, blockId, propertyId] = query['assetRequest'] as string[]
|
||||
|
||||
// If we have this timestamp, the Vercel CDN will only let the request get to this API route
|
||||
// if the timestamp hasn't been asked for before. I.e.: if you ask for the same asset, with the same
|
||||
// timestamp twice, it will hit the cache and won't get to this API route
|
||||
// If you request an asset without a `lastEditedTime`, then you need to refresh it every few seconds
|
||||
// Thus, we can consider "timestamped assets" immutable
|
||||
const lastEditedTime = query['lastEditedTime']
|
||||
const isAssetImmutable = !!lastEditedTime
|
||||
|
||||
const validateParams = () => {
|
||||
if (type !== 'page' && type !== 'block') return false // invalid type
|
||||
if (!blockId) return false // invlaid block/page ID
|
||||
return true
|
||||
}
|
||||
|
||||
if (!validateParams()) {
|
||||
res.status(400).send('Bad Request')
|
||||
return
|
||||
}
|
||||
|
||||
const getAssetUrlFromPageProperty = async ({
|
||||
pageId,
|
||||
propertyId,
|
||||
}: {
|
||||
pageId: string
|
||||
propertyId: string
|
||||
}) => {
|
||||
const property = await notion.pages.properties.retrieve({
|
||||
page_id: pageId,
|
||||
property_id: propertyId,
|
||||
})
|
||||
|
||||
const type = property.type
|
||||
if (type !== 'files') {
|
||||
res.status(400).send('Requested page property is not an asset')
|
||||
return null
|
||||
}
|
||||
|
||||
const file = property.files[0]
|
||||
|
||||
if (!file) {
|
||||
res.status(400).send('Requested page property is empty')
|
||||
return null
|
||||
}
|
||||
|
||||
return extractUrlFromFile(file)
|
||||
}
|
||||
|
||||
const getAssetUrlFromPageCover = async (pageId: string) => {
|
||||
const page = await notion.pages.retrieve({
|
||||
page_id: pageId,
|
||||
})
|
||||
|
||||
if (!isFullPage(page)) {
|
||||
res.status(404).send('Not Found')
|
||||
return null
|
||||
}
|
||||
|
||||
const cover = page.cover
|
||||
|
||||
if (!cover) {
|
||||
res.status(404).send('Not Found')
|
||||
return null
|
||||
}
|
||||
|
||||
return extractUrlFromFile(cover)
|
||||
}
|
||||
|
||||
const getAssetUrlFromBlock = async (blockId: string) => {
|
||||
const block = await notion.blocks.retrieve({ block_id: blockId })
|
||||
|
||||
if (!isFullBlock(block)) {
|
||||
res.status(404).send('Not Found')
|
||||
return null
|
||||
}
|
||||
|
||||
if (!isBlockOfValidType(block)) {
|
||||
res.status(400).send('The requested block is not an asset')
|
||||
return null
|
||||
}
|
||||
|
||||
// @ts-expect-error we know for sure that `block.type` will index the property on `block`
|
||||
return extractUrlFromFile(block[block.type])
|
||||
}
|
||||
|
||||
let assetUrl: string | null
|
||||
|
||||
if (type === 'page') {
|
||||
if (propertyId)
|
||||
assetUrl = await getAssetUrlFromPageProperty({
|
||||
pageId: blockId,
|
||||
propertyId,
|
||||
})
|
||||
else assetUrl = await getAssetUrlFromPageCover(blockId)
|
||||
} else {
|
||||
assetUrl = await getAssetUrlFromBlock(blockId!) // we know for sure that here blockId exists because of `validateParams`
|
||||
}
|
||||
|
||||
// we already sent a response to the client, close to where the error occured, so we just have to return
|
||||
if (!assetUrl) return
|
||||
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!assetUrl) {
|
||||
res.status(404).send('Not Found')
|
||||
reject()
|
||||
return
|
||||
}
|
||||
|
||||
get(assetUrl, (getResponse) => {
|
||||
const proxyHeader = (header: string) => {
|
||||
const value =
|
||||
getResponse.headers[header] ||
|
||||
getResponse.headers[header.toLowerCase()]
|
||||
if (value) {
|
||||
res.setHeader(header, value)
|
||||
}
|
||||
}
|
||||
|
||||
proxyHeader('Content-Type')
|
||||
proxyHeader('Content-Length')
|
||||
|
||||
if (getResponse.statusCode === 200) {
|
||||
res.setHeader(
|
||||
'Cache-Control',
|
||||
isAssetImmutable ? IMMUTABLE_CACHE_CONTROL : REVALIDATE_CACHE_CONTROL,
|
||||
)
|
||||
res.status(200)
|
||||
} else {
|
||||
res.status(getResponse.statusCode || 500)
|
||||
reject()
|
||||
return
|
||||
}
|
||||
|
||||
getResponse
|
||||
.pipe(res)
|
||||
.on('finish', () => {
|
||||
res.end()
|
||||
resolve()
|
||||
})
|
||||
.on('error', (err) => {
|
||||
res.status(500).send(err.toString())
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default handler
|
3188
pnpm-lock.yaml
|
@ -1,6 +0,0 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
}
|
BIN
public/CV.pdf
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 511 KiB |
Before Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 867 B |
Before Width: | Height: | Size: 2.8 KiB |
|
@ -1,19 +0,0 @@
|
|||
{
|
||||
"name": "Filipe Medeiros - website pessoal",
|
||||
"short_name": "Filipe",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/favicon/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/favicon/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"theme_color": "#14B8A6",
|
||||
"background_color": "#14B8A6",
|
||||
"display": "standalone"
|
||||
}
|
3
studio/.eslintrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "@sanity/eslint-config-studio"
|
||||
}
|
29
studio/.gitignore
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# Dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
|
||||
# Compiled Sanity Studio
|
||||
/dist
|
||||
|
||||
# Temporary Sanity runtime, generated by the CLI on every dev server start
|
||||
/.sanity
|
||||
|
||||
# Logs
|
||||
/logs
|
||||
*.log
|
||||
|
||||
# Coverage directory used by testing tools
|
||||
/coverage
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# Typescript
|
||||
*.tsbuildinfo
|
||||
|
||||
# Dotenv and similar local-only files
|
||||
*.local
|
9
studio/README.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Sanity Clean Content Studio
|
||||
|
||||
Congratulations, you have now installed the Sanity Content Studio, an open source real-time content editing environment connected to the Sanity backend.
|
||||
|
||||
Now you can do the following things:
|
||||
|
||||
- [Read “getting started” in the docs](https://www.sanity.io/docs/introduction/getting-started?utm_source=readme)
|
||||
- [Join the community Slack](https://slack.sanity.io/?utm_source=readme)
|
||||
- [Extend and build plugins](https://www.sanity.io/docs/content-studio/extending?utm_source=readme)
|
40
studio/package.json
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "personal-website",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"main": "package.json",
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"dev": "sanity dev",
|
||||
"start": "sanity start",
|
||||
"build": "sanity build",
|
||||
"deploy": "sanity deploy",
|
||||
"deploy-graphql": "sanity graphql deploy"
|
||||
},
|
||||
"keywords": [
|
||||
"sanity"
|
||||
],
|
||||
"dependencies": {
|
||||
"@sanity/icons": "^2.2.2",
|
||||
"@sanity/vision": "^3.0.0",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-is": "^18.2.0",
|
||||
"sanity": "^3.0.0",
|
||||
"styled-components": "^5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sanity/eslint-config-studio": "^2.0.1",
|
||||
"@types/react": "^18.0.25",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"eslint": "^8.6.0",
|
||||
"prettier": "^2.8.7",
|
||||
"typescript": "^4.0.0"
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 100,
|
||||
"bracketSpacing": false,
|
||||
"singleQuote": true
|
||||
}
|
||||
}
|
6797
studio/pnpm-lock.yaml
Normal file
8
studio/sanity.cli.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import {defineCliConfig} from 'sanity/cli'
|
||||
|
||||
export default defineCliConfig({
|
||||
api: {
|
||||
projectId: 'tzamgyrm',
|
||||
dataset: 'production'
|
||||
}
|
||||
})
|
18
studio/sanity.config.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import {defineConfig} from 'sanity'
|
||||
import {deskTool} from 'sanity/desk'
|
||||
import {visionTool} from '@sanity/vision'
|
||||
import {schemaTypes} from './schemas'
|
||||
|
||||
export default defineConfig({
|
||||
name: 'default',
|
||||
title: 'personal-website',
|
||||
|
||||
projectId: 'tzamgyrm',
|
||||
dataset: 'production',
|
||||
|
||||
plugins: [deskTool(), visionTool()],
|
||||
|
||||
schema: {
|
||||
types: schemaTypes,
|
||||
},
|
||||
})
|
158
studio/schemas/blogPost.ts
Normal file
|
@ -0,0 +1,158 @@
|
|||
import {DocumentTextIcon} from '@sanity/icons'
|
||||
import {defineType} from 'sanity'
|
||||
|
||||
const blogPost = defineType({
|
||||
name: 'blogPost',
|
||||
title: 'Blog posts',
|
||||
type: 'document',
|
||||
icon: DocumentTextIcon,
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
title: 'Title',
|
||||
type: 'string',
|
||||
validation: (r) => r.required(),
|
||||
description:
|
||||
"The title of the article. Not only will it be used in the article page and list, but also in social previews and other websites, if you don't want to costumise it.",
|
||||
},
|
||||
{
|
||||
name: 'slug',
|
||||
title: 'Slug',
|
||||
type: 'slug',
|
||||
options: {
|
||||
source: 'title',
|
||||
maxLength: 96,
|
||||
},
|
||||
validation: (r) => r.required(),
|
||||
description:
|
||||
'This will be the URL of this article. E.g. "article-one" will be available at URL "/blog/article-one".',
|
||||
},
|
||||
{
|
||||
name: 'headerImage',
|
||||
title: 'Header image',
|
||||
type: 'image',
|
||||
description:
|
||||
'This image will be used as the header image in the article page, on the article list/blog page and also eventually on social previews and other websites.',
|
||||
validation: (r) => r.required(),
|
||||
},
|
||||
{
|
||||
name: 'department',
|
||||
title: 'Department',
|
||||
type: 'string',
|
||||
description:
|
||||
'The department which this article belongs to. If it belongs to no specific department, please leave this field empty.',
|
||||
options: {
|
||||
list: [
|
||||
{value: 'capital', title: 'Capital'},
|
||||
{value: 'labs', title: 'Labs'},
|
||||
{value: 'research', title: 'Research'},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'content',
|
||||
title: 'Content',
|
||||
type: 'array',
|
||||
description: 'The body/content of this article.',
|
||||
of: [
|
||||
{
|
||||
type: 'block',
|
||||
},
|
||||
{
|
||||
type: 'image',
|
||||
fields: [
|
||||
{
|
||||
title: 'Caption',
|
||||
name: 'caption',
|
||||
type: 'text',
|
||||
},
|
||||
{
|
||||
name: 'undecorated',
|
||||
type: 'boolean',
|
||||
title: 'Undecorated',
|
||||
validation: (r) => r.required(),
|
||||
initialValue: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
validation: (r) => r.required(),
|
||||
},
|
||||
{
|
||||
name: 'summary',
|
||||
title: 'Summary',
|
||||
type: 'string',
|
||||
validation: (r) => r.required(),
|
||||
},
|
||||
{
|
||||
name: 'readTime',
|
||||
title: 'Read time',
|
||||
type: 'string',
|
||||
description:
|
||||
"E.g. '3 min' or '420 seconds'. If you don't specify this, we fall back to calculating it for you.",
|
||||
},
|
||||
{
|
||||
name: 'publishDate',
|
||||
title: 'Publish date',
|
||||
type: 'date',
|
||||
description:
|
||||
'Leave this empty if you want to use the current date (of publish). If you use a date in the past, everything will go normal. If you use a date in the future, the article will be hidden until that day, on which it will be published automatically.',
|
||||
},
|
||||
{
|
||||
name: 'metadata',
|
||||
title: 'Social media and SEO',
|
||||
description:
|
||||
'Data about the article for SEO, social media previews, etc. This is very important for reach and brand awareness since it will be the first contact many people will have with our brand and content!',
|
||||
type: 'object',
|
||||
validation: (r) => r.required(),
|
||||
fields: [
|
||||
{
|
||||
name: 'image',
|
||||
title: 'Image',
|
||||
type: 'image',
|
||||
description: "If you don't specify this, falls back to 'Header image'",
|
||||
},
|
||||
{
|
||||
name: 'title',
|
||||
title: 'Title',
|
||||
type: 'string',
|
||||
description: "If you don't specify this, falls back to article title",
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
title: 'Description',
|
||||
type: 'string',
|
||||
description: "If you don't specify this, falls back to article summary",
|
||||
},
|
||||
{
|
||||
name: 'twitterCardType',
|
||||
title: 'Twitter card type',
|
||||
type: 'string',
|
||||
description:
|
||||
'See https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started for more info.',
|
||||
options: {
|
||||
list: [
|
||||
{value: 'summary', title: 'Summary'},
|
||||
{
|
||||
value: 'summary_large_image',
|
||||
title: 'Summary with large image',
|
||||
},
|
||||
{value: 'player', title: 'Player'},
|
||||
{value: 'app', title: 'App'},
|
||||
],
|
||||
},
|
||||
initialValue: 'summary_large_image',
|
||||
validation: (r) => r.required(),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
preview: {
|
||||
select: {
|
||||
title: 'title',
|
||||
media: 'headerImage',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export default blogPost
|
4
studio/schemas/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
|||
import blogPost from './blogPost'
|
||||
import libraryItem from './libraryItem'
|
||||
|
||||
export const schemaTypes = [blogPost, libraryItem]
|
49
studio/schemas/libraryItem.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import {BookIcon} from '@sanity/icons'
|
||||
import {defineType} from 'sanity'
|
||||
|
||||
const libraryItem = defineType({
|
||||
name: 'libraryItem',
|
||||
title: 'Library items',
|
||||
type: 'document',
|
||||
icon: BookIcon,
|
||||
fields: [
|
||||
{
|
||||
name: 'title',
|
||||
title: 'Title',
|
||||
type: 'string',
|
||||
validation: (r) => r.required(),
|
||||
description:
|
||||
'The title of the item. It might be the title of the book, article, podcast episode, etc.',
|
||||
},
|
||||
{
|
||||
name: 'checkedOut',
|
||||
title: 'Checked out',
|
||||
type: 'boolean',
|
||||
validation: (r) => r.required(),
|
||||
initialValue: false,
|
||||
description: 'If you have already read, listened, etc. to this item.',
|
||||
},
|
||||
{
|
||||
name: 'link',
|
||||
title: 'Link',
|
||||
type: 'url',
|
||||
validation: (r) => r.required(),
|
||||
description:
|
||||
'You have to provide some link to this content. A link to buy the book, listen to the episode, etc.',
|
||||
},
|
||||
{
|
||||
name: 'description',
|
||||
title: 'Description',
|
||||
type: 'string',
|
||||
description:
|
||||
'If you wanna give the readers a short description of why this item is good or worth checking out, this is that.',
|
||||
},
|
||||
],
|
||||
preview: {
|
||||
select: {
|
||||
title: 'title',
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
export default libraryItem
|
1
studio/static/.gitkeep
Normal file
|
@ -0,0 +1 @@
|
|||
Files placed here will be served by the Sanity server under the `/static`-prefix
|
|
@ -1,29 +1,20 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"incremental": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
"incremental": true
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"include": ["**/*.ts", "**/*.tsx"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
darkMode: 'class',
|
||||
content: [
|
||||
'./app/**/*.tsx',
|
||||
'./components/**/*.tsx',
|
||||
'./lib/**/*.tsx',
|
||||
'./pages/**/*.tsx',
|
||||
],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
future: {
|
||||
hoverOnlyWhenSupported: true,
|
||||
},
|
||||
}
|