mirror of
https://github.com/starshardstudio/peafowl.git
synced 2024-12-14 15:24:19 +00:00
First commit
This commit is contained in:
commit
af4eff6b99
51 changed files with 3396 additions and 0 deletions
8
.env.example
Normal file
8
.env.example
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Get your API key here:
|
||||
# https://steamcommunity.com/dev
|
||||
STEAM_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
# Get your SteamID here:
|
||||
# https://steamdb.info/calculator/
|
||||
STEAM_ID=765611XXXXXXXXXXX
|
||||
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
_site
|
||||
_cache
|
||||
.env
|
6
.idea/.gitignore
vendored
Normal file
6
.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
7
.idea/discord.xml
Normal file
7
.idea/discord.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="PROJECT_FILES" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
34
.idea/inspectionProfiles/Project_Default.xml
Normal file
34
.idea/inspectionProfiles/Project_Default.xml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="CssUnknownProperty" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="myCustomPropertiesEnabled" value="true" />
|
||||
<option name="myIgnoreVendorSpecificProperties" value="false" />
|
||||
<option name="myCustomPropertiesList">
|
||||
<value>
|
||||
<list size="1">
|
||||
<item index="0" class="java.lang.String" itemvalue="size-adjust" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="CssUnresolvedCustomProperty" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
<inspection_tool class="DuplicatedCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="HtmlUnknownTarget" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="JSUnusedGlobalSymbols" enabled="false" level="WARNING" enabled_by_default="false">
|
||||
<option name="myReportUnusedDefinitions" value="true" />
|
||||
<option name="myReportUnusedProperties" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="JSXNamespaceValidation" enabled="false" level="INFORMATION" enabled_by_default="false" />
|
||||
<inspection_tool class="SillyAssignmentJS" enabled="true" level="WEAK WARNING" enabled_by_default="true" editorAttributes="INFO_ATTRIBUTES" />
|
||||
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||
<option name="processCode" value="true" />
|
||||
<option name="processLiterals" value="true" />
|
||||
<option name="processComments" value="true" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="UnnecessaryLocalVariableJS" enabled="true" level="WEAK WARNING" enabled_by_default="true" editorAttributes="INFO_ATTRIBUTES">
|
||||
<option name="m_ignoreImmediatelyReturnedVariables" value="false" />
|
||||
<option name="m_ignoreAnnotatedVariables" value="false" />
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
5
.idea/misc.xml
Normal file
5
.idea/misc.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="22" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/peafowl.iml" filepath="$PROJECT_DIR$/.idea/peafowl.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
12
.idea/peafowl.iml
Normal file
12
.idea/peafowl.iml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/games" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/_site" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
6
.idea/runConfigurations/Run.xml
Normal file
6
.idea/runConfigurations/Run.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Run" type="DenoConfigurationType" inputPath="$PROJECT_DIR$/_run.ts" programParameters="run --allow-read --allow-write --allow-net --allow-env --allow-run">
|
||||
<option name="applicationArguments" value="--watch" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
4
.vscode/launch.json
vendored
Normal file
4
.vscode/launch.json
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": []
|
||||
}
|
16
.vscode/settings.json
vendored
Normal file
16
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"files.exclude": {
|
||||
"**/.git": true,
|
||||
"**/.svn": true,
|
||||
"**/.hg": true,
|
||||
"**/CVS": true,
|
||||
"**/.DS_Store": true,
|
||||
"**/Thumbs.db": true,
|
||||
"**/.gitignore": true,
|
||||
"_*": true,
|
||||
"LICENSE-CODE.txt": true,
|
||||
"deno.json": true,
|
||||
"deno.lock": true,
|
||||
".vscode": true,
|
||||
}
|
||||
}
|
287
LICENSE-CODE.txt
Normal file
287
LICENSE-CODE.txt
Normal file
|
@ -0,0 +1,287 @@
|
|||
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
||||
EUPL © the European Union 2007, 2016
|
||||
|
||||
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
|
||||
below) which is provided under the terms of this Licence. Any use of the Work,
|
||||
other than as authorised under this Licence is prohibited (to the extent such
|
||||
use is covered by a right of the copyright holder of the Work).
|
||||
|
||||
The Work is provided under the terms of this Licence when the Licensor (as
|
||||
defined below) has placed the following notice immediately following the
|
||||
copyright notice for the Work:
|
||||
|
||||
Licensed under the EUPL
|
||||
|
||||
or has expressed by any other means his willingness to license under the EUPL.
|
||||
|
||||
1. Definitions
|
||||
|
||||
In this Licence, the following terms have the following meaning:
|
||||
|
||||
- ‘The Licence’: this Licence.
|
||||
|
||||
- ‘The Original Work’: the work or software distributed or communicated by the
|
||||
Licensor under this Licence, available as Source Code and also as Executable
|
||||
Code as the case may be.
|
||||
|
||||
- ‘Derivative Works’: the works or software that could be created by the
|
||||
Licensee, based upon the Original Work or modifications thereof. This Licence
|
||||
does not define the extent of modification or dependence on the Original Work
|
||||
required in order to classify a work as a Derivative Work; this extent is
|
||||
determined by copyright law applicable in the country mentioned in Article 15.
|
||||
|
||||
- ‘The Work’: the Original Work or its Derivative Works.
|
||||
|
||||
- ‘The Source Code’: the human-readable form of the Work which is the most
|
||||
convenient for people to study and modify.
|
||||
|
||||
- ‘The Executable Code’: any code which has generally been compiled and which is
|
||||
meant to be interpreted by a computer as a program.
|
||||
|
||||
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
||||
the Work under the Licence.
|
||||
|
||||
- ‘Contributor(s)’: any natural or legal person who modifies the Work under the
|
||||
Licence, or otherwise contributes to the creation of a Derivative Work.
|
||||
|
||||
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
||||
the Work under the terms of the Licence.
|
||||
|
||||
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
||||
renting, distributing, communicating, transmitting, or otherwise making
|
||||
available, online or offline, copies of the Work or providing access to its
|
||||
essential functionalities at the disposal of any other natural or legal
|
||||
person.
|
||||
|
||||
2. Scope of the rights granted by the Licence
|
||||
|
||||
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||
sublicensable licence to do the following, for the duration of copyright vested
|
||||
in the Original Work:
|
||||
|
||||
- use the Work in any circumstance and for all usage,
|
||||
- reproduce the Work,
|
||||
- modify the Work, and make Derivative Works based upon the Work,
|
||||
- communicate to the public, including the right to make available or display
|
||||
the Work or copies thereof to the public and perform publicly, as the case may
|
||||
be, the Work,
|
||||
- distribute the Work or copies thereof,
|
||||
- lend and rent the Work or copies thereof,
|
||||
- sublicense rights in the Work or copies thereof.
|
||||
|
||||
Those rights can be exercised on any media, supports and formats, whether now
|
||||
known or later invented, as far as the applicable law permits so.
|
||||
|
||||
In the countries where moral rights apply, the Licensor waives his right to
|
||||
exercise his moral right to the extent allowed by law in order to make effective
|
||||
the licence of the economic rights here above listed.
|
||||
|
||||
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
|
||||
any patents held by the Licensor, to the extent necessary to make use of the
|
||||
rights granted on the Work under this Licence.
|
||||
|
||||
3. Communication of the Source Code
|
||||
|
||||
The Licensor may provide the Work either in its Source Code form, or as
|
||||
Executable Code. If the Work is provided as Executable Code, the Licensor
|
||||
provides in addition a machine-readable copy of the Source Code of the Work
|
||||
along with each copy of the Work that the Licensor distributes or indicates, in
|
||||
a notice following the copyright notice attached to the Work, a repository where
|
||||
the Source Code is easily and freely accessible for as long as the Licensor
|
||||
continues to distribute or communicate the Work.
|
||||
|
||||
4. Limitations on copyright
|
||||
|
||||
Nothing in this Licence is intended to deprive the Licensee of the benefits from
|
||||
any exception or limitation to the exclusive rights of the rights owners in the
|
||||
Work, of the exhaustion of those rights or of other applicable limitations
|
||||
thereto.
|
||||
|
||||
5. Obligations of the Licensee
|
||||
|
||||
The grant of the rights mentioned above is subject to some restrictions and
|
||||
obligations imposed on the Licensee. Those obligations are the following:
|
||||
|
||||
Attribution right: The Licensee shall keep intact all copyright, patent or
|
||||
trademarks notices and all notices that refer to the Licence and to the
|
||||
disclaimer of warranties. The Licensee must include a copy of such notices and a
|
||||
copy of the Licence with every copy of the Work he/she distributes or
|
||||
communicates. The Licensee must cause any Derivative Work to carry prominent
|
||||
notices stating that the Work has been modified and the date of modification.
|
||||
|
||||
Copyleft clause: If the Licensee distributes or communicates copies of the
|
||||
Original Works or Derivative Works, this Distribution or Communication will be
|
||||
done under the terms of this Licence or of a later version of this Licence
|
||||
unless the Original Work is expressly distributed only under this version of the
|
||||
Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
|
||||
(becoming Licensor) cannot offer or impose any additional terms or conditions on
|
||||
the Work or Derivative Work that alter or restrict the terms of the Licence.
|
||||
|
||||
Compatibility clause: If the Licensee Distributes or Communicates Derivative
|
||||
Works or copies thereof based upon both the Work and another work licensed under
|
||||
a Compatible Licence, this Distribution or Communication can be done under the
|
||||
terms of this Compatible Licence. For the sake of this clause, ‘Compatible
|
||||
Licence’ refers to the licences listed in the appendix attached to this Licence.
|
||||
Should the Licensee's obligations under the Compatible Licence conflict with
|
||||
his/her obligations under this Licence, the obligations of the Compatible
|
||||
Licence shall prevail.
|
||||
|
||||
Provision of Source Code: When distributing or communicating copies of the Work,
|
||||
the Licensee will provide a machine-readable copy of the Source Code or indicate
|
||||
a repository where this Source will be easily and freely available for as long
|
||||
as the Licensee continues to distribute or communicate the Work.
|
||||
|
||||
Legal Protection: This Licence does not grant permission to use the trade names,
|
||||
trademarks, service marks, or names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the copyright notice.
|
||||
|
||||
6. Chain of Authorship
|
||||
|
||||
The original Licensor warrants that the copyright in the Original Work granted
|
||||
hereunder is owned by him/her or licensed to him/her and that he/she has the
|
||||
power and authority to grant the Licence.
|
||||
|
||||
Each Contributor warrants that the copyright in the modifications he/she brings
|
||||
to the Work are owned by him/her or licensed to him/her and that he/she has the
|
||||
power and authority to grant the Licence.
|
||||
|
||||
Each time You accept the Licence, the original Licensor and subsequent
|
||||
Contributors grant You a licence to their contributions to the Work, under the
|
||||
terms of this Licence.
|
||||
|
||||
7. Disclaimer of Warranty
|
||||
|
||||
The Work is a work in progress, which is continuously improved by numerous
|
||||
Contributors. It is not a finished work and may therefore contain defects or
|
||||
‘bugs’ inherent to this type of development.
|
||||
|
||||
For the above reason, the Work is provided under the Licence on an ‘as is’ basis
|
||||
and without warranties of any kind concerning the Work, including without
|
||||
limitation merchantability, fitness for a particular purpose, absence of defects
|
||||
or errors, accuracy, non-infringement of intellectual property rights other than
|
||||
copyright as stated in Article 6 of this Licence.
|
||||
|
||||
This disclaimer of warranty is an essential part of the Licence and a condition
|
||||
for the grant of any rights to the Work.
|
||||
|
||||
8. Disclaimer of Liability
|
||||
|
||||
Except in the cases of wilful misconduct or damages directly caused to natural
|
||||
persons, the Licensor will in no event be liable for any direct or indirect,
|
||||
material or moral, damages of any kind, arising out of the Licence or of the use
|
||||
of the Work, including without limitation, damages for loss of goodwill, work
|
||||
stoppage, computer failure or malfunction, loss of data or any commercial
|
||||
damage, even if the Licensor has been advised of the possibility of such damage.
|
||||
However, the Licensor will be liable under statutory product liability laws as
|
||||
far such laws apply to the Work.
|
||||
|
||||
9. Additional agreements
|
||||
|
||||
While distributing the Work, You may choose to conclude an additional agreement,
|
||||
defining obligations or services consistent with this Licence. However, if
|
||||
accepting obligations, You may act only on your own behalf and on your sole
|
||||
responsibility, not on behalf of the original Licensor or any other Contributor,
|
||||
and only if You agree to indemnify, defend, and hold each Contributor harmless
|
||||
for any liability incurred by, or claims asserted against such Contributor by
|
||||
the fact You have accepted any warranty or additional liability.
|
||||
|
||||
10. Acceptance of the Licence
|
||||
|
||||
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
|
||||
placed under the bottom of a window displaying the text of this Licence or by
|
||||
affirming consent in any other similar way, in accordance with the rules of
|
||||
applicable law. Clicking on that icon indicates your clear and irrevocable
|
||||
acceptance of this Licence and all of its terms and conditions.
|
||||
|
||||
Similarly, you irrevocably accept this Licence and all of its terms and
|
||||
conditions by exercising any rights granted to You by Article 2 of this Licence,
|
||||
such as the use of the Work, the creation by You of a Derivative Work or the
|
||||
Distribution or Communication by You of the Work or copies thereof.
|
||||
|
||||
11. Information to the public
|
||||
|
||||
In case of any Distribution or Communication of the Work by means of electronic
|
||||
communication by You (for example, by offering to download the Work from a
|
||||
remote location) the distribution channel or media (for example, a website) must
|
||||
at least provide to the public the information requested by the applicable law
|
||||
regarding the Licensor, the Licence and the way it may be accessible, concluded,
|
||||
stored and reproduced by the Licensee.
|
||||
|
||||
12. Termination of the Licence
|
||||
|
||||
The Licence and the rights granted hereunder will terminate automatically upon
|
||||
any breach by the Licensee of the terms of the Licence.
|
||||
|
||||
Such a termination will not terminate the licences of any person who has
|
||||
received the Work from the Licensee under the Licence, provided such persons
|
||||
remain in full compliance with the Licence.
|
||||
|
||||
13. Miscellaneous
|
||||
|
||||
Without prejudice of Article 9 above, the Licence represents the complete
|
||||
agreement between the Parties as to the Work.
|
||||
|
||||
If any provision of the Licence is invalid or unenforceable under applicable
|
||||
law, this will not affect the validity or enforceability of the Licence as a
|
||||
whole. Such provision will be construed or reformed so as necessary to make it
|
||||
valid and enforceable.
|
||||
|
||||
The European Commission may publish other linguistic versions or new versions of
|
||||
this Licence or updated versions of the Appendix, so far this is required and
|
||||
reasonable, without reducing the scope of the rights granted by the Licence. New
|
||||
versions of the Licence will be published with a unique version number.
|
||||
|
||||
All linguistic versions of this Licence, approved by the European Commission,
|
||||
have identical value. Parties can take advantage of the linguistic version of
|
||||
their choice.
|
||||
|
||||
14. Jurisdiction
|
||||
|
||||
Without prejudice to specific agreement between parties,
|
||||
|
||||
- any litigation resulting from the interpretation of this License, arising
|
||||
between the European Union institutions, bodies, offices or agencies, as a
|
||||
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
||||
of Justice of the European Union, as laid down in article 272 of the Treaty on
|
||||
the Functioning of the European Union,
|
||||
|
||||
- any litigation arising between other parties and resulting from the
|
||||
interpretation of this License, will be subject to the exclusive jurisdiction
|
||||
of the competent court where the Licensor resides or conducts its primary
|
||||
business.
|
||||
|
||||
15. Applicable Law
|
||||
|
||||
Without prejudice to specific agreement between parties,
|
||||
|
||||
- this Licence shall be governed by the law of the European Union Member State
|
||||
where the Licensor has his seat, resides or has his registered office,
|
||||
|
||||
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
||||
residence or registered office inside a European Union Member State.
|
||||
|
||||
Appendix
|
||||
|
||||
‘Compatible Licences’ according to Article 5 EUPL are:
|
||||
|
||||
- GNU General Public License (GPL) v. 2, v. 3
|
||||
- GNU Affero General Public License (AGPL) v. 3
|
||||
- Open Software License (OSL) v. 2.1, v. 3.0
|
||||
- Eclipse Public License (EPL) v. 1.0
|
||||
- CeCILL v. 2.0, v. 2.1
|
||||
- Mozilla Public Licence (MPL) v. 2
|
||||
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
||||
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
||||
works other than software
|
||||
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
||||
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
||||
Reciprocity (LiLiQ-R+).
|
||||
|
||||
The European Commission may update this Appendix to later versions of the above
|
||||
licences without producing a new version of the EUPL, as long as they provide
|
||||
the rights granted in Article 2 of this Licence and protect the covered Source
|
||||
Code from exclusive appropriation.
|
||||
|
||||
All other changes or additions to this Appendix require the production of a new
|
||||
EUPL version.
|
9
_CREDITS.md
Normal file
9
_CREDITS.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Credits
|
||||
|
||||
## Inspired by
|
||||
|
||||
- [The Backloggery](https://backloggery.com/)
|
||||
|
||||
## A couple ideas by
|
||||
|
||||
- [Gattopandacorno](https://github.com/gattopandacorno/)
|
221
_cms.ts
Normal file
221
_cms.ts
Normal file
|
@ -0,0 +1,221 @@
|
|||
import { default as lumeCMS } from "lume/cms/mod.ts";
|
||||
import {formatDateIso} from "./_utils/date.ts"
|
||||
|
||||
const cms = lumeCMS();
|
||||
|
||||
|
||||
cms.document(
|
||||
"globals",
|
||||
"src:_data.yml",
|
||||
[
|
||||
{
|
||||
name: "title",
|
||||
type: "text",
|
||||
label: "Site title",
|
||||
description: "The main title of the site.",
|
||||
attributes: {
|
||||
placeholder: "Peafowl",
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "subtitle",
|
||||
type: "text",
|
||||
label: "Site subtitle",
|
||||
description: "The caption to be displayed below the title of the site.",
|
||||
attributes: {
|
||||
placeholder: "Review CMS",
|
||||
}
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
cms.document(
|
||||
"index",
|
||||
"src:index.md",
|
||||
[
|
||||
{
|
||||
name: "content",
|
||||
type: "markdown",
|
||||
label: "Introduction text",
|
||||
description: "The text to display at the top of the home page."
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
cms.document(
|
||||
"list-games",
|
||||
"src:list-games.md",
|
||||
[
|
||||
{
|
||||
name: "content",
|
||||
type: "markdown",
|
||||
label: "Introduction",
|
||||
description: "The text to display at the top of the page."
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
cms.collection(
|
||||
"games",
|
||||
"src:games/*.md",
|
||||
[
|
||||
{
|
||||
name: "name",
|
||||
type: "text",
|
||||
label: "Name",
|
||||
description: "The full name of the game.",
|
||||
attributes: {
|
||||
required: true,
|
||||
placeholder: "Ricochet Returns"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "name_sort",
|
||||
type: "text",
|
||||
label: "Sort as",
|
||||
description: "If specified, when sorting games alphabetically, the game will be sorted as if this was its actual name.",
|
||||
attributes: {
|
||||
placeholder: "Ricochet 2"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "active",
|
||||
type: "checkbox",
|
||||
label: "Now playing",
|
||||
description: "Whether you're currently playing this game or not. If checked, prominently displays the game on the home page."
|
||||
},
|
||||
{
|
||||
name: "rating",
|
||||
type: "number",
|
||||
label: "Rating",
|
||||
description: "The rating from 1 to 100 you want to give to the game. A rating from 1 to 35 is considered negative, from 36 to 65 mixed, from 66 to 95 positive, and from 96 to 100 perfect. A rating of 0 means unscored.",
|
||||
attributes: {
|
||||
placeholder: "Unscored"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "content",
|
||||
type: "markdown",
|
||||
label: "Review",
|
||||
description: "The review to display on the game page.",
|
||||
attributes: {
|
||||
placeholder: "Truly, the most *game* of all times."
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "progress",
|
||||
type: "select",
|
||||
label: "Progress",
|
||||
description: "How much progress you've made in the game.",
|
||||
options: [
|
||||
{
|
||||
value: "",
|
||||
label: "",
|
||||
},
|
||||
{
|
||||
value: "notapplicable",
|
||||
label: "Not applicable: the game has nothing to progress in.",
|
||||
},
|
||||
{
|
||||
value: "new",
|
||||
label: "New: you haven't started playing the game yet.",
|
||||
},
|
||||
{
|
||||
value: "started",
|
||||
label: "Started: you have started the game, but not reached its end.",
|
||||
},
|
||||
{
|
||||
value: "beaten",
|
||||
label: "Beaten: you have reached the end of the game, such as the credits, but haven't done everything yet.",
|
||||
},
|
||||
{
|
||||
value: "completed",
|
||||
label: "Completed: you have cleared everything that this game has to offer.",
|
||||
},
|
||||
{
|
||||
value: "mastered",
|
||||
label: "Mastered: you have overcome self-imposed challenges far greater than the ones intended by the game."
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "hours_played",
|
||||
type: "number",
|
||||
label: "Hours played",
|
||||
description: "The number of hours you've played the game for. 0 is considered unknown; set to a negative value to explicitly state that you haven't played this game at all."
|
||||
},
|
||||
{
|
||||
name: "purchased_on",
|
||||
type: "date",
|
||||
label: "Purchased on",
|
||||
description: "The date on which you've purchased the game.",
|
||||
},
|
||||
{
|
||||
name: "started_on",
|
||||
type: "date",
|
||||
label: "Started on",
|
||||
description: "The date on which you've first started playing the game.",
|
||||
},
|
||||
{
|
||||
name: "beaten_on",
|
||||
type: "date",
|
||||
label: "Beaten on",
|
||||
description: "The date on which you've first beaten the game.",
|
||||
},
|
||||
{
|
||||
name: "completed_on",
|
||||
type: "date",
|
||||
label: "Completed on",
|
||||
description: "The date on which you've first completed the game.",
|
||||
},
|
||||
{
|
||||
name: "mastered_on",
|
||||
type: "date",
|
||||
label: "Mastered on",
|
||||
description: "The date on which you've achieved mastery of the game.",
|
||||
},
|
||||
{
|
||||
name: "identifiers",
|
||||
type: "choose-list",
|
||||
label: "Identifiers",
|
||||
description: "Details that unequivocabily and globally identify the game. Shouldn't be edited manually.",
|
||||
fields: [
|
||||
{
|
||||
name: "steam",
|
||||
type: "object",
|
||||
label: "Steam",
|
||||
description: "",
|
||||
fields: [
|
||||
{
|
||||
name: "platform",
|
||||
type: "hidden",
|
||||
label: "Platform",
|
||||
value: "steam",
|
||||
},
|
||||
{
|
||||
name: "appid",
|
||||
type: "text",
|
||||
label: "AppID",
|
||||
description: "The AppID that the game has on Steam. Usually ends with a 0. Can be obtained from the store page link, after the /app/ segment.",
|
||||
},
|
||||
{
|
||||
name: "name",
|
||||
type: "text",
|
||||
label: "Name",
|
||||
description: "The title of the game, as it appears on Steam."
|
||||
},
|
||||
{
|
||||
name: "synced_on",
|
||||
type: "date",
|
||||
label: "Last sync",
|
||||
description: "The date of the last sync."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
export default cms;
|
101
_components/GameRow.tsx
Normal file
101
_components/GameRow.tsx
Normal file
|
@ -0,0 +1,101 @@
|
|||
import {formatDateIso} from "../_utils/date.ts"
|
||||
import {GameData} from "../_utils/game.ts"
|
||||
import {Progress, progressToClassName, progressToIconDef, progressToTitle} from "../_utils/progress.ts"
|
||||
import {ratingToClassName} from "../_utils/rating.ts"
|
||||
|
||||
|
||||
export type GameRowColumnKind = "rating" | "progress" | "name" | "hascontent" | "date" | "hoursplayed"
|
||||
export type GameRowColumnPriority = undefined | "rating" | "progress" | "mixed"
|
||||
|
||||
export const gameRowColumnKindDefault: GameRowColumnKind[] = ["rating", "name", "hascontent", "date", "progress", "hoursplayed"]
|
||||
|
||||
|
||||
export type GameRowProps = {
|
||||
game: GameData,
|
||||
columns?: GameRowColumnKind[]
|
||||
priority?: GameRowColumnPriority
|
||||
}
|
||||
|
||||
|
||||
export function GameRow({game, columns = gameRowColumnKindDefault, priority}: GameRowProps) {
|
||||
const activeClass: string = game.active ? "review-active" : ""
|
||||
const activeClassFa: string = game.active ? "fa-beat-fade" : ""
|
||||
|
||||
const ratingText: string = game.rating ? `${game.rating}` : ""
|
||||
|
||||
const ratingClass: string = ratingToClassName(game.rating)
|
||||
|
||||
const progressClass: string = progressToClassName(game.progress)
|
||||
const progressIcon: string = progressToIconDef(game.progress)
|
||||
const progressTitle: string = progressToTitle(game.progress)
|
||||
|
||||
const priorityClass: string = priority ? `priority-${priority}` : ""
|
||||
|
||||
const columnsElements = columns.map((kind, index) => {
|
||||
switch(kind) {
|
||||
case "rating": {
|
||||
return (
|
||||
<td key={index} className={`review-rating ${ratingClass}`}>
|
||||
<data value={ratingText}>
|
||||
{ratingText}
|
||||
</data>
|
||||
</td>
|
||||
)
|
||||
}
|
||||
case "progress": {
|
||||
return (
|
||||
<td key={index} className={`game-progress ${progressClass}`}>
|
||||
<data value={game.progress ?? Progress.Unset} title={progressTitle}>
|
||||
{progressIcon && <i className={`fa-sharp fa-regular ${progressIcon} ${activeClassFa}`}></i>}
|
||||
</data>
|
||||
</td>
|
||||
)
|
||||
}
|
||||
case "name": {
|
||||
return (
|
||||
<td key={index} className={`review-name`}>
|
||||
<a href={game.url}>
|
||||
<data value={game.name ?? ""}>
|
||||
{game.name}
|
||||
</data>
|
||||
</a>
|
||||
</td>
|
||||
)
|
||||
}
|
||||
case "hascontent": {
|
||||
return (
|
||||
<td key={index} className={`review-hascontent`}>
|
||||
<data value={game.content ? "true" : "false"}>
|
||||
<i className={"fa-sharp fa-regular fa-bars-sort"}/>
|
||||
</data>
|
||||
</td>
|
||||
)
|
||||
}
|
||||
case "date": {
|
||||
const date = formatDateIso(game.date)
|
||||
return (
|
||||
<td key={index} className={`review-date`}>
|
||||
<time dateTime={date ?? ""}>
|
||||
{date}
|
||||
</time>
|
||||
</td>
|
||||
)
|
||||
}
|
||||
case "hoursplayed": {
|
||||
return (
|
||||
<td key={index} className={`game-hoursplayed`}>
|
||||
<data value={game.hours_played ?? ""}>
|
||||
{(game.hours_played ?? 0) > 0 ? `${game.hours_played} h` : ""}
|
||||
</data>
|
||||
</td>
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<tr className={`game ${activeClass} ${ratingClass} ${progressClass} ${priorityClass}`}>
|
||||
{columnsElements}
|
||||
</tr>
|
||||
)
|
||||
}
|
103
_components/GameTable.tsx
Normal file
103
_components/GameTable.tsx
Normal file
|
@ -0,0 +1,103 @@
|
|||
import {GameData} from "../_utils/game.ts"
|
||||
import {GameRow, GameRowColumnKind, gameRowColumnKindDefault, GameRowColumnPriority} from "./GameRow.tsx"
|
||||
|
||||
|
||||
export type GameTableProps = {
|
||||
games: GameData[],
|
||||
columns?: GameRowColumnKind[]
|
||||
priority?: GameRowColumnPriority
|
||||
}
|
||||
|
||||
|
||||
export function GameTable({games, columns = gameRowColumnKindDefault, priority}: GameTableProps) {
|
||||
const colElements = columns.map((column, index) => {
|
||||
switch(column) {
|
||||
case "rating": return (
|
||||
<col key={index} className={`review-rating`}/>
|
||||
)
|
||||
case "progress": return (
|
||||
<col key={index} className={`game-progress`}/>
|
||||
)
|
||||
case "name": return (
|
||||
<col key={index} className={`review-name`}/>
|
||||
)
|
||||
case "hascontent": return (
|
||||
<col key={index} className={`review-hascontent`}/>
|
||||
)
|
||||
case "date": return (
|
||||
<col key={index} className={`review-date`}/>
|
||||
)
|
||||
case "hoursplayed": return (
|
||||
<col key={index} className={`review-hoursplayed`}/>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
const thElements = columns.map((column, index) => {
|
||||
switch(column) {
|
||||
case "rating": return (
|
||||
<th key={index} scope={"col"} className={`review-rating`}>
|
||||
<abbr title={"The rating of the game, from 1 to 100."}>
|
||||
<i className={`fa-sharp fa-solid fa-thumbs-up`}/>
|
||||
</abbr>
|
||||
</th>
|
||||
)
|
||||
case "progress": return (
|
||||
<th key={index} scope={"col"} className={`game-progress`}>
|
||||
<abbr title={"The progress that has been made in the game."}>
|
||||
<i className={`fa-sharp fa-solid fa-bars-progress`}/>
|
||||
</abbr>
|
||||
</th>
|
||||
)
|
||||
case "name": return (
|
||||
<th key={index} scope={"col"} className={`review-name`}>
|
||||
<abbr title={"The title of the game."}>
|
||||
Title
|
||||
</abbr>
|
||||
</th>
|
||||
)
|
||||
case "hascontent": return (
|
||||
<th key={index} scope={"col"} className={`review-hascontent`}>
|
||||
<abbr title={"Whether the review has textual content, or just metadata."}>
|
||||
<i className={`fa-sharp fa-regular fa-bars-sort`}/>
|
||||
</abbr>
|
||||
</th>
|
||||
)
|
||||
case "date": return (
|
||||
<th key={index} scope={"col"} className={`review-date`}>
|
||||
<abbr title={"The date of the last update of the review."}>
|
||||
Date
|
||||
</abbr>
|
||||
</th>
|
||||
)
|
||||
case "hoursplayed": return (
|
||||
<th key={index} scope={"col"} className={`game-hoursplayed`}>
|
||||
<abbr title={"How many hours the game has been played for."}>
|
||||
Playtime
|
||||
</abbr>
|
||||
</th>
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
const trTdElements = games.map((game: GameData) => (
|
||||
<GameRow key={game.url} game={game} columns={columns} priority={priority}/>
|
||||
))
|
||||
|
||||
return (
|
||||
<table>
|
||||
<colgroup>
|
||||
{colElements}
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
{thElements}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{trTdElements}
|
||||
</tbody>
|
||||
</table>
|
||||
)
|
||||
}
|
75
_components/ReviewInfo.tsx
Normal file
75
_components/ReviewInfo.tsx
Normal file
|
@ -0,0 +1,75 @@
|
|||
import {React} from "https://deno.land/x/lume@v2.2.1/deps/react.ts"
|
||||
import {ratingToClassName} from "../_utils/rating.ts"
|
||||
|
||||
|
||||
export type ReviewInfoProps = {
|
||||
name?: string,
|
||||
rating?: number,
|
||||
metadata?: React.ReactNode,
|
||||
children?: React.ReactNode,
|
||||
}
|
||||
|
||||
export function ReviewInfo({name, rating, metadata, children}: ReviewInfoProps) {
|
||||
const reviewBarStyle = {}
|
||||
if(rating) {
|
||||
reviewBarStyle["width"] = `${rating}%`
|
||||
}
|
||||
|
||||
const ratingClass = ratingToClassName(rating);
|
||||
|
||||
return (
|
||||
<div className={`reviewinfo ${ratingClass}`}>
|
||||
<h2 className={"reviewinfo-name"}>
|
||||
<data value={name}>
|
||||
{name}
|
||||
</data>
|
||||
</h2>
|
||||
<div className={"reviewinfo-rating"}>
|
||||
<data value={rating}>
|
||||
{rating}
|
||||
</data>
|
||||
</div>
|
||||
<div className={"reviewinfo-bar-base"} aria-hidden={true}/>
|
||||
<div className={"reviewinfo-bar-empty"} aria-hidden={true}>
|
||||
<div
|
||||
className={"reviewinfo-bar-fill"}
|
||||
style={reviewBarStyle}
|
||||
aria-hidden={true}
|
||||
/>
|
||||
</div>
|
||||
<div className={"reviewinfo-metadata"}>
|
||||
{metadata}
|
||||
</div>
|
||||
<div className={"reviewinfo-content"}>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export type ReviewInfoMetadataRowProps = {
|
||||
label?: React.ReactNode,
|
||||
icon?: React.ReactNode,
|
||||
className?: string,
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
ReviewInfo.MetadataRow = function ReviewInfoMetadataRow({label, icon, className, children}: ReviewInfoMetadataRowProps) {
|
||||
return <>
|
||||
<div className={`reviewinfo-metadata-label ${className ?? ""}`}>
|
||||
<div>
|
||||
{label}
|
||||
</div>
|
||||
</div>
|
||||
<div className={`reviewinfo-metadata-content ${className ?? ""}`}>
|
||||
{icon &&
|
||||
<div className={`reviewinfo-metadata-icon`}>
|
||||
{icon}
|
||||
</div>
|
||||
}
|
||||
<div>
|
||||
{children}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
88
_config.ts
Normal file
88
_config.ts
Normal file
|
@ -0,0 +1,88 @@
|
|||
import {default as lume} from "lume/mod.ts";
|
||||
import {default as jsx} from "lume/plugins/jsx.ts"
|
||||
import {default as feed} from "lume/plugins/feed.ts"
|
||||
import fileData from "./_plugins/fileData.ts"
|
||||
|
||||
|
||||
const site = lume({
|
||||
prettyUrls: false,
|
||||
})
|
||||
|
||||
site.use(jsx({}))
|
||||
|
||||
site.copy("_static")
|
||||
|
||||
site.data("styles", ["/_static/styles/base.css"])
|
||||
site.data("lang", "en")
|
||||
site.data("date", "Git Last Modified")
|
||||
|
||||
site.data("layout", "index.tsx", "/index.md")
|
||||
site.data("tags", ["index"], "/index.md")
|
||||
|
||||
site.data("url", "/games/index.html", "/list-games.md")
|
||||
site.data("layout", "list-games.tsx", "/list-games.md")
|
||||
site.data("tags", ["list", "list-games"], "/list-games.md")
|
||||
|
||||
site.data("layout", "game.tsx", "/games")
|
||||
site.data("tags", ["review", "game"], "/games")
|
||||
|
||||
site.use(fileData({
|
||||
query: "index",
|
||||
urlizer(data) {
|
||||
return data.url.replace(".html", ".json")
|
||||
},
|
||||
contentizer(data) {
|
||||
return JSON.stringify({
|
||||
title: data.title,
|
||||
subtitle: data.subtitle,
|
||||
lists: site.search.pages("list").map((data) => data.url)
|
||||
})
|
||||
}
|
||||
}))
|
||||
site.use(fileData({
|
||||
query: "list-games",
|
||||
urlizer(data) {
|
||||
return "/games/index.json"
|
||||
},
|
||||
contentizer(data) {
|
||||
return JSON.stringify({
|
||||
content: data.content,
|
||||
items: site.search.pages("game").map((data) => data.url)
|
||||
})
|
||||
}
|
||||
}))
|
||||
site.use(fileData({
|
||||
query: "game",
|
||||
urlizer(data) {
|
||||
return data.url.replace(".html", ".json")
|
||||
},
|
||||
contentizer(data) {
|
||||
return JSON.stringify({
|
||||
name: data.name ?? null,
|
||||
rating: data.rating ?? null,
|
||||
content: data.content ?? null,
|
||||
active: data.active ?? null,
|
||||
progress: data.progress ?? null,
|
||||
hours_played: data.hours_played ?? null,
|
||||
purchased_on: data.purchased_on ?? null,
|
||||
started_on: data.started_on ?? null,
|
||||
beaten_on: data.beaten_on ?? null,
|
||||
completed_on: data.completed_on ?? null,
|
||||
mastered_on: data.mastered_on ?? null,
|
||||
identifiers: data.identifiers ?? null,
|
||||
})
|
||||
}
|
||||
}))
|
||||
site.use(feed({
|
||||
output: ["/games/feed.rss", "/games/feed.json"],
|
||||
query: "game",
|
||||
limit: 10,
|
||||
info: {
|
||||
title: "Videogames",
|
||||
},
|
||||
items: {
|
||||
title: "=name"
|
||||
}
|
||||
}))
|
||||
|
||||
export default site;
|
0
_data.yml
Normal file
0
_data.yml
Normal file
53
_includes/base.tsx
Normal file
53
_includes/base.tsx
Normal file
|
@ -0,0 +1,53 @@
|
|||
export default function(data: Lume.Data, helpers: Lume.Helpers) {
|
||||
const charset = (
|
||||
<meta charSet={"utf8"}/>
|
||||
)
|
||||
|
||||
const viewport = (
|
||||
<meta
|
||||
name={"viewport"}
|
||||
content={"width=device-width, initial-scale=1"}
|
||||
/>
|
||||
)
|
||||
|
||||
const title = (
|
||||
<title children={data.site_title}/>
|
||||
)
|
||||
|
||||
const stylesheets = data.styles.map((style: string) => (
|
||||
<link
|
||||
key={style}
|
||||
rel={"stylesheet"}
|
||||
href={style}
|
||||
/>
|
||||
))
|
||||
|
||||
const header = (
|
||||
<header>
|
||||
<hgroup className={"base-titles"}>
|
||||
<a href={helpers.url("/")}>
|
||||
<h1>{data.title}</h1>
|
||||
<div>{data.subtitle}</div>
|
||||
</a>
|
||||
</hgroup>
|
||||
</header>
|
||||
)
|
||||
|
||||
const children = data.children
|
||||
|
||||
// noinspection HtmlRequiredTitleElement
|
||||
return (
|
||||
<html>
|
||||
<head>
|
||||
{charset}
|
||||
{viewport}
|
||||
{title}
|
||||
{stylesheets}
|
||||
</head>
|
||||
<body>
|
||||
{header}
|
||||
{children}
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
162
_includes/game.tsx
Normal file
162
_includes/game.tsx
Normal file
|
@ -0,0 +1,162 @@
|
|||
import {formatDateIso} from "../_utils/date.ts"
|
||||
import {GameData, GameIdentifier} from "../_utils/game.ts"
|
||||
import {Progress, progressToClassName, progressToIconDef, progressToTitle} from "../_utils/progress.ts"
|
||||
import {ReviewInfo} from "../_components/ReviewInfo.tsx"
|
||||
|
||||
|
||||
export const layout = "base.tsx"
|
||||
|
||||
export default function(data: GameData, helpers: Lume.Helpers) {
|
||||
const dateRow = (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={"review-date"}
|
||||
label={"Last updated"}
|
||||
>
|
||||
{formatDateIso(data.date)}
|
||||
</ReviewInfo.MetadataRow>
|
||||
)
|
||||
|
||||
const dateSeparator = (data.progress || data.hours_played) ? <hr/> : null
|
||||
|
||||
const progressRow = data.progress ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-progress ${progressToClassName(data.progress)}`}
|
||||
label={"Progress"}
|
||||
icon={<i className={`fa-sharp fa-regular ${progressToIconDef(data.progress)} ${data.active ? "fa-beat-fade" : ""}`}/>}
|
||||
>
|
||||
<data value={data.progress}>
|
||||
{progressToTitle(data.progress)}
|
||||
</data>
|
||||
{data.active &&
|
||||
<>
|
||||
,
|
||||
<span className={"fa-fade"} style={{animationDelay: '-0.5s'}}>now playing</span>
|
||||
</>
|
||||
}
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const hoursPlayedRow = data.hours_played ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-hoursplayed`}
|
||||
label={"Playtime"}
|
||||
>
|
||||
<data value={data.hours_played}>
|
||||
{data.hours_played}
|
||||
</data>
|
||||
|
||||
h
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const playedSeparator = (data.purchased_on || data.started_on || data.beaten_on || data.completed_on || data.mastered_on) ? <hr/> : null
|
||||
|
||||
const purchasedOnValue = formatDateIso(data.purchased_on)
|
||||
const purchasedOnRow = purchasedOnValue ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-purchasedon`}
|
||||
label={"Purchased on"}
|
||||
icon={<i className={`fa-sharp fa-regular ${progressToIconDef(Progress.New)}`}/>}
|
||||
>
|
||||
<time dateTime={purchasedOnValue}>
|
||||
{purchasedOnValue}
|
||||
</time>
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const startedOnValue = formatDateIso(data.started_on)
|
||||
const startedOnRow = startedOnValue ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-startedon`}
|
||||
label={"Started on"}
|
||||
icon={<i className={`fa-sharp fa-regular ${progressToIconDef(Progress.Started)}`}/>}
|
||||
>
|
||||
<time dateTime={startedOnValue}>
|
||||
{startedOnValue}
|
||||
</time>
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const beatenOnValue = formatDateIso(data.beaten_on)
|
||||
const beatenOnRow = beatenOnValue ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-beatenon`}
|
||||
label={"Beaten on"}
|
||||
icon={<i className={`fa-sharp fa-regular ${progressToIconDef(Progress.Beaten)}`}/>}
|
||||
>
|
||||
<time dateTime={beatenOnValue}>
|
||||
{beatenOnValue}
|
||||
</time>
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const completedOnValue = formatDateIso(data.completed_on)
|
||||
const completedOnRow = completedOnValue ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-completedon`}
|
||||
label={"Completed on"}
|
||||
icon={<i className={`fa-sharp fa-regular ${progressToIconDef(Progress.Completed)}`}/>}
|
||||
>
|
||||
<time dateTime={completedOnValue}>
|
||||
{completedOnValue}
|
||||
</time>
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const masteredOnValue = formatDateIso(data.mastered_on)
|
||||
const masteredOnRow = masteredOnValue ? (
|
||||
<ReviewInfo.MetadataRow
|
||||
className={`game-masteredon`}
|
||||
label={"Mastered on"}
|
||||
icon={<i className={`fa-sharp fa-regular ${progressToIconDef(Progress.Mastered)}`}/>}
|
||||
>
|
||||
<time dateTime={masteredOnValue}>
|
||||
{masteredOnValue}
|
||||
</time>
|
||||
</ReviewInfo.MetadataRow>
|
||||
) : null
|
||||
|
||||
const milestonesSeparator = ((data.identifiers?.length ?? 0) > 0) ? <hr/> : null
|
||||
|
||||
const identifiersRows = data.identifiers?.map((identifier: GameIdentifier, index: number) => {
|
||||
switch(identifier.platform) {
|
||||
case "steam":
|
||||
return (
|
||||
<ReviewInfo.MetadataRow
|
||||
key={index}
|
||||
className={`game-identifier-steam`}
|
||||
label={<span><i className={`fa-brands fa-steam`}/> Steam</span>}
|
||||
>
|
||||
<a href={`https://store.steampowered.com/app/${identifier.appid}/`}>
|
||||
{identifier.name ?? identifier.appid}
|
||||
</a>
|
||||
</ReviewInfo.MetadataRow>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<main id={"game-main"}>
|
||||
<ReviewInfo
|
||||
name={data.name}
|
||||
rating={data.rating}
|
||||
metadata={<>
|
||||
{dateRow}
|
||||
{dateSeparator}
|
||||
{progressRow}
|
||||
{hoursPlayedRow}
|
||||
{playedSeparator}
|
||||
{purchasedOnRow}
|
||||
{startedOnRow}
|
||||
{beatenOnRow}
|
||||
{completedOnRow}
|
||||
{masteredOnRow}
|
||||
{milestonesSeparator}
|
||||
{identifiersRows}
|
||||
</>}
|
||||
>
|
||||
{data.children}
|
||||
</ReviewInfo>
|
||||
</main>
|
||||
)
|
||||
}
|
131
_includes/index.tsx
Normal file
131
_includes/index.tsx
Normal file
|
@ -0,0 +1,131 @@
|
|||
import {compareDate} from "../_utils/date.ts"
|
||||
import { GameData } from "../_utils/game.ts";
|
||||
import {GameTable} from "../_components/GameTable.tsx"
|
||||
import {compare_progress} from "../_utils/progress.ts"
|
||||
import {GlobalData} from "../_utils/site.ts"
|
||||
|
||||
|
||||
export const layout = "base.tsx"
|
||||
|
||||
export default function(data: GlobalData, helpers: Lume.Helpers) {
|
||||
const intro_section = data.content ? (
|
||||
<section id={"index-section-intro"}>
|
||||
{data.children}
|
||||
</section>
|
||||
) : null
|
||||
|
||||
const games: GameData[] = data.search.pages("game")
|
||||
|
||||
const active_games = games
|
||||
.filter(game => game.active)
|
||||
.sort(compareDate as any)
|
||||
|
||||
const active_games_section = (
|
||||
<section id={"index-section-games-active"} className={"flex flex-v"}>
|
||||
<h3>
|
||||
Now playing
|
||||
</h3>
|
||||
<div>
|
||||
<GameTable games={active_games} columns={["progress", "name", "hoursplayed", "date"]} priority={"progress"}/>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
const top_games = games
|
||||
.sort((a, b) => ((b.rating ?? 0) - (a.rating ?? 0)))
|
||||
.slice(0, 10)
|
||||
|
||||
const top_games_section = (
|
||||
<section id={"index-section-games-top"} className={"flex flex-v"}>
|
||||
<h3>
|
||||
Top games
|
||||
</h3>
|
||||
<div>
|
||||
<GameTable games={top_games} columns={["rating", "name", "hascontent"]} priority={"rating"}/>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
const played_games = games
|
||||
.sort((a, b) => ((b.hours_played ?? 0) - (a.hours_played ?? 0)))
|
||||
.slice(0, 10)
|
||||
|
||||
const played_games_section = (
|
||||
<section id={"index-section-games-top"} className={"flex flex-v"}>
|
||||
<h3>
|
||||
Most played games
|
||||
</h3>
|
||||
<div>
|
||||
<GameTable games={played_games} columns={["hoursplayed", "name"]}/>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
const progress_games = games
|
||||
.sort((a, b) => -compare_progress(a, b))
|
||||
.slice(0, 10)
|
||||
|
||||
const progress_games_section = (
|
||||
<section id={"index-section-games-top"} className={"flex flex-v"}>
|
||||
<h3>
|
||||
Most progressed games
|
||||
</h3>
|
||||
<div>
|
||||
<GameTable games={progress_games} columns={["progress", "name", "hoursplayed"]} priority={"progress"}/>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
const latest_games = games
|
||||
.sort((a, b) => -compareDate(a, b))
|
||||
.slice(0, 10)
|
||||
|
||||
const latest_games_section = (
|
||||
<section id={"index-section-games-latest"} className={"flex flex-v"}>
|
||||
<h3>
|
||||
Latest updates
|
||||
</h3>
|
||||
<div>
|
||||
<GameTable games={latest_games} columns={["hascontent", "name", "date"]}/>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
const games_cols = (games.length > 0) ? (
|
||||
<section className={"flex flex-v"}>
|
||||
<h2>
|
||||
Videogames
|
||||
<small>
|
||||
<a href={helpers.url("~/list-games.md")}>
|
||||
<i className={"fa-sharp fa-solid fa-magnifying-glass"}/> View all
|
||||
</a>
|
||||
</small>
|
||||
<small>
|
||||
<a href={helpers.url("/games/feed.rss")}>
|
||||
<i className={"fa-sharp fa-solid fa-rss"}/> Feed
|
||||
</a>
|
||||
</small>
|
||||
</h2>
|
||||
{active_games.length > 0 && (
|
||||
<div className={"flex flex-1"}>
|
||||
{active_games_section}
|
||||
</div>
|
||||
)}
|
||||
<div className={"flex flex-2"}>
|
||||
{top_games_section}
|
||||
{progress_games_section}
|
||||
</div>
|
||||
<div className={"flex flex-2"}>
|
||||
{played_games_section}
|
||||
{latest_games_section}
|
||||
</div>
|
||||
</section>
|
||||
) : null
|
||||
|
||||
return (
|
||||
<main id={"index-main"} className={"flex flex-v"}>
|
||||
{intro_section}
|
||||
{games_cols}
|
||||
</main>
|
||||
)
|
||||
}
|
35
_includes/list-games.tsx
Normal file
35
_includes/list-games.tsx
Normal file
|
@ -0,0 +1,35 @@
|
|||
import {GameTable} from "../_components/GameTable.tsx"
|
||||
import { GameData } from "../_utils/game.ts";
|
||||
|
||||
|
||||
export const layout = "base.tsx"
|
||||
export const url = "/games.html"
|
||||
|
||||
export default function(data: Lume.Data, helpers: Lume.Helpers) {
|
||||
const intro_section = data.content ? (
|
||||
<section id={"list-games-section-intro"}>
|
||||
{data.children}
|
||||
</section>
|
||||
) : null
|
||||
|
||||
const games: GameData[] = data.search.pages("game")
|
||||
.sort((a, b) => (b.rating - a.rating)) as GameData[]
|
||||
|
||||
const games_section = (
|
||||
<section id={"list-games-section-games"}>
|
||||
<h2>
|
||||
Videogames list
|
||||
</h2>
|
||||
<div>
|
||||
<GameTable games={games} priority={"mixed"}/>
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
|
||||
return (
|
||||
<main id={"list-games-main"}>
|
||||
{intro_section}
|
||||
{games_section}
|
||||
</main>
|
||||
)
|
||||
}
|
22
_plugins/fileData.ts
Normal file
22
_plugins/fileData.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import {Page} from "lume/core/file.ts"
|
||||
import Site from "lume/core/site.ts";
|
||||
|
||||
export type FileDataOptions = {
|
||||
query: string,
|
||||
urlizer: (data: Lume.Data) => string,
|
||||
contentizer: (data: Lume.Data) => string,
|
||||
}
|
||||
|
||||
export default function fileData({query, urlizer, contentizer}: FileDataOptions) {
|
||||
return (site: Site) => {
|
||||
site.addEventListener("beforeSave", () => {
|
||||
const datas: Lume.Data[] = site.search.pages(query)
|
||||
for(const data of datas) {
|
||||
site.pages.push(Page.create({
|
||||
url: urlizer(data),
|
||||
content: contentizer(data),
|
||||
}))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
10
_run.ts
Normal file
10
_run.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import {default as site} from "./_config.ts"
|
||||
import {default as cms} from "./_cms.ts"
|
||||
import {default as adapter} from "lume/cms/adapters/lume.ts"
|
||||
|
||||
const app = await adapter({site, cms})
|
||||
|
||||
Deno.serve({
|
||||
port: 8080,
|
||||
handler: app.fetch
|
||||
})
|
131
_scripts/importSteam.ts
Normal file
131
_scripts/importSteam.ts
Normal file
|
@ -0,0 +1,131 @@
|
|||
import { loadSync as loadEnv } from "dotenv/mod.ts";
|
||||
import site from "../_config.ts"
|
||||
import {formatDateIso} from "../_utils/date.ts"
|
||||
import {GameData, GameIdentifier} from "../_utils/game.ts"
|
||||
import {stringifyYaml} from "lume/cms/deps/std.ts"
|
||||
|
||||
/* This is arguably one of the worst scripts I've ever written. */
|
||||
|
||||
type SteamGame = {
|
||||
appid: number,
|
||||
name: string,
|
||||
playtime_forever: number,
|
||||
img_icon_url?: string,
|
||||
has_community_visible_stats: boolean,
|
||||
playtime_windows_forever: number,
|
||||
playtime_mac_forever: number,
|
||||
playtime_linux_forever: number,
|
||||
playtime_deck_forever: number,
|
||||
|