This commit is contained in:
sa8ab committed 2024-07-02 23:23:38 +03:30
commit 9fc103c8f2
92 files changed
+19555

No files matched your search

+190
View File
@@ -0,0 +1,190 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright 2024
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product 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 NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of 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 reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+7
View File
@@ -0,0 +1,7 @@
ITAR/Export Regulations Notice:
This project utilizes strong cryptography, which is subject to export control regulations under the International Traffic in Arms Regulations (ITAR) and the Export Administration Regulations (EAR) of the United States Department of Commerce.
The authors of this software provides the Work (as defined by the Apache License Version 2.0) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
By using this software, you are responsible for ensuring that you are in compliance with all applicable export regulations. The authors of this software are not responsible for any violations of export control regulations that may occur as a result of utilizing this software.
+181
View File
@@ -0,0 +1,181 @@
<h1 align="center">
<br>
<a href="https://xmrchat.com/"><img src="https://xmrchat.com/images/xmrchat-logo.png" alt="XMRChat" width="200"></a>
<br>
XMRChat
<br>
</h1>
<h4 align="center">A Complete SaaS for Online Tipping Solution on <a href="https://www.getmonero.org/" target="_blank">Monero Cryptocurrency Network (XMR)</a>.</h4>
## Overview
XMRChat is a tip-for-chat application. Users can set up a page and have others send chat messages in exchange for XMR. The application is built with a focus on privacy and security, and it is designed to be self-hosted.
### Table of Contents 🤸
- [Technology Stack 🚀](#tech-stack)
- Business Strategy
- [Payment Strategy 🧾](#payment-strategy)
- [Requirements 📝](#requirements)
- [Project Structure 📍](#structure)
- [Install & Build 🛠️](#install-and-build)
- [Traefik](#traefik)
- [Monero](#monero)
- [Server](#server)
- [Client](#client)
## <a name="tech-stack">Technology Stack 🚀</a>
- **Client Side:**
- **Framework:** [Nuxt Js](https://nuxt.com/) - [Vue Js](https://vuejs.org/)
- **Language:** [TypeScript](https://www.typescriptlang.org/)
- **Server Side:**
- **Framework:** [Elysia Js](https://elysiajs.com/)
- **Language:** [TypeScript](https://www.typescriptlang.org/)
- **Runtime:** [Bun](https://bun.sh)
- **Cache:** [Redis](https://redis.io/)
- **ORM:** [Kysely](https://kysely.dev/)
- **Database:** [PostgreSQL](https://www.postgresql.org/)
- **Infrastructure:**
- **Containerization:** [Docker 🐳](https://www.docker.com/)
- **Gateway:** [Traefik](https://traefik.io/)
- **Payment Providers:**
- **Monero:**
- [Monero Project](https://www.docker.com/)
- wallet Server : [monero-lws](https://github.com/vtnerd/monero-lws)
## Business Strategy: <a name="payment-strategy">Payment</a>
The service uses a one-time payment strategy. During the deployment setup process, you will need to provide your Monero wallet address and set the service price. After clients register, they will configure their page by specifying details such as name and unique URL path. Once the service price is paid, their page is now public, and they can share their page links with their audience to receive tips.
## <a name="requirements">Requirements 📝</a>
- [Docker 🐳](https://docs.docker.com/engine/install/)
- [git](https://git-scm.com/downloads)
- [Monero wallet](https://www.getmonero.org/downloads/#gui)
## <a name="structure">Project Structure 📍</a>
- [Server](./server/): Contains the backend code.
- [db](./server/src/db/): Contains the database connection and migration files.
- [routes](./server/src/routes/): Contains the route handlers.
- [schemas](./server/src/schemas/): Contains the route schemas definitions for validation.
- [services](./server/src/services/): Contains the service classes.
- [types](./server/src/types/): Contains type definitions.
- [utils](./server/src/utils/): Contains utility functions.
- [env.ts](./server/src/env.ts): Contains the environment variables and their default values.
- [index.ts](./server/src/index.ts): The entrypoint file for the backend.
- [Client](./client/): Contains the frontend code.
- [Monero](./monero/): Contains Monero network services (Monero Project & Monero-LWS).
- [Traefik](./traefik/): Contains Traefik setups
## <a name="install-and-build">Install & Build 🛠️</a>
### <a name="traefik">1. Traefik</a>
First of all you must create network that containers communicate over it.
```console
docker network create traefik
```
then setup the env
```console
cd traefik
cp .env.example .env
```
Now change the .env with yours and run the container.
> [!WARNING]
> The **password** must be **Hashed** in the env and also if you add that in compose file the "$" characters must be doubled to not recognized as variable by docker engine.
```console
docker compose up
```
### <a name="monero">2. Monero</a>
You can use Make file by below command in Monero directory to get and config Monero related repositories.
```console
cp monero
make monero-setup
```
or:
```console
cp monero
git clone https://github.com/monero-project/monero.git
git clone https://github.com/vtnerd/monero-lws/tree/release-v0.3_0.18
cp Dockerfile.monero ./monero/Dockerfile
cp Dockerfile.lws ./monero-lws/Dockerfile
```
Run the container :
```console
docker compose up -d
```
Because the Monero daemon must sync with the network, it may take a long time. You can monitor this process by checking the logs:
```console
docker compose logs -f
```
After it is synced and ready, go next.
### <a name="server">3. Server</a>
```console
cd server
cp .env.example
```
Change .env file with yours.
```console
docker compose up -d
```
### <a name="client">3. Client</a>
```console
cd client
cp .env.example
```
Change .env file with yours. and also change the env at the end of "Dockerfile" file.
```console
docker compose up -d
```
## Notes
See [NOTES.md](./NOTES.md) for additional notes and information about the technical details of the project.
## License
This project is licensed under the Apache License 2.0.
For the full license text, please see the [LICENSE](./LICENSE) file in the root of this repository.
### Notice
A NOTICE file has been included in the root of this repository. This file contains acknowledgments and notices required by the Apache License 2.0.
Pursuant to the terms of the Apache License 2.0, the NOTICE file must be included in redistributions of this software.
+21
View File
@@ -0,0 +1,21 @@
.vscode
node_modules
.editorconfig
.eslintignore
.eslintrc.json
.gitignore
.prettierrc.js
README.md
.output
.data
.nuxt
.nitro
.cache
nginx/
data/
redis/
monero/
traefik/
Makefile
+6
View File
@@ -0,0 +1,6 @@
DOMAIN_NAME=xmrchat.com
NUXT_PUBLIC_API_BASE_URL=https://api.xmrchat.com/api
NUXT_PUBLIC_API_SERVER_SIDE_BASE_URL=http://backend:3000/api
NUXT_PUBLIC_DEVTOOLS_ENABLED=false
PORT=3000
HOST=127.0.0.1
+26
View File
@@ -0,0 +1,26 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example
.data
+4
View File
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
+4
View File
@@ -0,0 +1,4 @@
{
"css.lint.unknownAtRules": "ignore",
"scss.lint.unknownAtRules": "ignore"
}
+26
View File
@@ -0,0 +1,26 @@
# Dockerfile
FROM node:lts-alpine3.19 AS builder
# create destination directory
RUN mkdir -p /usr/src/nuxt-app
WORKDIR /usr/src/nuxt-app
# update and install dependency
RUN apk update && apk upgrade
RUN apk add git
# copy the app, note .dockerignore
COPY . /usr/src/nuxt-app/
COPY .env.example /usr/src/nuxt-app/.env
RUN npm install --No
RUN npm run build
EXPOSE 3000
ENV DOMAIN_NAME=xmrchat.com
ENV NUXT_PUBLIC_API_BASE_URL=https://api.xmrchat.com/api
ENV NUXT_PUBLIC_API_SERVER_SIDE_BASE_URL=http://backend:3000/api
ENV PORT=3000
ENV HOST=0.0.0.0
CMD [ "node", "/usr/src/nuxt-app/.output/server/index.mjs" ]
+50
View File
@@ -0,0 +1,50 @@
# XMRChat Nuxt 3
Package manage: npm
## Development
```bash
npm install
npm run dev
```
### What is it using
`axios` for API requests
[Nuxt UI](https://ui.nuxt.com/) for ui elements
### Components
Components are auto imported using their name. You can also explicitly import them from '#imports' provided by nuxt.
### API
`axios` is used for sending API requests. the instance is created on axios.ts plugin can be accessed with `useApp` composable.
All api requests are placed `useServices` composable. so in general you won't need to use axios directly in the code.
### Error handling & Success Handling
Client side errors are handlded using `useErrorHandler` composable. Successful messages are rendered using `useSuccessHandler`
Server side errors ( `useAsyncData` errors ) is handled using `<PendingView />` component.
### Routing
All the routes are specified in `useRouteLocation` composable. To pass to a button, call the route
```ts
const { myRoute } = useRouteLocation();
```
```vue
<MyLink :to="myRoute()" />
```
to use it programatically get the path
```ts
const { myRoute } = useRouteLocation();
return navigateTo(myRoute().path);
```
+7
View File
@@ -0,0 +1,7 @@
export default defineAppConfig({
ui: {},
socials: {
twitter: "xmr_chat",
email: "[email protected]",
},
});
+24
View File
@@ -0,0 +1,24 @@
<script setup lang="ts">
useHead(() => {
return {
titleTemplate: (title) => (title ? `${title} | XMRChat` : "XMRChat"),
};
});
useAppSeoMeta();
</script>
<template>
<div class="app">
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<UNotifications />
</div>
</template>
<style>
.app {
@apply text-text bg-background;
}
</style>
File diff suppressed because it is too large. Load diff

After

Width:  |  Height:  |  Size: 121 KiB

+194
View File
@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="_ÎÓÈ_1" data-name="—ÎÓÈ_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1958.39 1295.01">
<defs>
<style>
.cls-1 {
fill: #fc346c;
}
.cls-2 {
fill: #fff;
}
.cls-3 {
fill: #fccc6c;
}
.cls-4 {
fill: #dce5f7;
}
.cls-5 {
fill: #240448;
}
.cls-6 {
fill: #44d4f4;
}
</style>
</defs>
<g>
<g>
<g>
<path class="cls-4" d="M176.65,1085.54V185.55c0-16.41,13.35-29.75,29.77-29.75H1751.98c16.41,0,29.75,13.35,29.75,29.75v899.99H176.65Z"/>
<path class="cls-6" d="M1751.98,131.22H206.41c-30,0-54.34,24.32-54.34,54.32v924.57H1806.31V185.54c0-30-24.32-54.32-54.33-54.32Zm5.18,929.74H201.22V185.54c0-2.85,2.33-5.17,5.19-5.17H1751.98c2.86,0,5.18,2.32,5.18,5.17v875.42Z"/>
<path class="cls-3" d="M1345.56,180.37h406.44c2.85,0,5.17,2.32,5.17,5.17v870.26c0,2.85-2.32,5.17-5.17,5.17h-406.44c-2.85,0-5.17-2.32-5.17-5.17V185.53c0-2.85,2.32-5.17,5.17-5.17Z"/>
</g>
<path class="cls-5" d="M1828.68,976.11c-1.27,0-2.34-.99-2.42-2.28l-49.56-836.32c-1.69-28.57-26.33-50.44-54.88-48.74l-217,12.86c-1.35,.08-2.48-.94-2.56-2.27s.94-2.48,2.27-2.56l217-12.86c31.25-1.84,58.15,22.05,60.01,53.29l49.56,836.32c.08,1.33-.94,2.48-2.27,2.56-.05,0-.1,0-.15,0Z"/>
<path class="cls-5" d="M159.98,781.06c-1.27,0-2.34-.99-2.41-2.28L125.36,235.38c-.9-15.13,4.15-29.71,14.22-41.04,10.07-11.33,23.95-18.07,39.08-18.96L1435.86,100.87c1.34-.07,2.48,.94,2.56,2.27s-.94,2.48-2.27,2.56L178.95,180.21c-13.84,.82-26.54,6.98-35.75,17.35-9.21,10.37-13.83,23.7-13.01,37.54l32.2,543.4c.08,1.34-.94,2.48-2.27,2.56-.05,0-.1,0-.15,0Z"/>
<path class="cls-5" d="M174.43,1024.81c-1.27,0-2.34-.99-2.41-2.28l-11.79-198.93c-.08-1.33,.94-2.48,2.27-2.56,1.32-.07,2.48,.94,2.56,2.27l11.79,198.93c.08,1.33-.94,2.48-2.27,2.56-.05,0-.1,0-.15,0Z"/>
<path class="cls-6" d="M1094.11,1235.41h801.63c34.6,0,62.65-28.05,62.65-62.65h0c0-34.6-28.05-62.65-62.65-62.65H62.65c-34.6,0-62.65,28.05-62.65,62.65H0c0,34.6,28.05,62.65,62.65,62.65H1094.11Z"/>
</g>
<circle class="cls-2" cx="1425.99" cy="273.03" r="36.5"/>
<circle class="cls-6" cx="1425.99" cy="385.95" r="36.5"/>
<circle class="cls-2" cx="1425.99" cy="498.87" r="36.5"/>
<circle class="cls-1" cx="1425.99" cy="611.79" r="36.5"/>
<circle class="cls-2" cx="1425.99" cy="724.71" r="36.5"/>
<circle class="cls-5" cx="1425.99" cy="837.63" r="36.5"/>
<circle class="cls-2" cx="1425.99" cy="950.55" r="36.5"/>
<g>
<path class="cls-2" d="M1701.32,258.79h-170c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h170c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1701.32,287.45h-103.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h103.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
</g>
<g>
<path class="cls-2" d="M1701.32,374.04h-170c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h170c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1701.32,402.71h-103.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h103.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
</g>
<g>
<path class="cls-2" d="M1701.32,489.29h-59.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h59.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1602.99,489.29h-71.67c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h71.67c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1701.32,517.96h-103.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h103.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
</g>
<g>
<path class="cls-2" d="M1701.32,604.55h-85c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h85c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1701.32,633.21h-144.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h144.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
</g>
<g>
<path class="cls-2" d="M1701.32,712.8h-134.17c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h134.17c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1701.32,741.47h-170c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h170c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
</g>
<g>
<path class="cls-2" d="M1701.32,827.95h-72.17c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h72.17c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1586.66,827.95h-55.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h55.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
<path class="cls-2" d="M1701.32,856.62h-103.33c-1.34,0-2.42-1.08-2.42-2.42s1.08-2.42,2.42-2.42h103.33c1.34,0,2.42,1.08,2.42,2.42s-1.08,2.42-2.42,2.42Z"/>
</g>
<g>
<path class="cls-5" d="M368.82,342.54v-76.02h16.12v62.71h30.84v13.31h-46.95Z"/>
<path class="cls-5" d="M428.99,342.54v-76.02h16.12v76.02h-16.12Z"/>
<path class="cls-5" d="M507.61,266.52h16.28l-25.84,76.02h-17.58l-25.79-76.02h16.28l14.3,45.24c.8,2.67,1.62,5.78,2.47,9.33,.85,3.55,1.38,6.02,1.59,7.41,.38-3.19,1.68-8.77,3.9-16.74l14.4-45.24Z"/>
<path class="cls-5" d="M577.24,342.54h-43.78v-76.02h43.78v13.21h-27.66v16.69h25.74v13.21h-25.74v19.6h27.66v13.31Z"/>
</g>
<circle class="cls-1" cx="309.32" cy="304.9" r="25.4"/>
</g>
<circle class="cls-2" cx="850.81" cy="593.64" r="324.06"/>
<polygon class="cls-6" points="1912.8 558.13 1919.48 570.74 1931.69 577.64 1919.48 584.54 1912.8 597.15 1906.12 584.54 1893.91 577.64 1906.12 570.74 1912.8 558.13"/>
<polygon class="cls-6" points="65.46 888.56 72.14 901.17 84.35 908.07 72.14 914.96 65.46 927.58 58.78 914.96 46.57 908.07 58.78 901.17 65.46 888.56"/>
<polygon class="cls-3" points="580.94 0 587.62 12.61 599.83 19.51 587.62 26.41 580.94 39.02 574.26 26.41 562.05 19.51 574.26 12.61 580.94 0"/>
<g>
<polygon class="cls-2" points="1209.76 265.52 1216.43 278.13 1228.65 285.03 1216.43 291.93 1209.76 304.54 1203.08 291.93 1190.87 285.03 1203.08 278.13 1209.76 265.52"/>
<polygon class="cls-2" points="1169.76 299.5 1180.44 319.69 1199.99 330.73 1180.44 341.77 1169.76 361.96 1159.07 341.77 1139.52 330.73 1159.07 319.69 1169.76 299.5"/>
</g>
<g>
<polygon class="cls-2" points="286.5 811.96 299.12 805.28 306.01 793.07 312.91 805.28 325.53 811.96 312.91 818.64 306.01 830.85 299.12 818.64 286.5 811.96"/>
<polygon class="cls-2" points="320.49 851.96 340.67 841.27 351.71 821.73 362.75 841.27 382.94 851.96 362.75 862.65 351.71 882.2 340.67 862.65 320.49 851.96"/>
</g>
<g>
<path class="cls-3" d="M520.8,511.99h0c0,14.27-11.57,25.83-25.83,25.83h0c-14.27,0-25.83-11.57-25.83-25.83h0c0-14.27,11.57-25.83,25.83-25.83h0c14.27,0,25.83,11.57,25.83,25.83Z"/>
<path class="cls-6" d="M580.94,577.57h0c0,7.58-6.14,13.72-13.72,13.72h0c-7.58,0-13.72-6.14-13.72-13.72h0c0-7.58,6.14-13.72,13.72-13.72h0c7.58,0,13.72,6.14,13.72,13.72Z"/>
<path class="cls-1" d="M543.97,561.49h-47c-1.38,0-2.5-1.12-2.5-2.5v-47c0-1.38,1.12-2.5,2.5-2.5h47c1.38,0,2.5,1.12,2.5,2.5v47c0,1.38-1.12,2.5-2.5,2.5Zm-44.5-5h42v-42h-42v42Z"/>
</g>
<path class="cls-5" d="M321.32,651.86c-1.29,0-2.49-.84-2.87-2.15-.47-1.59,.43-3.26,2.02-3.73,5.84-1.74,19.11-6.17,28.84-13.04-4.92-2.37-9.46-5.69-13.27-9.85-4.3-4.68-6.02-9.26-5.11-13.6,.8-3.85,3.74-7.22,8.28-9.49,5.64-2.82,12.54-2.87,18.03-.14,4.95,2.47,8.23,6.83,9.23,12.28,1.31,7.09-1.12,13.19-5.52,18.37,3.92,.74,7.93,.81,11.84,.14,9.87-1.69,17.56-7.88,21.65-17.45,.65-1.52,2.41-2.23,3.94-1.58,1.52,.65,2.23,2.41,1.58,3.94-4.92,11.5-14.21,18.96-26.15,21-5.95,1.02-12.09,.59-17.92-1.12-10.23,8.43-25.17,13.73-33.7,16.27-.29,.09-.57,.12-.86,.12Zm27.11-48.01c-2.24,0-4.51,.51-6.55,1.53-1.33,.67-4.5,2.52-5.09,5.35-.61,2.92,1.65,6.13,3.66,8.32,3.96,4.31,8.81,7.59,14.04,9.63,4.48-4.4,7.15-9.55,6.07-15.42-.84-4.55-3.73-6.86-6.01-8-1.87-.93-3.98-1.4-6.12-1.4Z"/>
<path class="cls-5" d="M1347.88,767.55c-12.6,0-24.83-5.58-29.19-17.66-.86-2.38-1.41-4.93-1.65-7.6-5.25-1.95-10.5-5.73-14.88-10.83-4.77-5.56-7.82-12.16-8.36-18.12-.13-1.37,.89-2.59,2.26-2.71,1.37-.12,2.59,.89,2.71,2.26,.45,4.88,3.13,10.61,7.18,15.33,2.73,3.18,6.66,6.57,11,8.63,.11-1.86,.35-3.76,.73-5.68,1.11-5.6,3.25-9.38,6.55-11.57,3.73-2.47,8.93-2.45,12.65,.05,3.71,2.5,5.69,7.31,4.8,11.7-.54,2.69-2.09,5.27-4.47,7.46-3.89,3.58-8.45,5.24-13.54,4.95-.48-.03-.96-.07-1.44-.14,.25,1.6,.64,3.14,1.16,4.58,5.34,14.82,24.21,16.3,35.9,12.62,.4-.12,.79-.26,1.18-.4,3.33-1.19,6.28-2.81,8.77-4.8,1.08-.86,2.65-.69,3.51,.39,.86,1.08,.69,2.65-.39,3.51-2.92,2.34-6.36,4.23-10.21,5.6-.45,.16-.91,.32-1.37,.46-4.14,1.3-8.55,1.97-12.92,1.97Zm-25.99-29.06c.69,.13,1.38,.22,2.07,.26,3.69,.22,7.01-1.01,9.87-3.63,1.12-1.03,2.53-2.69,2.96-4.78,.49-2.42-.64-5.18-2.69-6.56-2.05-1.38-5.04-1.39-7.1-.03-2.13,1.41-3.57,4.15-4.4,8.37-.43,2.17-.66,4.31-.7,6.37Z"/>
<g>
<path class="cls-3" d="M883.89,641.82c6.76,15.99,25.21,23.48,41.2,16.72,15.99-6.76,23.48-25.21,16.72-41.2-6.76-15.99-54.74-39.7-54.74-39.7-13.4,11.04-9.94,48.18-3.18,64.18Z"/>
<path class="cls-1" d="M691.45,707.3c-11.85,0-23.24-6.61-28.78-17.97-7.75-15.88-1.16-35.04,14.72-42.79l122.02-59.54c15.89-7.75,35.04-1.16,42.79,14.73s1.16,35.04-14.72,42.8l-122.02,59.54c-4.52,2.2-9.3,3.25-14.01,3.25Z"/>
<path class="cls-1" d="M827.48,644.51l-6.48,3.16-55.29,26.98-60.25,29.4c-4.52,2.21-9.29,3.25-14,3.25-11.85,0-23.24-6.61-28.78-17.98-7.76-15.88-1.17-35.04,14.72-42.79l122.02-59.55c15.89-7.75,35.04-1.16,42.8,14.73,7.75,15.89,1.16,35.04-14.73,42.8Z"/>
<path class="cls-5" d="M821,647.68l-49.11,23.96c-14.33-40.6,20.66-68.3,20.66-68.3l28.45,44.34Z"/>
<path class="cls-5" d="M688.36,1250.95c-2.59,0-5.08-.16-7.47-.49-9.6-1.32-17.29-10.25-17.51-20.31-.13-6.26,3.3-12.46,8.75-15.77,5.02-3.06,10.81-3.22,15.89-.46,9.54,5.2,17.16,14.26,22.73,21.57,1.12,1.47,.83,3.57-.63,4.68-1.47,1.12-3.57,.83-4.68-.63-5.17-6.78-12.18-15.16-20.61-19.75-4.01-2.18-7.49-.75-9.22,.3-3.45,2.1-5.62,5.99-5.54,9.92,.14,6.75,5.41,12.96,11.74,13.83,6.26,.86,13.44,.43,21.32-1.29,1.8-.39,3.58,.75,3.98,2.55,.39,1.8-.75,3.58-2.55,3.98-5.72,1.25-11.13,1.87-16.19,1.87Z"/>
<polygon class="cls-1" points="926.19 1209.5 978.72 1209.51 954.2 910.94 849.42 873.88 926.19 1209.5"/>
<path class="cls-3" d="M933.49,777.1h-165.38l27.82-104.51-6.54-21.96c-5.87-19.71-3.3-41.13,7.71-58.5,.38-.6,.76-1.19,1.16-1.77,12.37-18.42,31.41-30.08,52.55-30.08,17.28,0,33.15,7.79,45.12,20.68,2.45,2.65,4.76,5.51,6.86,8.57,8.17,11.83,13.56,26.53,14.91,42.77l15.8,144.81Z"/>
<path class="cls-5" d="M740.09,802.61c2.17-28.28,10.35-55.1,35.64-77.8,40.25,18.43,77.67,9.96,156.54-3.42l12.7,92.01-204.88-10.79Z"/>
<path class="cls-1" d="M845.35,736.93c-24.25,0-45.54-2.29-63.7-6.88-3.58-.91-5.75-4.54-4.85-8.12s4.54-5.75,8.12-4.85c37.06,9.37,88.38,8.6,152.53-2.28,3.64-.62,7.09,1.83,7.71,5.47,.62,3.64-1.83,7.09-5.47,7.71-35.16,5.96-66.68,8.95-94.34,8.95Z"/>
<path class="cls-5" d="M784.51,1186.58h-80.44s42.33-332.49,42.33-332.49c-2.98-13.98-12.38-48.26-10.73-57.83l131.11-40.86-82.27,431.18Z"/>
<polygon class="cls-5" points="903.15 1193.21 992.88 1193.22 942.86 797.5 812.27 755.4 820.39 815.05 818.16 798.65 903.15 1193.21"/>
<path class="cls-1" d="M775.66,803.29c-8.48,1.58-17.66-1.8-24.03-9.8l-85.59-90.28c-12.64-14.18-11.39-35.92,2.79-48.55,14.18-12.64,35.92-11.39,48.55,2.79l71.62,98.47c9.68,12.18,9.15,30.46-1.17,40.83-3.53,3.55-7.76,5.72-12.18,6.54Z"/>
<path class="cls-1" d="M738.13,843.15c-3.03,0-6.07-1.14-8.41-3.42-4.78-4.65-4.88-12.29-.23-17.06l40.53-41.64c4.65-4.77,12.29-4.88,17.06-.23,4.78,4.65,4.88,12.29,.23,17.06l-40.53,41.64c-2.37,2.43-5.5,3.65-8.65,3.65Z"/>
<path class="cls-1" d="M735.01,819.32c-2.05,0-4.12-.52-6.02-1.62-5.77-3.33-7.75-10.71-4.41-16.48l20.58-35.62c3.33-5.77,10.71-7.75,16.48-4.41,5.77,3.33,7.75,10.71,4.41,16.48l-20.58,35.62c-2.24,3.87-6.29,6.03-10.46,6.03Z"/>
<path class="cls-5" d="M1006.75,1250.95c-5.05,0-10.47-.63-16.19-1.87-1.8-.39-2.95-2.17-2.55-3.98,.39-1.8,2.18-2.94,3.98-2.55,7.88,1.72,15.05,2.15,21.32,1.29,6.33-.87,11.6-7.08,11.74-13.83,.09-3.92-2.09-7.82-5.54-9.92-1.72-1.05-5.21-2.48-9.22-.3-8.43,4.59-15.45,12.97-20.61,19.75-1.12,1.47-3.21,1.75-4.68,.63-1.47-1.12-1.75-3.22-.63-4.68,5.57-7.31,13.19-16.37,22.73-21.57,5.08-2.77,10.87-2.6,15.89,.46,5.45,3.32,8.88,9.51,8.75,15.77-.22,10.06-7.91,18.99-17.51,20.31-2.39,.33-4.88,.49-7.47,.49Z"/>
<path class="cls-3" d="M1051.56,1285.37l-.17,9.65h-93.3l-9.01-18.22-2.33-4.72c-1.81-3.65-7.11-3.35-8.49,.48l-8.08,22.45h-22.69l1.76-18.22,8.04-83.59,66.74,.2,20.54,44.22,40.52,33.67c1.85,1.54,3.35,3.41,4.43,5.49,1.37,2.62,2.07,5.55,2.03,8.57Z"/>
<path class="cls-3" d="M641.36,1285.37l.17,9.65h93.3l9.01-18.22,2.33-4.72c1.8-3.65,7.11-3.35,8.49,.48l8.08,22.45h22.69l-1.76-18.22-8.04-83.59-66.74,.2-20.54,44.22-40.52,33.67c-1.85,1.54-3.35,3.41-4.43,5.49-1.37,2.62-2.07,5.55-2.03,8.57Z"/>
<path class="cls-1" d="M779.29,1204.83h-73.56c-6.37,0-11.53-5.16-11.53-11.53s5.16-11.53,11.53-11.53h73.56c6.37,0,11.53,5.16,11.53,11.53s-5.16,11.53-11.53,11.53Z"/>
<path class="cls-1" d="M989.9,1204.74h-79.13c-6.37,0-11.53-5.17-11.53-11.53,0-6.37,5.16-11.53,11.53-11.53h79.13c6.37,0,11.53,5.17,11.53,11.53,0,6.37-5.16,11.53-11.53,11.53Z"/>
<path class="cls-1" d="M856.97,823.7c-.75,0-1.49-.03-2.25-.09-15.75-1.29-28.36-15.99-28.11-32.77l.41-27.3c.01-.93,.41-1.8,1.1-2.42,.68-.62,1.59-.94,2.52-.86l11,.9c1.84,.15,3.21,1.76,3.06,3.6-.15,1.84-1.78,3.21-3.6,3.06l-7.44-.61-.36,23.73c-.2,13.33,9.66,25,21.97,26.01,5.55,.45,10.86-1.35,14.97-5.08,4.59-4.17,7.17-10.15,7.27-16.86l.08-4.97c.03-1.83,1.52-3.29,3.34-3.29h.05c1.85,.03,3.32,1.55,3.29,3.39l-.08,4.97c-.13,8.45-3.58,16.36-9.46,21.7-4.94,4.48-11.17,6.88-17.76,6.88Z"/>
<path class="cls-1" d="M871.05,498.68l-.06,13.48-.09,21.14-.03,7.25-.02,3.05v.05s-.03,6.66-.03,6.66l-.07,14.55c-.06,12.38-10.12,22.36-22.49,22.3-12.37-.06-22.34-10.14-22.29-22.49l.08-18.58,.07-15.04,.11-24.63,.04-7.95c0-1.96,.27-3.87,.75-5.67,1.73-6.54,6.36-11.9,12.41-14.65,2.01-.91,4.18-1.52,6.44-1.8,.95-.12,1.92-.18,2.89-.17,12.36,.06,22.34,10.12,22.28,22.5Z"/>
<path class="cls-5" d="M871.05,498.68l-.06,13.48-.09,21.14-.03,7.25-.02,3.05v.05s-.03,6.66-.03,6.66c-16.01-1.67-30.61-11.87-37.14-27.81l-2.02-4.95c-1.08-2.63-1.83-5.32-2.27-8-1.88-11.55,1.98-23.24,10.05-31.41,2.01-.91,4.18-1.52,6.44-1.8,.95-.12,1.92-.18,2.89-.17,12.36,.06,22.34,10.12,22.28,22.5Z"/>
<path class="cls-1" d="M883.99,536.74h0c14.12-5.79,20.87-21.93,15.08-36.04l-8.69-21.2c-7.63-18.6-28.89-27.5-47.5-19.87h0c-18.6,7.63-27.5,28.89-19.87,47.5l2.03,4.95c9.47,23.09,35.86,34.13,58.95,24.67Z"/>
<path class="cls-1" d="M888.95,479.99c5.32,8.82,10.72,17.01,16.66,21.31,1.6,1.16,2.25,3.34,1.24,5.04-.63,1.06-1.77,1.84-3.21,1.87l-15.86,.4,1.18-28.62Z"/>
<path class="cls-5" d="M849.06,511.26s-11.9-24.16,4.48-24.98c38.83-1.94,41.4-19.38,41.41-19.39,.17-.12-4.67-5.8-4.95-6.11-4.12-4.49-8.85-8.48-14.13-11.54-19.66-11.41-45.64-4.54-60.39,11.76-16.36,18.08-12.79,35.84-5.4,47.98,6.2,10.18,19.52,13.38,29.87,7.48l9.11-5.19Z"/>
<path class="cls-5" d="M816.82,446.44c1.27-4.31,3.12-8.46,3.88-12.89,1.35-7.9-1.09-16.36-6.43-22.33-5.34-5.97-13.48-9.32-21.48-8.85-11.89,.7-21.75,9.03-30.65,16.94-7.05-9.06-16.71-16.32-27.8-19.32-16.6-4.49-43.89,2.75-41.88,24.4,.68,7.36,4.9,14.06,10.39,19,1.71,1.54,3.63,3.05,4.4,5.22,1.06,2.97-.4,6.32-2.58,8.59-2.18,2.28-5,3.81-7.49,5.74-7.04,5.46-11.3,14.34-11.14,23.25,.16,8.91,4.74,17.63,11.97,22.83,3.82,2.74,8.39,4.57,11.27,8.4,8.62,11.45,5,27.92,15.38,38.96,7.04,7.49,18.42,9.85,28.48,7.73,10.06-2.13,18.91-8.18,26.27-15.36,7.98-7.78,14.78-17.73,15.15-28.86,.32-9.63-4.59-19.27-12.57-24.66-4.34-2.94-10.11-5.56-10.62-10.78-.45-4.56,3.94-8.46,8.47-9.11,4.53-.65,9.04,1.08,13.24,2.92,11.97,5.25,23.53,11.73,36.23,14.83-1.02,.35-2.04,.71-3.07,1.06,1.04,3.47,6.34,3.97,8.94,1.46,2.6-2.52,2.92-6.62,2.22-10.18-.93-4.7-3.36-9.09-6.86-12.37-4.52-4.23-10.87-6.84-13.6-12.39-2.06-4.19-1.56-9.2-.29-13.7,.05-.18,.1-.35,.15-.53Z"/>
<path class="cls-1" d="M824.97,504.56c1.52,9.36,10.35,15.72,19.71,14.19,9.36-1.52,15.72-10.35,14.19-19.71-1.52-9.36-10.35-15.72-19.71-14.19s-15.72,10.35-14.19,19.71Z"/>
<path class="cls-3" d="M801.91,486.76c-.61,0-1.24-.17-1.79-.52-1.56-.99-2.02-3.06-1.03-4.61l15.62-24.55c.99-1.56,3.06-2.02,4.61-1.03,1.56,.99,2.02,3.06,1.03,4.61l-15.62,24.55c-.64,1-1.72,1.55-2.82,1.55Z"/>
<g>
<path class="cls-5" d="M839.25,515.2l.05,4.56-.05-4.56Z"/>
<path class="cls-2" d="M839.3,522.15c-1.3,0-2.37-1.05-2.38-2.36l-.05-4.56c-.02-1.32,1.04-2.4,2.36-2.41,1.28-.04,2.4,1.04,2.41,2.36l.05,4.56c.02,1.32-1.04,2.4-2.36,2.41,0,0-.02,0-.03,0Z"/>
</g>
<path class="cls-2" d="M847.35,948.5c-1.6,0-3.01-1.15-3.29-2.78l-18.35-106.67-17.76-15.94c-1.37-1.23-1.49-3.35-.25-4.72,1.23-1.37,3.34-1.49,4.72-.25l18.63,16.72c.56,.5,.93,1.18,1.06,1.92l18.55,107.82c.31,1.82-.91,3.55-2.73,3.86-.19,.03-.38,.05-.57,.05Z"/>
<path class="cls-5" d="M802.67,746.34c-1.41,0-2.72-.9-3.18-2.31-3.28-10.06-1.58-18.89,5.08-26.27,1.24-1.37,3.35-1.48,4.72-.24,1.37,1.24,1.48,3.35,.24,4.72-5.07,5.62-6.24,11.88-3.68,19.71,.57,1.75-.38,3.64-2.14,4.21-.34,.11-.69,.17-1.04,.17Z"/>
<path class="cls-5" d="M882.95,747.19c-.63,0-1.27-.18-1.83-.55-1.54-1.01-1.97-3.09-.95-4.63,4.16-6.32,4.37-12.69,.66-20.05-.83-1.65-.17-3.66,1.48-4.49,1.65-.83,3.66-.17,4.49,1.48,4.76,9.44,4.41,18.44-1.04,26.73-.64,.98-1.71,1.51-2.8,1.51Z"/>
<rect class="cls-3" x="818.24" y="554.52" width="59.56" height="32.65"/>
<path class="cls-5" d="M1075.91,692.93c-1.11,0-2.2-.56-2.83-1.57-.98-1.56-.51-3.63,1.06-4.61,3.76-2.36,5.97-6.83,6.24-12.61,.29-6.23-1.71-13.09-5.62-19.33-3.91-6.23-9.22-11.02-14.95-13.48-5.31-2.28-10.31-2.23-14.07,.12-1.56,.98-3.63,.51-4.61-1.06-.98-1.56-.51-3.63,1.06-4.61,5.67-3.56,12.86-3.77,20.25-.61,6.97,2.99,13.36,8.69,17.98,16.07,4.62,7.38,6.98,15.61,6.63,23.18-.37,8.03-3.7,14.41-9.37,17.97-.55,.35-1.17,.51-1.77,.51Z"/>
<path class="cls-1" d="M944.99,758.31c-11.78,0-23.12-6.53-28.7-17.81l-60-121.16c-7.84-15.84-1.36-35.04,14.48-42.88,15.84-7.84,35.04-1.36,42.88,14.48l60,121.16c7.84,15.84,1.36,35.04-14.48,42.88-4.56,2.26-9.41,3.33-14.18,3.33Z"/>
<path class="cls-1" d="M1108.36,652.5c0,8.63-4.99,17.04-14.02,21.83l-126.85,84.47c-16.25,9.83-37.39,4.63-47.23-11.61-9.84-16.25-4.64-37.39,11.61-47.23l132.35-69.24c13.74-7.29,31.62-3.44,39.93,8.61,2.85,4.12,4.2,8.68,4.2,13.17Z"/>
<g>
<path class="cls-1" d="M1062.78,659.52c-3.24,0-6.48-1.3-8.86-3.87-4.53-4.89-4.24-12.52,.65-17.05l48.81-45.21c4.89-4.53,12.52-4.24,17.05,.65,4.53,4.89,4.24,12.52-.65,17.05l-48.81,45.21c-2.32,2.15-5.26,3.21-8.2,3.21Z"/>
<path class="cls-1" d="M1075.79,661.15c-3.87,0-7.67-1.86-10-5.31-3.73-5.52-2.29-13.02,3.23-16.76l32.59-22.05c5.52-3.73,13.02-2.29,16.76,3.23,3.73,5.52,2.29,13.02-3.23,16.76l-32.59,22.05c-2.07,1.4-4.42,2.07-6.75,2.07Z"/>
<path class="cls-1" d="M1092.1,673.79c-3.64,0-7.23-1.64-9.61-4.76-4.04-5.3-3.01-12.87,2.29-16.91l22.54-17.17c5.3-4.04,12.87-3.01,16.91,2.29,4.04,5.3,3.01,12.87-2.29,16.91l-22.54,17.17c-2.18,1.66-4.75,2.47-7.3,2.47Z"/>
</g>
<path class="cls-1" d="M1057.96,656.59c-.37,0-.74-.02-1.11-.05-6.64-.61-11.52-6.48-10.92-13.12l1.99-21.77c.61-6.64,6.48-11.52,13.12-10.92,6.64,.61,11.52,6.48,10.92,13.11l-1.99,21.77c-.57,6.26-5.83,10.97-12,10.97Z"/>
<path class="cls-5" d="M1067.57,695.25c-3.25,0-6.67-.74-10.14-2.23-6.97-2.99-13.36-8.69-17.98-16.07-9.79-15.61-8.56-34.07,2.74-41.15,1.56-.98,3.63-.51,4.61,1.06,.98,1.56,.51,3.63-1.06,4.61-8.17,5.12-8.45,19.45-.62,31.94,3.91,6.23,9.22,11.02,14.95,13.48,5.31,2.28,10.31,2.23,14.07-.12,1.56-.98,3.63-.51,4.61,1.06,.98,1.56,.51,3.63-1.06,4.61-3.01,1.89-6.45,2.83-10.11,2.83Z"/>
<path class="cls-2" d="M1046.26,667.77c-1.73,5.38-7.5,8.34-12.88,6.61-5.38-1.73-8.34-7.5-6.61-12.88,1.73-5.38,7.5-8.34,12.88-6.61,5.38,1.73,8.34,7.5,6.61,12.88Z"/>
<path class="cls-2" d="M1055.69,681.55c-1.73,5.38-7.5,8.34-12.88,6.61-5.38-1.73-8.34-7.5-6.61-12.88,1.73-5.38,7.5-8.34,12.88-6.61,5.38,1.73,8.34,7.5,6.61,12.88Z"/>
<path class="cls-5" d="M943.85,695.24c-1.19,0-2.34-.64-2.95-1.76-.88-1.62-.27-3.65,1.36-4.53l15.71-8.46c1.62-.88,3.65-.27,4.53,1.36,.88,1.62,.27,3.65-1.36,4.53l-15.71,8.46c-.5,.27-1.05,.4-1.58,.4Z"/>
<polygon class="cls-1" points="827.72 648.26 801.91 622.11 825.91 596.03 843.95 622.88 827.72 648.26"/>
<g>
<polygon class="cls-1" points="827.72 648.26 801.91 622.11 825.91 596.03 843.95 622.88 827.72 648.26"/>
<path class="cls-2" d="M827.72,650.65c-.63,0-1.25-.25-1.7-.71l-25.81-26.15c-.89-.91-.92-2.36-.06-3.29l24.01-26.09c.5-.54,1.21-.82,1.94-.76,.73,.06,1.39,.44,1.8,1.05l18.04,26.85c.53,.79,.54,1.82,.03,2.62l-16.23,25.39c-.39,.61-1.04,1.01-1.76,1.09-.08,0-.17,.01-.25,.01Zm-22.51-28.6l22.11,22.41,13.78-21.55-15.48-23.04-20.42,22.19Z"/>
</g>
<g>
<path class="cls-5" d="M839.52,529.87l.21,17.7-.21-17.7Z"/>
<path class="cls-2" d="M839.73,549.96c-1.3,0-2.37-1.05-2.38-2.36l-.21-17.7c-.02-1.32,1.04-2.4,2.36-2.41,0,0,.02,0,.03,0,1.3,0,2.37,1.05,2.38,2.36l.21,17.7c.02,1.32-1.04,2.4-2.36,2.41,0,0-.02,0-.03,0Z"/>
</g>
</g>
<g>
<path class="cls-1" d="M342.18,1186.7c16.67,16.9,37.23,23.65,45.91,15.08,8.68-8.57,2.21-29.21-14.46-46.11-11.53-11.69-29.08-14.43-38.8-15-4-.24-7.3,3.02-7.12,7.02,.44,9.73,2.94,27.31,14.48,39Z"/>
<path class="cls-5" d="M409.48,1239.21c-1.13,0-2.08-.88-2.16-2.02-.03-.44-3.02-45.07-.44-104.82,2.38-55.18,10.13-134.93,33.53-201.53,.4-1.13,1.63-1.73,2.76-1.33,1.13,.4,1.72,1.63,1.33,2.76-44.46,126.55-32.98,302.85-32.86,304.61,.08,1.19-.82,2.23-2.01,2.31-.05,0-.1,0-.15,0Z"/>
<path class="cls-5" d="M392.69,1239.21h-.03c-1.2-.01-2.16-1-2.14-2.19,1-82.01-21.92-131.3-39.24-161.24-.6-1.04-.25-2.36,.79-2.96,1.04-.6,2.36-.25,2.96,.79,17.58,30.38,40.83,80.38,39.82,163.46-.01,1.19-.98,2.14-2.17,2.14Z"/>
<path class="cls-6" d="M441.99,982.95c-3.26,13.98-11.74,23.96-18.92,22.28-7.19-1.68-10.36-14.37-7.1-28.36,2.26-9.67,10.45-16.63,15.28-19.99,1.99-1.38,4.72-.75,5.89,1.38,2.84,5.16,7.11,15.02,4.85,24.69Z"/>
<path class="cls-1" d="M492.92,942.98c3.5-6.5,.48-13.19-6.71-14.86h0c-7.19-1.68-15.93,2.27-19.43,8.76l-23.83,44.26c-3.11,5.78-9.71,8.76-16.11,7.27h0c-6.39-1.49-10.99-7.09-11.23-13.65l-1.77-50.24c-.26-7.37-6.35-14.78-13.54-16.46h0c-7.15,.25-12.74,6.25-12.49,13.4,0,0,2.24,66.34,2.38,67.67l.08,.62c1.46,10.83,9.42,20.15,20.69,22.78l19.37,4.52c11.28,2.63,22.55-2.2,28.65-11.27l.08,.05,33.83-62.84Z"/>
<g>
<path class="cls-3" d="M332.65,1032.7h0l15.4-30c3.61-7.04-.77-15.54-8.6-16.69h0c-7.83-1.14-14.46,5.76-13,13.54l6.2,33.15Z"/>
<path class="cls-3" d="M319.42,1042.57h0l-33.15,6.2c-7.78,1.46-14.68-5.17-13.54-13h0c1.14-7.83,9.65-12.22,16.69-8.6l30,15.4Z"/>
<path class="cls-3" d="M328.87,1055.24h0l-15.4,30c-3.61,7.04,.77,15.55,8.6,16.69h0c7.83,1.14,14.46-5.76,13-13.54l-6.2-33.15Z"/>
<path class="cls-3" d="M342.1,1045.37h0l33.15-6.2c7.78-1.46,14.68,5.17,13.54,13h0c-1.14,7.83-9.65,12.22-16.69,8.6l-30-15.4Z"/>
<path class="cls-3" d="M324.13,1034.67h0l-10.33-32.1c-2.42-7.53-11.54-10.45-17.88-5.72h0c-6.34,4.73-6.15,14.3,.38,18.77l27.83,19.05Z"/>
<path class="cls-3" d="M321.75,1051h0l-19.05,27.83c-4.47,6.53-14.04,6.72-18.77,.38h0c-4.73-6.34-1.82-15.46,5.72-17.88l32.1-10.33Z"/>
<path class="cls-3" d="M337.39,1053.28h0l10.33,32.1c2.42,7.53,11.54,10.45,17.88,5.72h0c6.34-4.73,6.15-14.3-.38-18.77l-27.83-19.05Z"/>
<path class="cls-3" d="M339.77,1036.94h0l19.05-27.83c4.47-6.53,14.04-6.72,18.77-.38h0c4.73,6.34,1.82,15.46-5.72,17.88l-32.1,10.33Z"/>
</g>
</g>
<g>
<path class="cls-3" d="M1592.84,1101.57c24.22,13.58,38.2,34.68,31.23,47.12-6.98,12.45-32.27,11.53-56.49-2.05-16.76-9.39-25.27-28.34-28.93-39.13-1.5-4.44,1.15-9.17,5.72-10.2,11.11-2.51,31.72-5.13,48.48,4.26Z"/>
<path class="cls-3" d="M1690.74,1109.13c-13.68,13.86-30.54,19.4-37.66,12.37-7.12-7.03-1.81-23.96,11.87-37.83,9.46-9.59,23.86-11.83,31.83-12.31,3.28-.19,5.99,2.48,5.84,5.76-.36,7.98-2.41,22.41-11.88,32Z"/>
<path class="cls-5" d="M1633.86,1238.69c-1.2,0-2.17-.97-2.17-2.17,0-54.34-8.46-111.44-25.15-169.7-.33-1.15,.34-2.35,1.49-2.68,1.16-.33,2.35,.34,2.68,1.49,16.8,58.65,25.32,116.15,25.32,170.9,0,1.2-.97,2.17-2.17,2.17Z"/>
<path class="cls-5" d="M1602.33,1047.59c-.92,0-1.77-.59-2.07-1.51-20.39-63.88-43.53-105.68-43.76-106.09-.58-1.05-.21-2.37,.84-2.95,1.04-.58,2.37-.21,2.95,.84,.23,.42,23.59,42.6,44.1,106.89,.37,1.14-.27,2.36-1.41,2.73-.22,.07-.44,.1-.66,.1Z"/>
<circle class="cls-1" cx="1569.32" cy="969.96" r="46.99" transform="translate(503.71 2475.98) rotate(-86.44)"/>
<path class="cls-5" d="M1643.87,1238.69c-1.18,0-2.14-.94-2.17-2.13-.03-1.46-2.47-146.84,34.26-251.36,.4-1.13,1.64-1.73,2.77-1.33,1.13,.4,1.73,1.64,1.33,2.77-36.46,103.78-34.04,248.39-34.01,249.84,.02,1.2-.93,2.19-2.13,2.21-.01,0-.03,0-.04,0Z"/>
<polygon class="cls-6" points="1718.17 995.89 1684.95 962.67 1639.56 974.83 1627.4 1020.21 1660.62 1053.44 1706.01 1041.28 1718.17 995.89"/>
<path class="cls-2" d="M1569.32,975.41c-24.24,0-50-5.8-50-16.54,0-1.01,.82-1.83,1.83-1.83s1.83,.82,1.83,1.83c0,6.09,19.04,12.89,46.35,12.89s46.35-6.79,46.35-12.89c0-1.01,.82-1.83,1.83-1.83s1.83,.82,1.83,1.83c0,10.74-25.76,16.54-50,16.54Z"/>
<path class="cls-2" d="M1569.32,975.41c-24.24,0-50-5.8-50-16.54,0-1.01,.82-1.83,1.83-1.83s1.83,.82,1.83,1.83c0,6.09,19.04,12.89,46.35,12.89s46.35-6.79,46.35-12.89c0-1.01,.82-1.83,1.83-1.83s1.83,.82,1.83,1.83c0,10.74-25.76,16.54-50,16.54Z"/>
<path class="cls-2" d="M1608.25,987.94c-10.59,0-27.18-6.35-41.74-14.75-21-12.11-40.41-30-35.05-39.31,.5-.88,1.62-1.17,2.49-.67,.87,.5,1.17,1.62,.67,2.49-3.04,5.28,10.05,20.67,33.71,34.32,23.66,13.65,43.54,17.28,46.59,11.99,.5-.87,1.62-1.17,2.5-.67,.87,.5,1.17,1.62,.67,2.5-1.65,2.85-5.16,4.09-9.84,4.09Z"/>
<path class="cls-2" d="M1608.25,987.94c-10.59,0-27.18-6.35-41.74-14.75-21-12.11-40.41-30-35.05-39.31,.5-.88,1.62-1.17,2.49-.67,.87,.5,1.17,1.62,.67,2.49-3.04,5.28,10.05,20.67,33.71,34.32,23.66,13.65,43.54,17.28,46.59,11.99,.5-.87,1.62-1.17,2.5-.67,.87,.5,1.17,1.62,.67,2.5-1.65,2.85-5.16,4.09-9.84,4.09Z"/>
<path class="cls-2" d="M1627.4,1022.04c-.81,0-1.54-.54-1.76-1.35-.26-.97,.32-1.98,1.29-2.24l90.77-24.32c.97-.26,1.98,.32,2.24,1.29,.26,.97-.32,1.98-1.29,2.24l-90.77,24.32c-.16,.04-.32,.06-.47,.06Z"/>
<path class="cls-2" d="M1672.78,1009.88c-.47,0-.93-.18-1.29-.53l-33.23-33.23c-.71-.71-.71-1.87,0-2.58,.71-.71,1.87-.71,2.58,0l33.23,33.23c.71,.71,.71,1.87,0,2.58-.36,.36-.82,.53-1.29,.53Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 27 KiB

+94
View File
@@ -0,0 +1,94 @@
:root {
// color configurations for Nuxt UI
--color-primary-50: 255 248 236;
--color-primary-100: 255 240 211;
--color-primary-200: 255 220 165;
--color-primary-300: 255 194 109;
--color-primary-400: 255 157 50;
--color-primary-500: 255 127 10;
--color-primary-600: 255 102 0;
--color-primary-700: 204 73 2;
--color-primary-800: 161 57 11;
--color-primary-900: 130 49 12;
--color-primary-950: 70 22 4;
--color-primary-50: 255 248 236;
--color-gray-50: 246 246 246;
--color-gray-100: 231 231 231;
--color-gray-200: 209 209 209;
--color-gray-300: 176 176 176;
--color-gray-400: 136 136 136;
--color-gray-500: 107 107 107;
--color-gray-600: 93 93 93;
--color-gray-700: 79 79 79;
--color-gray-800: 69 69 69;
--color-gray-900: 61 61 61;
--color-gray-950: 38 38 38;
// custom colors
--color-border: 232, 231, 231;
--color-pale: 120, 120, 120;
--color-text-default: 21, 21, 21;
--color-background: 254, 254, 254;
--color-background-2: 220, 220, 220;
// custom Scrollbar
--color-scrollbar-trak: #E7E9EB;
--color-scrollbar-thumb: #C7C7C7;
--color-scrollbar-thumb-hover: #878787;
}
.dark {
--color-border: 40, 40, 40;
--color-text-default: 240, 240, 240;
--color-background: 21, 21, 21;
--color-background-2: 32, 32, 32;
// custom Scrollbar
--color-scrollbar-trak: #384968;
--color-scrollbar-thumb: #314152;
--color-scrollbar-thumb-hover: #3a5068;
}
body {
font-family: "Inter";
font-size: 15px;
}
.inner {
margin: auto;
width: 100%;
max-width: 1300px;
@media only screen and (max-width: 1340px) {
@apply px-3;
}
}
.both {
@apply grid grid-cols-2 gap-4;
@media only screen and (max-width: 769px) {
@apply grid-cols-1;
}
}
.payment-address-input input{
cursor: default !important;
}
/* Custom Scroll */
::-webkit-scrollbar {
width: 10px;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px var(--color-scrollbar-trak);
border-radius: 10px;
}
::-webkit-scrollbar-thumb {
background: var(--color-scrollbar-thumb);
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--color-scrollbar-thumb-hover);
}
+230
View File
@@ -0,0 +1,230 @@
<script lang="ts" setup>
const items = computed(() => [
{
label: "Why tip with XMRChat?",
defaultOpen: true,
slot: "one",
},
{
label: "Why does XMRChat use Monero?",
slot: "two",
},
{
label: "Where to get Monero?",
slot: "three",
},
]);
const linkProps = { padded: false, target: "_blank", variant: "link" } as any; // UButton does not export props I guess
</script>
<template>
<div class="mt-7">
<h3 class="w-full text-center text-4xl font-bold">FAQ</h3>
<div class="mt-10 flex justify-center">
<UAccordion
class="max-w-[1024px]"
:items="items"
variant="ghost"
color="gray"
>
<template #default="{ item, open }">
<UButton variant="solid" color="gray" class="mb-2" size="lg" icon="">
<span class="flex-1 text-start">
{{ item.label }}
</span>
<template #trailing>
<UIcon
name="i-heroicons-chevron-right-20-solid"
:class="[
'w-5 h-5 transform transition-transform duration-200',
open && 'rotate-90',
]"
></UIcon>
</template>
</UButton>
</template>
<template #one>
<ul class="list">
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Earn More </span>
</div>
<p>
YouTube charges 30-50% for Superchats. Rumble 20% for Rants.
With XMRChat, the streamer gets 100% of your tip, directly to a
wallet they control.
</p>
</li>
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Private </span>
</div>
<p>
Viewers can tip anonymously, no worries from employers or others
knowing your donations.
</p>
</li>
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Quick and easy</span>
</div>
<p>
No need for viewers to create an account, verify their email, or
enter credit card info. Just go to your streamer’s page, type
your message and enter your XMR tip.
</p>
</li>
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Censorship resistant</span>
</div>
<p>
Streamers that tell too much truth may one day face censorship
not only from big tech, but from banks freezing their accounts
as well. Better to be prepared with another payment method.
</p>
</li>
</ul>
</template>
<template #two>
<ul class="list">
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Low fees</span>
</div>
<p>Monero transaction fees are a few pennies at most.</p>
</li>
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Private</span>
</div>
<p>
While most crypto uses open ledgers, Monero hides transaction
data. Sender, receiver, and transaction amounts are not revealed
by looking at the blockchain.
</p>
</li>
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>Accepted</span>
</div>
<p>
Selling your crypto for fiat on a centralized exchange creates a
taxable event. Avoid that hassle and expense by buying goods and
services from merchants that accept Monero, listed at
<UButton to="https://monerica.com" v-bind="linkProps">
monerica.com</UButton
>.
</p>
</li>
<li>
<div class="item-header">
<UIcon name="i-heroicons-check-16-solid" class="icon" />
<span>And more</span>
</div>
<p>
Learn more about Monero at
<UButton to="https://getmonero.org" v-bind="linkProps">
getmonero.org</UButton
>.
</p>
</li>
</ul>
</template>
<template #three>
<ul class="list">
<li>
<p>
If you already have crypto, trade for Monero (XMR) at
<UButton to="https://trocador.app" v-bind="linkProps">
trocador.app</UButton
>.
</p>
</li>
<li>
<p>
Buy Monero without KYC at
<UButton to="https://haveno.exchange" v-bind="linkProps"
>haveno.exchange</UButton
>. Cash by mail tutorial at
<UButton
to="https://blog.nihilism.network/servers/haveno-cashbymail/index.html"
v-bind="linkProps"
>this blog post</UButton
>.
</p>
</li>
<li>
<p>
Buy Monero with KYC at
<UButton to="https://kraken.com" v-bind="linkProps"
>kraken.com</UButton
>.
</p>
</li>
<li>
<p>
Sell items or services for Monero at
<UButton to="https://xmrbazaar.com" v-bind="linkProps">
xmrbazaar.com
</UButton>
and
<UButton to="https://moneromarket.io" v-bind="linkProps">
moneromarket.io </UButton
>.
</p>
</li>
<li>
<p>
Mine it with
<UButton to="https://gupax.io" v-bind="linkProps">
gupax.io </UButton
>.
</p>
</li>
<li>
<p>
Buy Monero with fiat, without KYC as an Executor at
<UButton to="https://monezon.com" v-bind="linkProps">
monezon.com </UButton
>.
</p>
</li>
<li>
<p>
Accept Monero at your business and get listed at the
<UButton to="https://monerica.com" v-bind="linkProps">
monerica.com
</UButton>
directory.
</p>
</li>
</ul>
</template>
</UAccordion>
</div>
</div>
</template>
<style scoped lang="scss">
.list {
@apply flex flex-col gap-3;
.item-header {
@apply pb-1 pt-2 flex items-center gap-2 text-text font-medium;
.icon {
@apply text-primary align-middle w-4 h-4;
}
}
li {
}
}
</style>
+51
View File
@@ -0,0 +1,51 @@
<script lang="ts" setup>
const { toStreamerDisplay } = useRouteLocation();
</script>
<template>
<div class="home-hero">
<div class="image-side">
<img
class="w-full rounded-md overflow-hidden"
src="/images/home-hero-2.jpg"
alt=""
/>
</div>
<div class="content-side">
<h1 class="font-bold text-6xl">XMRChat</h1>
<p class="description">Tip your favorite streamer in cryptocurrency.</p>
<div>
<UButton size="xl" :to="toStreamerDisplay()">
My Streamer Tip Page
</UButton>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.home-hero {
@apply flex flex-row items-center mt-8;
.image-side {
@apply flex-1 flex py-3 p-10;
}
.content-side {
@apply flex-1 flex flex-col p-10;
.description {
@apply text-lg pt-4 pb-6;
}
}
@media only screen and (max-width: 840px) {
@apply flex-col items-stretch;
.image-side {
@apply flex-1 flex py-3 p-1;
}
.content-side {
@apply p-1;
}
}
}
</style>
+28
View File
@@ -0,0 +1,28 @@
<script lang="ts" setup>
const props = defineProps<{
title?: string;
description?: string;
}>();
</script>
<template>
<div class="auth-container">
<div class="box">
<h2 class="title">{{ title }}</h2>
<p class="pb-8 text-pale" v-if="description">{{ description }}</p>
<slot />
</div>
</div>
</template>
<style scoped lang="scss">
.auth-container {
@apply flex items-center justify-center w-full min-h-[600px];
}
.box {
@apply w-full max-w-[450px] border border-border p-6 rounded-md bg-background;
}
.title {
@apply text-3xl font-bold pb-4;
}
</style>
+35
View File
@@ -0,0 +1,35 @@
<script lang="ts" setup>
const { toIndex, toStreamerCreate } = useRouteLocation();
const props = withDefaults(
defineProps<{
error?: any;
defaultMessage?: string;
}>(),
{
defaultMessage: "Something went wrong!",
}
);
const renderMessage = computed(() => {
if (!props.error) return props.defaultMessage;
return getErrorMessage(props.error);
});
</script>
<template>
<div class="error">
<div class="message text-center py-10">
<p class="pb-4 text-xl">{{ renderMessage }}</p>
<div class="flex gap-3 justify-center">
<UButton :to="toIndex()">Back to Home</UButton>
</div>
</div>
<slot />
</div>
</template>
<style scoped lang="scss">
.error {
@apply flex flex-col justify-center items-center;
}
</style>
@@ -0,0 +1,33 @@
<script lang="ts" setup>
const props = withDefaults(
defineProps<{
id?: string;
variant?: "logo" | "banner";
}>(),
{
variant: "banner",
}
);
const config = useRuntimeConfig();
</script>
<template>
<img
v-if="id"
:src="`${config.public.apiBaseUrl}/v1/images/${id}`"
:class="['general-image', `general-image-${variant}`]"
/>
</template>
<style scoped lang="scss">
.general-image {
@apply rounded-lg border-2 border-border object-cover;
&-logo {
@apply rounded-full;
}
&-banner {
aspect-ratio: 3 / 1;
}
}
</style>
@@ -0,0 +1,84 @@
<script lang="ts" setup>
import type { AxiosProgressEvent } from "axios";
const { uploadImage: uploadApi } = useServices();
defineOptions({
inheritAttrs: false,
});
const staged = ref<string>();
const emit = defineEmits<{
upload: [string];
}>();
const isUploading = ref<boolean>(false);
const progress = ref<number>(0);
const controller = ref<AbortController | undefined>();
const handleChange = async (e: Event) => {
const files = (e.target as HTMLInputElement).files;
if (!files || !files.length) {
return;
}
const formData = new FormData();
const file = files[0];
formData.append("file", file);
staged.value = URL.createObjectURL(file);
formData.append("logo", file);
isUploading.value = true;
try {
controller.value = new AbortController();
const res = await uploadApi(formData, {
signal: controller.value?.signal,
onUploadProgress: (e: AxiosProgressEvent) => {
const percentCompleted = Math.floor((e.loaded * 100) / (e.total || 0));
progress.value = percentCompleted;
},
});
console.log(res);
emit("upload", res.id);
} catch (e) {
console.log(e);
} finally {
isUploading.value = false;
progress.value = 0;
}
};
</script>
<template>
<div class="image-uploader">
<div class="flex gap-2 flex-col">
<label class="relative">
<UButton class="button" size="lg" variant="outline" tabindex="-1" block>
<input
type="file"
@change="handleChange"
accept="image/*"
v-bind="$attrs"
/>
<span>Click to upload</span>
</UButton>
</label>
<UProgress v-if="isUploading" :value="progress" />
<!-- <Progress v-if="isUploading" :percent="progress" /> -->
</div>
</div>
</template>
<style scoped lang="scss">
input {
@apply absolute cursor-pointer top-0 left-0 opacity-0 w-full h-full;
}
.image-uploader {
@apply flex flex-col gap-2;
}
</style>
+21
View File
@@ -0,0 +1,21 @@
<script lang="ts" setup>
const props = withDefaults(
defineProps<{
icon?: string;
text?: string;
}>(),
{
icon: "i-heroicons-moon",
text: "No Items",
}
);
</script>
<template>
<div class="flex text-pale flex-col items-center gap-4 px-2 py-8">
<UIcon :name="icon" class="text-3xl"></UIcon>
<span>{{ text }}</span>
</div>
</template>
<style scoped></style>
+18
View File
@@ -0,0 +1,18 @@
<script lang="ts" setup>
const props = defineProps<{
error?: any;
pending?: boolean | null;
}>();
</script>
<template>
<UProgress v-if="pending" animation="carousel" class="max-w-[280px] m-auto" />
<ErrorView
:error="error"
v-if="error"
defaultMessage="Something went wrong!"
/>
<slot v-else />
</template>
<style scoped lang="scss"></style>
+31
View File
@@ -0,0 +1,31 @@
<script setup lang="ts">
const { socials } = useAppConfig();
</script>
<template>
<footer class="my-10">
<div class="inner flex justify-center flex-col items-center">
<span class="text-sm text-pale">2024 @ XMRChat</span>
<div class="social flex gap-2 mt-3">
<UButton
variant="ghost"
color="white"
square
:to="`mailto:${socials.email}`"
target="_blank"
>
<UIcon name="i-mdi-email text-xl"></UIcon>
</UButton>
<UButton
variant="ghost"
color="white"
square
:to="`https://twitter.com/${socials.twitter}`"
target="_blank"
>
<UIcon name="i-mdi-twitter text-xl"></UIcon>
</UButton>
</div>
</div>
</footer>
</template>
+77
View File
@@ -0,0 +1,77 @@
<script setup lang="ts">
const { toIndex, toContact, toLogin, toStreamerDisplay } = useRouteLocation();
const authStore = useAuthStore();
const { logout } = authStore;
const route = useRoute();
const dropdownItems = computed(() => {
return [
[
{
label: authStore.userEmail || "",
slot: "account",
disabled: true,
},
],
[
{
label: "My Page",
icon: "i-heroicons-user-circle",
to: toStreamerDisplay(),
},
{
label: "Logout",
icon: "i-heroicons-arrow-left-end-on-rectangle-solid",
click: () => {
logout();
},
},
],
];
});
</script>
<template>
<nav class="navbar py-2 border-b border-border">
<div class="inner flex justify-between items-center">
<div class="flex items-center space-x-4">
<NuxtLink class="w-[40px]" :to="toIndex()">
<img src="/images/xmrchat-logo.png" />
</NuxtLink>
<ul>
<li class="flex space-x-1">
<UButton variant="ghost" color="white" :to="toContact()">
Contact Us
</UButton>
</li>
</ul>
</div>
<div class="flex space-x-3 items-center">
<template v-if="!route.meta.hideHeaderLogin">
<UDropdown
v-if="authStore.isLoggedIn"
:items="dropdownItems"
:ui="{ item: { disabled: 'cursor-text select-text' } }"
>
<template #account="{ item }">
<div>
{{ item.label }}
</div>
</template>
<UButton
color="primary"
label="Account"
trailing-icon="i-heroicons-chevron-down-20-solid"
/>
</UDropdown>
<UButton v-else :to="toLogin()">Streamer Login</UButton>
</template>
<ColorMode />
</div>
</div>
</nav>
</template>
<style scoped lang="scss"></style>
+37
View File
@@ -0,0 +1,37 @@
<script setup lang="ts">
const colorMode = useColorMode();
const modes: string[] = ["light", "dark", "system"];
const modesIcon: Record<string, string> = {
system: "i-heroicons-computer-desktop",
light: "i-heroicons-sun",
dark: "i-heroicons-moon",
};
const nextMode = computed(() => {
let nextModeIndex: any = null;
const currentModeIndex = modes.indexOf(colorMode.preference);
if (currentModeIndex + 1 == modes.length) {
nextModeIndex = 0;
} else {
nextModeIndex = currentModeIndex + 1;
}
return modes[nextModeIndex];
});
const nextModeIcon = computed(() => modesIcon[colorMode.preference]);
const toggleTheme = () => (colorMode.preference = nextMode.value);
</script>
<template>
<ClientOnly>
<UButton @click="toggleTheme" color="gray" :icon="nextModeIcon"> </UButton>
</ClientOnly>
</template>
<style scoped></style>
@@ -0,0 +1,30 @@
<script lang="ts" setup>
const props = defineProps<{
address?: string;
}>();
const copy = () => {
const textarea: any = document.createElement("textarea");
textarea.value = props.address;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
document.body.removeChild(textarea);
};
</script>
<template>
<div class="payment-address-input w-full">
<UInput disabled :value="address" class="w-full cursor-none" size="lg" />
<UButton class="button" size="sm" @click="copy">Copy Address</UButton>
</div>
</template>
<style scoped lang="scss">
.payment-address-input {
@apply flex gap-2;
input {
@apply py-5;
}
}
</style>
@@ -0,0 +1,20 @@
<script lang="ts" setup>
const emit = defineEmits<{
retry: [];
}>();
</script>
<template>
<div class="flex flex-col items-center gap-2">
<div class="icon">
<UIcon
class="w-[32px] h-[32px] text-red-500"
name="i-heroicons-exclamation-circle-16-solid"
/>
</div>
<span>Payment check failed, click to retry</span>
<UButton @click="emit('retry')">Retry Payment Checking</UButton>
</div>
</template>
<style scoped></style>
@@ -0,0 +1,15 @@
<script lang="ts" setup></script>
<template>
<div class="flex flex-col items-center gap-2">
<div class="icon">
<UIcon
class="animate-spin w-[32px] h-[32px]"
name="i-heroicons-arrow-path-20-solid"
/>
</div>
<span>Waiting For Payment</span>
</div>
</template>
<style scoped></style>
@@ -0,0 +1,40 @@
<script lang="ts" setup>
import type { PaymentQRCodeProps } from "./PaymentQRCode.vue";
interface Props {
title?: string;
qrCode?: PaymentQRCodeProps;
error?: boolean;
}
const props = defineProps<Props>();
const emit = defineEmits<{
cancel: [];
retry: [];
}>();
</script>
<template>
<UCard>
<template #header>
<h2 class="font-bold text-base">{{ title }}</h2>
</template>
<slot />
<div class="w-full flex flex-col items-center gap-4 pt-4">
<PaymentAddressDisplay :address="qrCode?.address" />
<PaymentQRCode v-bind="qrCode" />
<PaymentError v-if="error" @retry="emit('retry')" />
<PaymentLoading v-else />
</div>
<div class="flex justify-end pt-3">
<UButton variant="outline" @click="emit('cancel')">Cancel</UButton>
</div>
</UCard>
</template>
<style scoped lang="scss">
.qr-code {
@apply w-[300px] h-[300px] bg-gray-800;
}
</style>
@@ -0,0 +1,36 @@
<script lang="ts" setup>
import QrcodeVue from "qrcode.vue";
import type { Numberic } from "~/types";
export interface PaymentQRCodeProps {
address?: string;
amount?: Numberic;
description?: string;
}
const props = defineProps<PaymentQRCodeProps>();
const renderValue = computed(() => {
if (!props.address || !props.amount) return undefined;
return `monero:${props.address}?tx_amount=${props.amount}&tx_description=${
props.description || ""
}`;
});
</script>
<template>
<div v-if="address" class="flex flex-col gap-3 items-center pb-4">
<span>OR</span>
<QrcodeVue
:margin="4"
:value="renderValue"
:size="256"
level="M"
class="rounded-lg"
>
</QrcodeVue>
<UButton block :to="renderValue" target="_blank">Open In My Wallet</UButton>
</div>
</template>
<style scoped></style>
@@ -0,0 +1,132 @@
<script lang="ts" setup>
import type { SlugReservationResponse } from "~/types";
const props = defineProps<{
reservedData?: SlugReservationResponse;
reservedSlug?: string;
}>();
const emit = defineEmits<{
cancel: [];
}>();
const active = defineModel<boolean>("active");
// const { checkReservation: checkReservationApi } = useServices();
const { toStreamerDisplay } = useRouteLocation();
const toast = useToast();
const { state: authState } = useAuthStore();
// const paymentInterval = ref<NodeJS.Timeout | undefined>(undefined);
const cancelPayment = () => {
stopPaymentCheck();
emit("cancel");
};
const runPaymentCheck = () => {
init({
slug: `user-${authState.user?.id}`,
});
};
const stopPaymentCheck = () => {
disconnect();
};
const { init, disconnect } = usePaymentSocket({
onMessage: (data) => {
console.log(data.data.page?.paid);
if (!data.data.page?.paid) return;
toast.add({
title: "Tip received successfully!",
});
return navigateTo(toStreamerDisplay()?.path);
},
onError: () => {
cancelPayment();
toast.add({
color: "red",
title: "Error checking reservation",
description:
"If you have already sent the payment, your page will be created.",
});
},
});
// const checkPayment = async () => {
// console.log("checking payment");
// try {
// if (!props.reservedData || !props.reservedSlug) return;
// const now = Math.floor(Date.now() / 1000);
// const timestamp = props.reservedData.reservation_timestamp;
// if (timestamp < now) {
// cancelPayment();
// return;
// }
// const res = await checkReservationApi({
// slug: props.reservedSlug,
// });
// if (res.paid) {
// return navigateTo(toStreamerDisplay()?.path);
// }
// } catch (error) {
// console.log("error checking reservation");
// }
// };
watch(active, (currentActive) => {
if (currentActive) {
runPaymentCheck();
} else {
stopPaymentCheck();
}
});
onBeforeUnmount(() => stopPaymentCheck());
</script>
<template>
<UModal v-model="active" preventClose>
<PaymentModalContent
title="Page Creation Fee"
:qrCode="{
address: reservedData?.payment_address,
amount: reservedData?.amount,
}"
@cancel="cancelPayment"
>
<template v-if="reservedData">
<p class="pb-1.5 mb-2.5 text-gray-700 border-b border-border">
Your slug is reserved until
{{
new Date(
reservedData?.reservation_timestamp * 1000
).toLocaleString()
}}
</p>
<UAlert color="emerald" variant="subtle" title="Note" class="text-xl">
<template #title>
<h6 class="font-bold text-base">NOTE</h6>
</template>
<template #description>
<p class="text-[15px] leading-6">
In order to prevent spam, please pay a small fee of
<span class="font-bold">{{ reservedData.amount }} XMR</span> to
the following address
</p>
</template>
</UAlert>
</template>
</PaymentModalContent>
</UModal>
</template>
<style scoped></style>
@@ -0,0 +1,104 @@
<script lang="ts" setup>
import type { TipCreationResponse } from "~/types";
const props = defineProps<{
createdTip?: TipCreationResponse;
slug?: string;
}>();
const emit = defineEmits<{
cancel: [];
paid: [];
}>();
const active = defineModel<boolean>("active");
const paymentError = ref(false);
const toast = useToast();
const { init, disconnect } = usePaymentSocket({
onMessage: (data) => {
console.log(data);
if (!data.data.tip?.paid) return;
toast.add({
title: "Tip received successfully!",
});
emit("paid");
},
onError: () => {
cancelPayment();
toast.add({
color: "red",
title: "Something went wrong checking for payment",
description:
"If you have already sent the payment it will be credited as soon as received.",
timeout: 0,
});
},
onClose: () => {
paymentError.value = true;
},
});
const cancelPayment = () => {
disconnect();
emit("cancel");
};
const initSocket = () => {
paymentError.value = false;
init({
slug: `tip-${props.createdTip?.id as string}`,
});
};
const retry = () => {
initSocket();
};
watch(active, (currentActive) => {
if (currentActive) {
initSocket();
} else {
disconnect();
}
});
onBeforeUnmount(() => disconnect());
</script>
<template>
<UModal v-model="active" preventClose>
<PaymentModalContent
title="Send Tip"
:qrCode="{
address: createdTip?.payment_address,
amount: createdTip?.amount,
}"
:error="paymentError"
@cancel="cancelPayment"
@retry="retry"
>
<template v-if="createdTip">
<UAlert color="emerald" variant="subtle" class="text-xl">
<template #title>
<h6 class="font-bold text-base">NOTE</h6>
</template>
<template #description>
<p class="text-[15px] leading-6">
Please send minimum
<span class="font-bold">{{ createdTip.amount }} XMR</span>
to the following address
</p>
</template>
</UAlert>
</template>
</PaymentModalContent>
</UModal>
</template>
<style scoped></style>
+29
View File
@@ -0,0 +1,29 @@
<script setup lang="ts">
const { toStreamerCreate } = useRouteLocation();
</script>
<template>
<div class="no-page">
<img
class="w-full rounded-md overflow-hidden"
src="/images/home-hero.png"
alt=""
/>
<h6>You don't have a page yet</h6>
<p>Get started by creating a new page for yourself</p>
<UButton size="xl" :to="toStreamerCreate()">Create New Page</UButton>
</div>
</template>
<style scoped lang="scss">
.no-page {
@apply w-full py-5 flex justify-center items-center flex-col text-center;
img {
@apply w-[400px];
}
h6 {
@apply text-3xl md:text-5xl font-medium py-6;
}
p {
@apply text-lg md:text-xl text-gray-600 mb-10;
}
}
</style>
@@ -0,0 +1,81 @@
<script setup lang="ts">
import type { Tip } from "~/types";
const props = defineProps<{
slug: string;
}>();
const { getTips: getTipsApi } = useServices();
const { data, refresh, pending, error } = useLazyAsyncData(
`recent-tips-${props.slug}`,
() => getTipsApi(props.slug)
);
const interval = ref<NodeJS.Timeout | undefined>(undefined);
onMounted(() => startTipsInterval());
const startTipsInterval = () => {
stopTipsInterval();
interval.value = setInterval(() => refresh(), 10000);
};
const stopTipsInterval = () => {
clearInterval(interval.value);
};
onBeforeUnmount(() => stopTipsInterval());
</script>
<template>
<div class="w-full sidebar scrollbar scrollbar-thumb-rose-500">
<h3 class="font-medium text-xl pb-4">Recent Tips</h3>
<!-- <UProgress
v-if="pending && !data"
animation="carousel"
class="max-w-[280px] m-auto"
/>
<div v-if="error">Something went wrong</div>
<slot v-else /> -->
<PendingView :error="error">
<div class="empty text-pale" v-if="!data?.length">
<UIcon name="i-heroicons-moon" class="empty-icon"></UIcon>
<span class="empty-text">No recent tips!</span>
</div>
<template v-else>
<div class="messages">
<div class="item" v-for="item in data">
<p class="pb-1 text-base font-medium">{{ item.name }}</p>
<span class="flex pb-1 font-medium text-primary">
{{ item.amount }} XMR
</span>
<p>
{{ item.message }}
</p>
</div>
</div>
</template>
</PendingView>
</div>
</template>
<style scoped lang="scss">
.sidebar {
.empty {
@apply p-6 border-border border flex items-center flex-col rounded-md;
.empty-icon {
@apply text-3xl;
}
.empty-text {
@apply text-sm mt-1;
}
}
.messages {
@apply border-border border rounded-md flex flex-col gap-2 max-h-[400px] overflow-auto;
.item {
@apply p-3;
}
}
}
</style>
@@ -0,0 +1,67 @@
<script lang="ts" setup>
const { toStreamerEdit, toStreamer } = useRouteLocation();
const props = defineProps<{
actions?: boolean;
slug?: string;
logoId?: string;
bannerId?: string;
}>();
</script>
<template>
<div class="streamer-header">
<div class="banner-container">
<GeneralImage variant="banner" :id="bannerId" class="banner" />
</div>
<div class="options">
<div class="logo-and-name">
<GeneralImage :id="logoId" variant="logo" class="logo" />
<div class="name font-bold text-2xl p-2">Send Tip</div>
</div>
<div class="flex gap-2 my-3" v-if="actions">
<UButton variant="outline" v-if="slug" :to="toStreamer(slug)">
View Page
</UButton>
<UTooltip text="Edit Page">
<UButton
:to="toStreamerEdit()"
icon="i-heroicons-pencil-solid"
square
></UButton>
</UTooltip>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.streamer-header {
--logo-size: 180px;
.banner {
@apply w-full;
}
.options {
@apply flex justify-between items-start;
}
.logo-and-name {
@apply flex gap-2;
}
.logo {
margin-top: calc(var(--logo-size) / 2 * -1);
@apply ml-4 w-[var(--logo-size)] h-[var(--logo-size)];
}
@media only screen and (max-width: 760px) {
--logo-size: 120px;
.options {
@apply flex-col items-center;
}
.logo-and-name {
@apply flex-col items-center;
}
.logo {
@apply ml-0;
}
}
}
</style>
@@ -0,0 +1,371 @@
<script lang="ts" setup>
// @ts-ignore
import debounce from "lodash.debounce";
import useVuelidate from "@vuelidate/core";
import type { CreateFormFields, SlugReservationResponse } from "~/types";
const { toStreamerDisplay, toGuides } = useRouteLocation();
interface State {
form: CreateFormFields;
loadingSlug: boolean;
slugAvailable: boolean;
loading: boolean;
errorMessage?: string;
stagedLogo?: string;
stagedBanner?: string;
}
const toast = useToast();
const { required, minLength, maxLength, streamerSlug, streamerSlugInternal } =
useValidations();
const {
checkSlug: checkSlugApi,
reserveSlug,
getMyPage,
updateStreamer,
} = useServices();
const emit = defineEmits<{
done: [
{
data: SlugReservationResponse;
slug?: string;
}
];
}>();
const props = defineProps<{
editable: boolean;
}>();
const state = reactive<State>({
form: {
adult: false,
logo: undefined,
cover_image: undefined,
payment_address: undefined,
view_key: undefined,
slug: undefined,
tiers: [],
},
slugAvailable: false,
loadingSlug: false,
loading: false,
errorMessage: undefined,
stagedBanner: undefined,
stagedLogo: undefined,
});
const renderSlugStatus = computed(() => {
if (v.value.slug.$invalid || props.editable) return undefined;
if (state.loadingSlug)
return {
text: "Loading",
className: "",
};
if (state.slugAvailable)
return {
text: "Available",
className: "text-green-500",
};
return {
text: "Unavailable",
className: "text-red-500",
};
});
const isSlugValid = computed(() => state.slugAvailable && !state.loadingSlug);
const renderResultURL = computed(() => {
const showUrl = !v.value.slug.$invalid;
if (showUrl)
return `Your page will be available at xmrchat.com/${state.form.slug}`;
return undefined;
});
const chechSlugDebounced = debounce(async (value: string | undefined) => {
if (v.value.slug.$invalid || props.editable) return;
state.loadingSlug = true;
try {
const res = await checkSlugApi({
slug: value,
});
state.slugAvailable = res.available;
} catch (error) {
console.log("error");
} finally {
state.loadingSlug = false;
}
}, 500);
watch(
() => state.form.slug,
(v) => chechSlugDebounced(v)
);
const handleSubmit = async () => {
v.value.$touch();
const valid = await v.value.$validate();
if (!valid) return;
state.errorMessage = undefined;
try {
state.loading = true;
if (!props.editable) {
if (!isSlugValid.value) return;
const res = await reserveSlug(state.form);
emit("done", {
data: res,
slug: state.form.slug,
});
} else {
if (!state.form.slug) return;
const res = await updateStreamer(state.form.slug, {
adult: state.form.adult,
logo: state.form.logo,
cover_image: state.form.cover_image,
payment_address: state.form.payment_address,
view_key: state.form.view_key,
tiers: state.form.tiers,
});
toast.add({ title: "Page updated!" });
navigateTo(toStreamerDisplay()?.path);
}
} catch (error) {
state.errorMessage = getErrorMessage(error);
} finally {
state.loading = false;
}
};
// Vuelidatte Validation Parameteres
const v = useVuelidate<State["form"]>(
{
logo: { required },
cover_image: { required },
payment_address: {
required,
minLength: minLength(95),
maxLength: maxLength(106),
},
view_key: { required, minLength: minLength(64), maxLength: maxLength(64) },
slug: {
required,
streamerSlug,
streamerSlugInternal,
minLength: minLength(3),
maxLength: maxLength(16),
},
},
toRef(state, "form")
);
const getPage = async () => {
if (props.editable) {
const response = await getMyPage();
state.form = {
adult: response.adult,
logo: response.logo,
cover_image: response.cover_image,
payment_address: response.payment_address,
view_key: response.view_key,
slug: response.path,
tiers:
response.tiers?.map((tier) => ({
name: tier.name,
price: tier.amount,
})) || [],
};
}
};
onMounted(async () => {
getPage();
});
const { getValidationAttrs } = useValidations(v);
</script>
<template>
<div>
<UForm
:state="state.form"
class="create-modify-form inner"
@submit="handleSubmit"
>
<div class="both">
<UFormGroup
size="lg"
label="Logo"
description="1:1 ratio"
name="logo"
:error="getValidationAttrs('logo').error"
>
<div class="flex flex-col gap-2">
<div class="flex justify-center">
<GeneralImage
v-if="state.form.logo"
:id="state.form.logo"
variant="logo"
class="w-[200px] h-[200px]"
/>
</div>
<ImageUploader
@upload="state.form.logo = $event"
@blur="getValidationAttrs('logo').onBlur"
/>
</div>
</UFormGroup>
<UFormGroup
size="lg"
label="Banner Image"
description="Best to be uploaded in 3:1"
name="cover_image"
:error="getValidationAttrs('cover_image').error"
>
<div class="flex flex-col gap-2">
<div class="flex justify-center">
<GeneralImage
v-if="state.form.cover_image"
:id="state.form.cover_image"
variant="banner"
class="w-full h-[200px]"
/>
</div>
<ImageUploader
@upload="state.form.cover_image = $event"
@blur="getValidationAttrs('cover_image').onBlur"
/>
</div>
</UFormGroup>
</div>
<div class="single">
<UFormGroup
size="lg"
label="Your Id"
name="slug"
:error="getValidationAttrs('slug').error"
:description="renderResultURL"
>
<UInput
:disabled="editable"
placeholder="Page Slug"
v-model="state.form.slug"
@blur="getValidationAttrs('slug').onBlur"
/>
</UFormGroup>
<span
v-if="renderSlugStatus"
:class="['text-sm flex pt-2', renderSlugStatus.className]"
>
{{ renderSlugStatus.text }}
</span>
</div>
<div class="both">
<UFormGroup
size="lg"
label="Monero primary receive address"
name="payment_address"
:error="getValidationAttrs('payment_address').error"
>
<UInput
type="text"
v-model="state.form.payment_address"
@blur="getValidationAttrs('payment_address').onBlur"
/>
</UFormGroup>
<UFormGroup
size="lg"
label="Monero secret view key"
name="view_key"
:error="getValidationAttrs('view_key').error"
>
<UInput
v-model="state.form.view_key"
@blur="getValidationAttrs('view_key').onBlur"
/>
<template #help>
<span>
We need secret view key to be able to view incoming transactions
from viewers.
</span>
<UButton
variant="link"
color="blue"
target="_blank"
class="p-0"
:to="toGuides()"
>
Where to find view key?
</UButton>
</template>
</UFormGroup>
</div>
<div class="single">
<UFormGroup label="Tip Amount Suggestions">
<StreamerTipSuggestions v-model="state.form.tiers" />
</UFormGroup>
<!-- <UFormGroup size="lg" label="Set minimum XMR tip amount">
<UInput type="number" />
</UFormGroup> -->
</div>
<div class="mt-8">
<UCheckbox
color="primary"
label="Check if adult content"
v-model="state.form.adult"
/>
</div>
<div class="single">
<UAlert
color="red"
:description="state.errorMessage"
title="Error creating/updating page"
v-if="state.errorMessage"
>
</UAlert>
</div>
<div class="flex gap-3">
<UButton
size="lg"
type="submit"
:loading="state.loading"
trailingIcon="i-heroicons-arrow-small-right"
>
Continue
</UButton>
</div>
</UForm>
</div>
</template>
<style scoped lang="scss">
.create-modify-form {
@apply flex gap-4 flex-col max-w-[860px];
.both {
.buttons {
@apply inline-flex gap-2;
}
.banner {
@apply flex justify-center mb-8;
img {
width: 100%;
height: 200px;
object-fit: cover;
}
}
}
}
</style>
@@ -0,0 +1,90 @@
<script lang="ts" setup>
import type { TipTierField } from "~/types";
// @ts-ignore
import { ValidateEach } from "@vuelidate/components";
const tiers = defineModel<TipTierField[]>({
default: () => [],
});
const { getValidationAttrs, required, numberic, minLength } = useValidations();
const handleRemove = (index: number) => {
tiers.value = tiers.value.filter((_, i) => i !== index);
};
const newTier = () => {
tiers.value.push({
price: undefined,
});
};
const rules = computed(() => {
return {
price: { required, numberic },
name: { required, minLength: minLength(3) },
};
});
</script>
<template>
<div class="streamer-tiers">
<div class="items flex flex-col gap-3 py-2">
<template v-if="tiers.length">
<ValidateEach
v-for="(item, index) of tiers"
:state="item"
:rules="rules"
>
<template #default="{ v }">
<div class="item flex items-end gap-2">
<UFormGroup
label="Name"
:error="getValidationAttrs('name', v).error"
>
<UInput
v-model="item.name"
@blur="getValidationAttrs('name', v).onBlur"
>
</UInput>
</UFormGroup>
<UFormGroup
label="Amount ( USD )"
:error="getValidationAttrs('price', v).error"
>
<UInput
v-model="item.price"
@blur="getValidationAttrs('price', v).onBlur"
>
</UInput>
</UFormGroup>
<UButton color="red" @click="handleRemove(index)" type="button">
Remove
</UButton>
</div>
</template>
</ValidateEach>
</template>
<div v-else class="no-tiers text-sm text-pale">
There are no suggested amounts added, Click the button bellow to add new
tiers.
</div>
</div>
<UButton
icon="i-heroicons-plus"
variant="solid"
@click="newTier"
size="sm"
class="mt-2"
type="button"
>
Add Tier
</UButton>
</div>
</template>
<style scoped lang="scss">
.buttons {
@apply inline-flex gap-2 mt-2;
}
</style>
@@ -0,0 +1,73 @@
<script lang="ts" setup>
const props = defineProps<{
slug: string;
}>();
const { getTips: getTipsApi } = useServices();
const { data, refresh, pending, error } = useLazyAsyncData(
`recent-tips-${props.slug}`,
() => getTipsApi(props.slug)
);
const interval = ref<NodeJS.Timeout | undefined>(undefined);
onMounted(() => startTipsInterval());
const startTipsInterval = () => {
stopTipsInterval();
interval.value = setInterval(() => refresh(), 4000);
};
const stopTipsInterval = () => {
clearInterval(interval.value);
};
onBeforeUnmount(() => stopTipsInterval());
const columns = [
{
key: "name",
label: "Name",
},
{
key: "amount",
label: "Amount",
},
{
key: "message",
label: "Message",
},
{
key: "paidAt",
label: "Date",
},
{
key: "actions",
},
];
</script>
<template>
<PendingView :error="error" :pending="pending && !data">
<UTable
v-if="data"
:rows="data"
:columns="columns"
class="border border-border rounded-md"
>
<template #paidAt-data="{ row }">
<div class="paid-at">
{{ new Date(row.paid_at).toLocaleString() }}
</div>
</template>
<template #actions-data="{ row }">
<UButton>Feature</UButton>
</template>
<template #empty-state>
<NoItems />
</template>
</UTable>
</PendingView>
</template>
<style scoped></style>
+197
View File
@@ -0,0 +1,197 @@
<script setup lang="ts">
import useVuelidate from "@vuelidate/core";
import type {
CreateFormFields,
TipCreationResponse,
TipFormFields,
Tip,
StreamerPage,
} from "~/types";
const props = defineProps<{
streamerId: string;
streamerPage?: StreamerPage | null;
}>();
const { required } = useValidations();
const { sendTipToStreamer: sendTipToStreamerApi, getPrice: getPriceApi } =
useServices();
const emit = defineEmits<{
done: [TipCreationResponse];
}>();
interface State {
form: TipFormFields;
buttonsAmount: any;
loading: boolean;
errorMessage?: string;
}
const state = reactive<State>({
form: {
name: undefined,
amount: undefined,
message: undefined,
private: false,
},
buttonsAmount: [3, 5, 10, 12],
loading: false,
errorMessage: undefined,
});
// Vuelidatte Validation Parameteres
const v = useVuelidate<State["form"]>(
{
name: { required },
amount: { required },
message: { required },
},
toRef(state, "form")
);
const { getValidationAttrs } = useValidations(v);
const handleSubmit = async () => {
v.value.$touch();
const valid = await v.value.$validate();
if (!valid) return;
state.errorMessage = undefined;
try {
state.loading = true;
const price = await getPriceApi();
const xmrAmount = Math.round((state.form.amount / price) * 1e12).toString();
const response = await sendTipToStreamerApi(props.streamerId, {
...state.form,
amount: xmrAmount,
});
emit("done", response);
} catch (error) {
state.errorMessage = getErrorMessage(error);
} finally {
state.loading = false;
}
};
defineExpose({
reset: () => {
v.value.$reset();
state.form = {
amount: undefined,
message: undefined,
name: undefined,
private: false,
};
},
});
</script>
<template>
<div class="payment pt-5 md:pt-10">
<div class="w-full content-side">
<UForm
class="flex flex-col gap-5"
:state="state.form"
@submit="handleSubmit"
>
<div class="both pb-4">
<UFormGroup
size="lg"
label="Enter name"
:error="getValidationAttrs('name').error"
name="name"
>
<UInput
type="text"
v-model="state.form.name"
@blur="getValidationAttrs('name').onBlur"
/>
</UFormGroup>
<UFormGroup
size="lg"
label="Enter Tip Amount"
:error="getValidationAttrs('amount').error"
name="amount"
>
<UInput
v-model="state.form.amount"
@blur="getValidationAttrs('amount').onBlur"
icon="i-mdi-currency-usd"
/>
<TipTiers
:tiers="streamerPage?.tiers"
@select="state.form.amount = $event"
/>
</UFormGroup>
</div>
<div class="single">
<UFormGroup
:error="getValidationAttrs('message').error"
label="Message"
name="message"
>
<UTextarea
@blur="getValidationAttrs('message').onBlur"
v-model="state.form.message"
placeholder="Enter message..."
/>
</UFormGroup>
</div>
<!-- <div class="single">
<UCheckbox
color="primary"
label="Is Private Tip"
v-model="state.form.private"
/>
</div> -->
<div class="single">
<UAlert
color="red"
:description="state.errorMessage"
title="Tip Creation Failed"
v-if="state.errorMessage"
>
</UAlert>
</div>
<div class="flex">
<UButton
size="lg"
type="submit"
:loading="state.loading"
trailingIcon="i-heroicons-arrow-small-right"
>
Continue
</UButton>
</div>
</UForm>
</div>
<div class="tip-side min-w-[300px]">
<RecentTipsSidebar :slug="streamerId" />
</div>
</div>
</template>
<style scoped lang="scss">
.payment {
@apply w-full flex gap-10;
}
.buttons {
@apply inline-flex gap-1 pt-2;
}
@media screen and (max-width: 650px) {
.payment {
@apply flex-col;
}
}
</style>
+35
View File
@@ -0,0 +1,35 @@
<script lang="ts" setup>
import type { Numberic, TipTier } from "~/types";
const props = defineProps<{
tiers?: TipTier[];
}>();
const emit = defineEmits<{
select: [Numberic];
}>();
const sortedTiers = computed(() =>
props.tiers?.toSorted((a, b) => parseInt(a.amount) - parseInt(b.amount))
);
const handleClick = (item: TipTier) => {
emit("select", item.amount);
};
</script>
<template>
<div class="tiers flex flex-wrap gap-1 py-1">
<UButton
v-for="item of sortedTiers"
@click="handleClick(item)"
size="xs"
square
variant="soft"
>
${{ item.amount }}
</UButton>
</div>
</template>
<style scoped lang="scss"></style>
+15
View File
@@ -0,0 +1,15 @@
<script setup lang="ts">
const props = defineProps<{
title: String;
desciption?: String;
}>();
</script>
<template>
<div class="text-center py-10">
<h3 class="font-medium text-2xl">{{ title }}</h3>
<p class="text-pale">{{ desciption }}</p>
</div>
</template>
<style scoped lang="scss"></style>
+29
View File
@@ -0,0 +1,29 @@
import type { StreamerPage } from "~/types";
export const useAppSeoMeta = () => {
const description =
"Viewers, send messages and tips with ease and privacy. Streamers, keep nearly all of your tips instead of giving 30-50% to big tech.";
const title = "Message and Tip with Monero";
useServerSeoMeta({
description,
ogTitle: title,
ogDescription: description,
ogImage: "/images/xmrchat-banner.png",
twitterTitle: title,
twitterDescription: description,
twitterImage: "/images/xmrchat-banner.png",
});
};
export const useStreamerIdSeoMeta = (
page: Ref<StreamerPage | undefined | null>
) => {
useSeoMeta({
title: () => `Tip ${page.value?.path || ""}`,
});
useServerSeoMeta({
ogTitle: `XMRChat - Tip ${page.value?.path} with Monero`,
twitterTitle: `XMRChat - Tip ${page.value?.path} with Monero`,
});
};
+66
View File
@@ -0,0 +1,66 @@
import { type Socket, io } from "socket.io-client";
import type { PaymentSocketMessage } from "~/types";
interface PaymentSocketOptions {
onMessage: (...args: [PaymentSocketMessage]) => any;
onError?: () => any;
onClose?: () => any;
}
interface TipPaymentInitParams {
slug: string;
}
export const usePaymentSocket = (options?: PaymentSocketOptions) => {
const socket = shallowRef<WebSocket | undefined>();
const config = useRuntimeConfig();
const init = (params?: TipPaymentInitParams) => {
// const url = `${config.public.apiBaseUrl}/v1/pages/${params.slug}/ws/tips/${params.tipId}`;
const url = `wss://api.xmrchat.com/ws/${params?.slug}`;
console.log("creating socket with url", url);
socket.value = new WebSocket(url);
runEvents();
};
const runEvents = () => {
if (!socket.value) return;
socket.value.onopen = handleOpen;
socket.value.onclose = handleClose;
socket.value.onerror = (e) => {
console.log("on error", e);
options?.onError?.();
};
socket.value.onmessage = (e: MessageEvent<string>) => {
const data = JSON.parse(e.data) as PaymentSocketMessage;
if (data.error) {
options?.onError?.();
return;
}
options?.onMessage(data);
};
};
const handleOpen = () => {
console.log("Socket Is Active");
};
const handleClose = () => {
console.log("Socket Closed");
options?.onClose?.();
};
const disconnect = () => {
socket.value?.close();
// socket.value?.disconnect();
};
return {
init,
disconnect,
};
};
+14
View File
@@ -0,0 +1,14 @@
export const useApp = () => {
const nuxtApp = useNuxtApp();
const localeRoute = useLocaleRoute();
const navigateLocale = (...x: Parameters<typeof localeRoute>) => navigateTo(localeRoute(...x));
const errorHandler = useErrorHandler();
const successHandler = useSuccessHandler();
return {
axios: nuxtApp.$axios,
navigateLocale,
errorHandler,
successHandler,
};
};
+3
View File
@@ -0,0 +1,3 @@
export const useDate = () => {
return ref();
};
+8
View File
@@ -0,0 +1,8 @@
export const useErrorHandler = () => {
const errorHandler = (e: any) => {
console.log(e);
};
return {
errorHandler,
};
};
+24
View File
@@ -0,0 +1,24 @@
import type { Numberic } from "~/types";
export const ROUTES = {
login: "/auth/login",
signup: "/auth/signup",
forgotPassword: "/auth/forgot_password",
};
export const useRouteLocation = () => {
const localeRoute = useLocaleRoute();
return {
toIndex: () => localeRoute("/"),
toLogin: () => localeRoute(ROUTES.login),
toSignup: () => localeRoute(ROUTES.signup),
toForgotPassword: () => localeRoute(ROUTES.forgotPassword),
toStreamerDisplay: () => localeRoute("/streamer"),
toStreamerEdit: () => localeRoute("/streamer/edit"),
toStreamerCreate: () => localeRoute("/streamer/create"),
toContact: () => localeRoute("/contact"),
toStreamer: (id: Numberic) => localeRoute(`/${id}`),
toGuides: () => localeRoute("/guides/secret-and-primary-address"),
};
};
+141
View File
@@ -0,0 +1,141 @@
import type { AxiosRequestConfig } from "axios";
import type {
LoginResponse,
MeResponse,
Numberic,
SlugReservationResponse,
StreamerPage,
Tip,
TipCreationResponse,
} from "~/types";
export const useServices = () => {
const { axios } = useApp();
const checkSession = async () => {
const res = await axios.get<MeResponse>("/v1/users/auth");
return res.data;
};
const login = async (params: any) => {
const res = await axios.post<LoginResponse>("/v1/users/login", params);
return res;
};
const signup = async (params: any) => {
const res = await axios.post<LoginResponse>("/v1/users", params);
return res;
};
const checkSlug = async (params: any) => {
const res = await axios.get<{ available: boolean }>("/v1/pages/checkslug", {
params,
});
return res.data;
};
const reserveSlug = async (params: any) => {
const res = await axios.post<SlugReservationResponse>(
"/v1/pages/reserveslug",
params
);
return res.data;
};
const checkReservation = async (params: any) => {
const res = await axios.get<{ paid: boolean }>(
"/v1/pages/checkreservation",
{ params }
);
return res.data;
};
const checkSendTip = async (slug: string, id: string) => {
const res = await axios.get<{ paid: boolean }>(
`v1/pages/${slug}/tips/${id}`
);
return res.data;
};
const uploadImage = async (params: any, config?: AxiosRequestConfig) => {
const res = await axios.post<{ id: string }>("/v1/images", params, config);
return res.data;
};
const sendTipToStreamer = async (slug: string, params: any) => {
const res = await axios.post<TipCreationResponse>(
`/v1/pages/${slug}/tips`,
params
);
return res.data;
};
const getPrice = async () => {
const res = await axios.get("v1/price");
return res.data.price;
};
const getStreamerPage = async (slug: string) => {
const res = await axios.get<{ result: StreamerPage }>(`/v1/pages/${slug}`);
return res.data.result;
};
const getTips = async (slug: string) => {
const res = await axios.get<Tip[]>(`/v1/pages/${slug}/tips`);
return res.data;
};
const getMyPage = async () => {
const res = await axios.get<StreamerPage[]>("/v1/pages");
return res.data.toSorted((a, b) => b.path.localeCompare(a.path))[0];
};
const updateStreamer = async (slug: string, params: any) => {
const res = await axios.patch(`/v1/pages/${slug}`, params);
return res.data[0];
};
const logout = async () => {
const res = await axios.get("/v1/users/logout");
return res;
};
const forgotPassword = async (params: any) => {
const res = await axios.post("/v1/users/reset_password", params);
return res;
};
const resetPassword = async (params: any, token: string) => {
const res = await axios.post(
`/v1/users/auth/reset_password/${token}`,
params
);
return res;
};
const confirmEmail = async (token: Numberic) => {
const res = await axios.post(`/v1/users/auth/email_verification/${token}`);
return res;
};
return {
checkSession,
login,
signup,
logout,
checkSlug,
reserveSlug,
checkReservation,
checkSendTip,
uploadImage,
sendTipToStreamer,
getPrice,
getStreamerPage,
getTips,
getMyPage,
updateStreamer,
forgotPassword,
resetPassword,
confirmEmail,
};
};
+8
View File
@@ -0,0 +1,8 @@
export const useSuccessHandler = () => {
const successHandler = (e: any) => {
console.log(e);
};
return {
successHandler,
};
};
+94
View File
@@ -0,0 +1,94 @@
import type { Validation } from "@vuelidate/core";
import {
required as baseRequired,
email as baseEmail,
numeric as baseNumberic,
minValue as baseMinValue,
minLength as baseMinLength,
maxLength as baseMaxLength,
sameAs as baseSameAs,
helpers,
} from "@vuelidate/validators";
// import { getProperty } from "~/utils";
export const useValidations = (generalV?: Ref<Validation>) => {
const { t } = useI18n();
const required = helpers.withMessage(
() => t("validations.required"),
baseRequired
);
const email = helpers.withMessage(() => t("validations.email"), baseEmail);
const numberic = helpers.withMessage(
() => t("validations.numberic"),
baseNumberic
);
const minLength = (...v: Parameters<typeof baseMinLength>) =>
helpers.withMessage(
({ $params }) => t("validations.minLength", { length: $params.min }),
baseMinLength(...v)
);
const maxLength = (...v: Parameters<typeof baseMinLength>) =>
helpers.withMessage(
({ $params }) => t("validations.maxLength", { length: $params.max }),
baseMaxLength(...v)
);
const sameAs = (...v: Parameters<typeof baseSameAs>) =>
helpers.withMessage(
({ $params }) =>
t("validations.sameAs", { otherName: $params.otherName }),
baseSameAs(...v)
);
const streamerSlugBase = helpers.regex(/^[a-z0-9_-]+$/);
const streamerSlug = helpers.withMessage(
"Your path can only contain lowercase letters, numbers, underscores, and hyphens.",
streamerSlugBase
);
const streamerSlugInternalBase = (v: string) =>
!["auth", "guides", "streamer", "contact"].includes(v);
const streamerSlugInternal = helpers.withMessage(
"This slug is not usable.",
streamerSlugInternalBase
);
const getValidationAttrs = (path: string, v?: MaybeRef<Validation>) => {
v = unref(v || generalV);
const instance = getProperty(v, path);
return {
onBlur: instance.$touch,
error: instance.$errors[0]?.$message,
};
};
const validate = async (v?: MaybeRef<Validation>) => {
v = unref(v || generalV);
if (!v) return;
v.$touch();
await v.$validate();
return v.$errors.map((error: any) => ({
message: error.$message,
path: error.$propertyPath,
})) as any;
};
return {
required,
email,
numberic,
minLength,
maxLength,
sameAs,
streamerSlug,
streamerSlugInternal,
getValidationAttrs,
validate,
};
};
+22
View File
@@ -0,0 +1,22 @@
name: xmrchat-nuxt
services:
front-end-nuxt:
build: .
container_name: front-end-nuxt
restart: always
ports:
- "3000:3000"
# command: "npm run start"
labels:
- "traefik.enable=true"
- traefik.http.routers.front-end-nuxt.rule=Host(`${DOMAIN_NAME:-xmrchat.org}`) || Host(`xmrchat.com`)
- treafik.http.routers.front-end-nuxt.entrypoints=websecure
- traefik.http.services.front-end-nuxt.loadbalancer.server.port=3000
- "traefik.http.routers.front-end-nuxt.tls=true"
- "traefik.http.routers.front-end-nuxt.tls.certresolver=myresolver"
networks:
- traefik
networks:
traefik:
name: traefik
external: true
+8
View File
@@ -0,0 +1,8 @@
import en from "./locales/en";
export default defineI18nConfig(() => ({
legacy: false,
messages: {
en,
},
}));
+32
View File
@@ -0,0 +1,32 @@
<template>
<div class="default-layout">
<AppHeader />
<main class="content">
<slot />
</main>
<DevOnly>
<UCheckbox
v-model="devLoggedIn"
class="fixed bottom-5 left-5 bg-background p-2 border border-border rounded-lg"
label="Dev login"
></UCheckbox>
</DevOnly>
<AppFooter />
</div>
</template>
<script lang="ts" setup>
const devLoggedIn = useCookie("xmrchat-dev-logged-in", {
default: () => false,
maxAge: 1000 * 1000,
});
</script>
<style scoped lang="scss">
.default-layout {
@apply flex flex-col min-h-screen;
.content {
@apply flex-1;
}
}
</style>
+12
View File
@@ -0,0 +1,12 @@
export default {
validations: {
required: "Field is required",
email: "Email is invalid",
numberic: "Should be a number",
minLength: "Should be at least {length} characters",
maxLength: "Should not be more than {length} characters",
minValue: "Should be at least {value}",
sameAs: "Should be same as {otherName}",
someFieldsAreIncorrect: "Some of the fields are not filled correctly.",
},
};
+8
View File
@@ -0,0 +1,8 @@
export default defineNuxtRouteMiddleware(() => {
const authStore = useAuthStore();
const { toLogin } = useRouteLocation();
if (!authStore.isLoggedIn) {
return navigateTo(toLogin()?.path);
}
});
+45
View File
@@ -0,0 +1,45 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: process.env.NUXT_PUBLIC_DEVTOOLS_ENABLED === "true" },
runtimeConfig: {
public: {
apiBaseUrl: "https://api.xmrchat.com/api",
apiServerSideBaseUrl: "http://backend:3000/api",
},
},
css: ["@/assets/style/main.scss"],
components: [{ path: "./components", pathPrefix: false }],
modules: ["@nuxt/ui", "@nuxt/fonts", "@nuxtjs/i18n", "@pinia/nuxt"],
// tailwindcss: {
// configPath: "./tailwind.config.ts",
// },
i18n: {
detectBrowserLanguage: {
useCookie: true,
redirectOn: "root",
},
locales: [{ code: "en", iso: "en", name: "English", dir: "auto" }],
defaultLocale: "en",
vueI18n: "./i18n.config.ts",
},
ui: {
icons: ["heroicons", "mdi"],
},
colorMode: {
preference: "light",
fallback: "light",
classSuffix: "",
},
fonts: {
families: [{ name: "Inter", provider: "google" }],
},
});
+12987
View File
File diff suppressed because it is too large. Load diff
+37
View File
@@ -0,0 +1,37 @@
{
"name": "nuxt-app",
"private": true,
"type": "module",
"scripts": {
"start": "nuxt start",
"build": "nuxt build",
"dev": "nuxt dev",
"dev:host": "nuxt dev --host",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@iconify-json/mdi": "^1.1.66",
"@nuxt/fonts": "^0.6.1",
"@nuxt/ui": "^2.15.2",
"@nuxtjs/i18n": "^8.3.0",
"@pinia/nuxt": "^0.5.1",
"@vuelidate/components": "^1.2.6",
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"axios": "^1.6.8",
"dayjs": "^1.11.11",
"lodash.debounce": "^4.0.8",
"nuxt": "^3.11.2",
"pinia": "^2.1.7",
"qrcode.vue": "^3.4.1",
"socket.io-client": "^4.7.5",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
},
"devDependencies": {
"@types/lodash.debounce": "^4.0.9",
"sass": "^1.75.0"
}
}
+70
View File
@@ -0,0 +1,70 @@
<script lang="ts" setup>
import type { TipContent } from "#components";
import type { TipCreationResponse } from "~/types";
definePageMeta({
hideHeaderLogin: true,
});
const route = useRoute();
const streamerId = computed(() => route.params.streamerId as string);
const { getStreamerPage } = useServices();
const contentRef = ref<InstanceType<typeof TipContent> | undefined>();
const { data, pending, refresh, error } = await useLazyAsyncData(
`streamer-${streamerId.value}`,
() => getStreamerPage(streamerId.value)
);
const createdTip = ref<TipCreationResponse | undefined>(undefined);
const paymentModalActive = ref(false);
const handlePayment = (data: TipCreationResponse) => {
paymentModalActive.value = true;
createdTip.value = data;
};
const cancelPayment = () => {
paymentModalActive.value = false;
createdTip.value = undefined;
};
const handlePaid = () => {
paymentModalActive.value = false;
createdTip.value = undefined;
contentRef.value?.reset();
};
useStreamerIdSeoMeta(data);
</script>
<template>
<div class="inner pt-4">
<PendingView :pending="pending" :error="error">
<template v-if="data">
<StreamerHeader
class="pt-2"
:slug="streamerId"
:actions="false"
:bannerId="data?.cover_image"
:logoId="data?.logo"
/>
<TipContent
ref="contentRef"
:streamerId="streamerId"
:streamerPage="data"
@done="handlePayment"
/>
<TipPaymentModal
:createdTip="createdTip"
:slug="streamerId"
v-model:active="paymentModalActive"
@cancel="cancelPayment"
@paid="handlePaid"
/>
</template>
</PendingView>
</div>
</template>
<style scoped lang="scss"></style>
+101
View File
@@ -0,0 +1,101 @@
<script lang="ts" setup>
const { confirmEmail } = useServices();
const { toLogin, toIndex } = useRouteLocation();
useHead({ title: "Email Verification" });
const route = useRoute();
const toast = useToast();
const token = computed(() => route.query.token as string);
const state = reactive({
errorMessage: undefined,
});
const verifyEmail = async () => {
try {
await confirmEmail(token.value);
toast.add({ title: "Your account has been successfully activated" });
return navigateTo(toLogin()?.path);
} catch (error) {
state.errorMessage = getErrorMessage(error);
}
};
onMounted(() => {
verifyEmail();
});
</script>
<template>
<div class="verify">
<span class="loader" v-if="!state.errorMessage"></span>
<div v-else class="flex flex-col gap-8 items-center">
<UAlert
class="w-[280px]"
color="red"
:description="state.errorMessage"
title="Verification Failed"
></UAlert>
<div>
<UButton :to="toIndex()">Go To Home Page</UButton>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.verify {
@apply flex items-center justify-center w-full min-h-[400px] p-2;
}
.loader {
width: 16px;
height: 16px;
box-shadow: 0 30px, 0 -30px;
border-radius: 4px;
background: currentColor;
display: block;
margin: -50px auto 0;
position: relative;
color: #ff7f0a;
transform: translateY(30px);
transform: translateX(-28px);
box-sizing: border-box;
animation: animloader 2s ease infinite;
}
.loader::after,
.loader::before {
content: "";
box-sizing: border-box;
width: 16px;
height: 16px;
box-shadow: 0 30px, 0 -30px;
border-radius: 4px;
background: currentColor;
color: #ff7f0a;
position: absolute;
left: 30px;
top: 0;
animation: animloader 2s 0.2s ease infinite;
}
.loader::before {
animation-delay: 0.4s;
left: 60px;
}
@keyframes animloader {
0% {
top: 0;
color: #ff7f0a;
}
50% {
top: 30px;
color: rgba(255, 255, 255, 0.2);
}
100% {
top: 0;
color: #ff7f0a;
}
}
</style>
+101
View File
@@ -0,0 +1,101 @@
<script lang="ts" setup>
import useVuelidate from "@vuelidate/core";
interface State {
email?: string;
loading: boolean;
errorMessage?: string;
isEmailSent: boolean;
}
useHead({ title: "Forgot password" });
const { required, email } = useValidations();
const { forgotPassword } = useServices();
const state: State = reactive({
email: "",
isEmailSent: false,
loading: false,
errorMessage: undefined,
});
const v = useVuelidate<State>({ email: { required, email } }, state);
const { getValidationAttrs } = useValidations(v);
const clearForm = () => {
state.isEmailSent = false;
state.email = "";
};
const handleSubmit = async () => {
const valid = await v.value.$validate();
if (!valid) return;
state.errorMessage = undefined;
try {
state.loading = true;
const res = await forgotPassword({
email: state.email,
});
state.isEmailSent = true;
} catch (error) {
state.errorMessage = getErrorMessage(error);
} finally {
state.loading = false;
}
};
</script>
<template>
<AuthContainer
title="Reset Password"
:description="
state.isEmailSent ? '' : 'Enter your email to reset your password'
"
>
<UForm
:state="state"
class="form"
@submit="handleSubmit"
v-if="!state.isEmailSent"
>
<UFormGroup
label="Email"
name="email"
:error="getValidationAttrs('email').error"
>
<UInput
v-model="state.email"
@blur="getValidationAttrs('email').onBlur"
/>
</UFormGroup>
<UAlert
color="red"
:description="state.errorMessage"
title="Login Failed"
v-if="state.errorMessage"
>
</UAlert>
<UButton block type="submit" :loading="state.loading"> Submit </UButton>
</UForm>
<div v-else>
<p class="text-base">
We have sent you an email
<span class="text-primary font-medium">{{ state.email }}</span
>, please follow the link in the email to reset your password.
</p>
<UButton block class="mt-3" variant="soft" @click="clearForm">
Change Email
</UButton>
</div>
</AuthContainer>
</template>
<style scoped lang="scss">
.form {
@apply gap-4 flex flex-col;
}
</style>
+86
View File
@@ -0,0 +1,86 @@
<script lang="ts" setup>
import useVuelidate from "@vuelidate/core";
const { required, email, validate } = useValidations();
const { login } = useAuthStore();
const { toSignup, toForgotPassword } = useRouteLocation();
interface State {
email?: string;
password?: string;
loading: boolean;
errorMessage?: string;
}
useHead({ title: "Login" });
const state: State = reactive({
email: "",
password: "",
loading: false,
errorMessage: undefined,
});
const v = useVuelidate<State>(
{ email: { required, email }, password: { required } },
state
);
const handleSubmit = async () => {
state.errorMessage = undefined;
try {
state.loading = true;
const res = await login({
username: state.email,
password: state.password,
});
} catch (error) {
state.errorMessage = getErrorMessage(error);
} finally {
state.loading = false;
}
};
</script>
<template>
<AuthContainer
title="Login"
description="Login to your account in order to access your display page."
>
<UForm
:state="state"
:validate="() => validate(v)"
class="form"
@submit="handleSubmit"
>
<UFormGroup label="Email" name="email">
<UInput v-model="state.email" />
</UFormGroup>
<UFormGroup label="Password" name="password">
<UInput type="password" v-model="state.password" />
</UFormGroup>
<UAlert
color="red"
:description="state.errorMessage"
title="Login Failed"
v-if="state.errorMessage"
>
</UAlert>
<UButton block type="submit" :loading="state.loading"> Login </UButton>
<UButton variant="outline" block type="button" :to="toSignup()">
Signup Instead
</UButton>
<UButton :to="toForgotPassword()" variant="link" :padded="false">
Forgot password ?
</UButton>
</UForm>
</AuthContainer>
</template>
<style scoped lang="scss">
.form {
@apply gap-4 flex flex-col;
}
</style>
+106
View File
@@ -0,0 +1,106 @@
<script lang="ts" setup>
import useVuelidate from "@vuelidate/core";
const { required, sameAs } = useValidations();
const { resetPassword } = useServices();
const { toLogin } = useRouteLocation();
const route = useRoute();
const token = computed(() => route.query.token as string);
const toast = useToast();
interface State {
password?: string;
confirmPassword?: string;
loading: boolean;
errorMessage?: string;
}
useHead({ title: "Login" });
const state: State = reactive({
password: "",
confirmPassword: "",
loading: false,
errorMessage: undefined,
});
const v = useVuelidate<State>(
computed(() => ({
password: { required },
confirmPassword: { sameAs: sameAs(state.password, "password") },
})),
state
);
const { getValidationAttrs } = useValidations(v);
const handleSubmit = async () => {
state.errorMessage = undefined;
const valid = await v.value.$validate();
if (!valid) return;
try {
state.loading = true;
const res = await resetPassword(
{
password: state.password,
},
token.value
);
toast.add({ title: "Your password has been successfully updated" });
return navigateTo(toLogin()?.path);
} catch (error) {
state.errorMessage = getErrorMessage(error);
} finally {
state.loading = false;
}
};
</script>
<template>
<AuthContainer title="Reset Password" description="Enter your new password">
<UForm :state="state" class="form" @submit="handleSubmit">
<UFormGroup
label="Password"
name="password"
:error="getValidationAttrs('password').error"
>
<UInput
type="password"
v-model="state.password"
@blur="getValidationAttrs('password').onBlur"
/>
</UFormGroup>
<UFormGroup
label="Confirm Password"
name="confirmPassword"
:error="getValidationAttrs('confirmPassword').error"
>
<UInput
type="password"
v-model="state.confirmPassword"
@blur="getValidationAttrs('confirmPassword').onBlur"
/>
</UFormGroup>
<UAlert
color="red"
:description="state.errorMessage"
title="Login Failed"
v-if="state.errorMessage"
>
</UAlert>
<UButton block type="submit" :loading="state.loading">
Change Password
</UButton>
</UForm>
</AuthContainer>
</template>
<style scoped lang="scss">
.form {
@apply gap-4 flex flex-col;
}
</style>
+94
View File
@@ -0,0 +1,94 @@
<script lang="ts" setup>
import useVuelidate from "@vuelidate/core";
useHead({
title: "Sign up",
});
const { required, email, sameAs, validate } = useValidations();
const { signup } = useAuthStore();
const { toLogin } = useRouteLocation();
const toast = useToast();
const state = reactive({
email: "",
password: "",
confirmPassword: "",
loading: false,
errorMessage: undefined,
});
const v = useVuelidate(
computed(() => ({
email: { required, email },
password: { required },
confirmPassword: { sameAs: sameAs(state.password, "password") },
})),
state
);
const handleSubmit = async () => {
state.errorMessage = undefined;
try {
state.loading = true;
await signup({
email: state.email,
username: state.email,
password: state.password,
});
toast.add({
title: "Signup Successfull",
description:
"Please follow the link sent to your email to verify your account.",
timeout: 8000,
});
} catch (error) {
state.errorMessage = getErrorMessage(error);
} finally {
state.loading = false;
}
};
</script>
<template>
<AuthContainer title="Signup">
<UForm
:state="state"
:validate="() => validate(v)"
class="form"
@submit="handleSubmit"
>
<UFormGroup label="Email" name="email">
<UInput v-model="state.email" />
</UFormGroup>
<UFormGroup label="Password" name="password">
<UInput type="password" v-model="state.password" />
</UFormGroup>
<UFormGroup label="Confirm Password" name="confirmPassword">
<UInput type="password" v-model="state.confirmPassword" />
</UFormGroup>
<UAlert
color="red"
:description="state.errorMessage"
title="Signup Failed"
v-if="state.errorMessage"
>
</UAlert>
<UButton block type="submit" :loading="state.loading">Sign up</UButton>
<UButton :to="toLogin()" block type="button" variant="outline">
Login Instead
</UButton>
</UForm>
</AuthContainer>
</template>
<style scoped lang="scss">
.form {
@apply gap-4 flex flex-col;
}
</style>
+63
View File
@@ -0,0 +1,63 @@
<script lang="ts" setup>
const { socials } = useAppConfig();
</script>
<template>
<div>
<div class="title">
<h5>Contact Us</h5>
</div>
<div class="socials">
<div class="item">
<UIcon name="i-heroicons-envelope-16-solid" class="icon"></UIcon>
<div class="item-title">Email</div>
<p>Email us directly</p>
<UButton variant="outline" class="mt-3" :to="`mailto:${socials.email}`">
{{ socials.email }}
</UButton>
</div>
<div class="item">
<UIcon name="i-mdi-twitter" class="icon"></UIcon>
<div class="item-title">Twitter</div>
<p>Follow us on Twitter</p>
<UButton
variant="outline"
class="mt-3"
:to="`https://twitter.com/${socials.twitter}`"
>
@{{ socials.twitter }}
</UButton>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.title {
@apply w-full py-14 flex items-center justify-center flex-col;
h5 {
@apply text-4xl font-bold;
}
}
.socials {
@apply flex justify-center;
.item {
@apply px-10 py-5 flex flex-col items-center gap-1;
.icon {
@apply text-5xl text-primary mb-4;
}
.item-title {
@apply text-xl font-medium;
}
p {
@apply text-center text-pale;
}
}
}
@media screen and (max-width: 600px) {
.socials {
@apply flex-col items-center;
}
}
</style>
@@ -0,0 +1,152 @@
<script setup lang="ts"></script>
<template>
<div class="m-4">
<div class="guide inner">
<h4 class="title">WALLET GUIDES</h4>
<div class="page">
<div class="how-to">
<p>
How to find the primary address and private view key (also known as
secret view key):
</p>
<h5>Cake Wallet:</h5>
<h6>
<UIcon name="i-mdi-arrow-right-thin" class="text-3xl" /> To get your
primary address:
</h6>
<ul>
<li>1. Click on "Receive"</li>
<li>2. Copy the address that begins with 4</li>
</ul>
<h6>
<UIcon name="i-mdi-arrow-right-thin" class="text-3xl" /> To get your
view key
</h6>
<ul>
<li>
1. Click on Settings
<span class="text-orange-500">-></span> Security and backup
<span class="text-orange-500">-></span> Show seed/keys
</li>
<li>2. Copy "View key (private)"</li>
</ul>
</div>
<div class="images">
<div>
<img
class="rounded-xl"
src="/images/kuno_view_key_cake.jpg"
alt=""
/>
</div>
</div>
</div>
</div>
<div class="guide inner">
<div class="page">
<div class="how-to">
<h5>GUI Wallet:</h5>
<ul>
<li>
1. Click on Settings <span class="text-orange-500">-></span> Seeds
& Keys
</li>
<li>2. Copy "Primary address" and "Secret view key"</li>
</ul>
</div>
<div class="images">
<div>
<img
class="rounded-xl"
src="/images/kuno_view_key_gui.jpg"
alt=""
/>
</div>
</div>
</div>
</div>
<div class="guide inner">
<div class="page">
<div class="how-to">
<h5>Feather Wallet:</h5>
<ul>
<li>
1. Click on Wallet <span class="text-orange-500">-></span> Keys
</li>
<li>2. Copy "Primary address" and "Secret view key"</li>
</ul>
</div>
<div class="images">
<div>
<img
class="rounded-xl"
src="/images/kuno_view_key_feather.jpg"
alt=""
/>
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.guide {
@apply p-8 bg-background-2 shadow-md rounded-xl mt-10;
.title {
@apply font-bold text-4xl mb-5 border-b border-border pb-4;
}
}
.page {
@apply flex gap-8 justify-between;
.how-to {
@apply w-[60%] flex flex-col gap-4;
p {
@apply text-lg;
}
h5 {
@apply font-bold text-xl;
}
h6 {
@apply text-lg text-pale flex items-center gap-1;
}
ul {
@apply flex gap-3 flex-col;
li {
@apply bg-background py-4 px-6 border-border border rounded-lg text-lg;
}
}
}
.images {
@apply w-[40%] flex justify-end;
}
}
@media screen and (max-width: 768px) {
.guide {
@apply p-5;
}
.page {
@apply flex gap-8 flex-col;
.how-to {
ul {
@apply flex gap-3 flex-col;
li {
@apply text-base;
}
}
}
.how-to,
.images {
@apply w-full;
}
.images {
justify-content: center;
}
}
}
</style>
+14
View File
@@ -0,0 +1,14 @@
<script lang="ts" setup>
useHead({
title: "Home",
});
</script>
<template>
<div class="inner">
<HomeHero />
<HomeFAQ />
</div>
</template>
<style scoped></style>
+9
View File
@@ -0,0 +1,9 @@
<script setup lang="ts">
definePageMeta({
middleware: ["logged-in"],
});
</script>
<template>
<NuxtPage />
</template>
+63
View File
@@ -0,0 +1,63 @@
<script lang="ts" setup>
import type { SlugReservationResponse } from "~/types";
const { toIndex } = useRouteLocation();
useHead({
title: "Create Page",
});
const links = computed(() => [
{
label: "Home",
icon: "i-heroicons-home",
to: toIndex(),
},
{
label: "Create Page",
icon: "i-heroicons-folder-plus-solid",
},
]);
const reservedData = ref<SlugReservationResponse | undefined>(undefined);
const reservedSlug = ref<string | undefined>(undefined);
const paymentModalActive = ref(false);
const handlePayment = (params: {
data: SlugReservationResponse;
slug?: string;
}) => {
reservedData.value = params.data;
reservedSlug.value = params.slug;
paymentModalActive.value = true;
};
const cancelPayment = () => {
paymentModalActive.value = false;
reservedData.value = undefined;
reservedSlug.value = undefined;
};
</script>
<template>
<div class="inner">
<div class="flex flex-col mt-5 md:mt-10">
<UBreadcrumb :links="links" />
<TitlePage
title="Create Page"
desciption="Get started by creating your streamer page"
/>
</div>
<StreamerModifyForm :editable="false" @done="handlePayment" />
</div>
<StreamerPaymentModal
:reservedData="reservedData"
:reservedSlug="reservedSlug"
v-model:active="paymentModalActive"
@cancel="cancelPayment"
/>
</template>
<style scoped lang="scss"></style>
+34
View File
@@ -0,0 +1,34 @@
<script lang="ts" setup>
const { toIndex } = useRouteLocation();
useHead({
title: "Edit Page",
});
const links = [
{
label: "Home",
icon: "i-heroicons-home",
to: toIndex(),
},
{
label: "Edit Page",
icon: "i-heroicons-folder-plus-solid",
},
];
</script>
<template>
<div>
<div class="inner">
<div class="flex flex-col mt-5 md:mt-10">
<UBreadcrumb :links="links" />
<TitlePage title="Edit Page" desciption="Customize your tip page." />
</div>
<StreamerModifyForm :editable="true" />
</div>
</div>
</template>
<style scoped lang="scss"></style>
+34
View File
@@ -0,0 +1,34 @@
<script lang="ts" setup>
useHead({
title: "Profile",
});
const { getMyPage } = useServices();
const { data, pending, refresh, error } = useLazyAsyncData(
"streamer-profile",
() => getMyPage(),
);
</script>
<template>
<div class="inner pt-4">
<PendingView :error="error" :pending="pending">
<div class="pt-4" v-if="!pending">
<div v-if="data">
<StreamerHeader
:slug="data.path"
actions
:logoId="data.logo"
:bannerId="data.cover_image"
class="mb-10"
/>
<StreamerTipsList :slug="data.path" />
</div>
<NoPageYet v-else />
</div>
</PendingView>
</div>
</template>
<style scoped lang="scss"></style>
+16
View File
@@ -0,0 +1,16 @@
import axios from "axios";
export default defineNuxtPlugin(() => {
const config = useRuntimeConfig();
const baseAxios = axios.create({
baseURL: config.public.apiBaseUrl,
withCredentials: true,
});
return {
provide: {
axios: baseAxios,
},
};
});
+44
View File
@@ -0,0 +1,44 @@
export default defineNuxtPlugin(() => {
// const authStore = useAuthStore();
const nuxtApp = useNuxtApp();
const runtimeConfig = useRuntimeConfig();
const headers = useRequestHeaders();
const devLoggedIn = useCookie("xmrchat-dev-logged-in");
nuxtApp.$axios.interceptors.request.use((config) => {
// set base url to 'backend:3000' when on production and server side
if (process.server && process.env.NODE_ENV === "production") {
config.baseURL = runtimeConfig.public.apiServerSideBaseUrl;
}
// set token on header for development ( reads from Authorization header )
// on production read from cookie
if (process.env.NODE_ENV === "development") {
config.headers.Authorization = devLoggedIn.value
? "Bearer 81w3b5wgftli23qhl3bqw5ik8djmbwza6sgvjrs3"
: "";
} else {
// @ts-ignore
if (headers) config.headers = headers;
}
return config;
});
nuxtApp.$axios.interceptors.response.use(
(res) => {
// API responds with error object when there is error but does not fail the request
const data = res.data;
if (!data || data.error) {
return Promise.reject({
message: data.error,
});
}
return res;
},
(error) => {
return Promise.reject(error);
}
);
});
+7
View File
@@ -0,0 +1,7 @@
export default defineNuxtPlugin(async () => {
const authStore = useAuthStore();
await useAsyncData(async () => {
return authStore.checkSession();
});
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg" width="433.499" height="329.456" viewBox="0 0 433.499 329.456">
<style>
svg text{
font-family:Arial
}
</style>
<g id="Not_Found" data-name="Not Found" transform="translate(-752.693 -2714.544)">
<path id="Path_905" data-name="Path 905" d="M6374.992,6253.579c-.242,4.858-.036,135.965-.036,135.965l15-7.247,13.271,7.247,13.04-7.247,12.266,7.247,13.167-7.247,12.349,7.247,13-7.247,12.194,7.247,13.232-7.247,12.992,7.247,12.715-7.247,14.381,7.247V6275.689l-26.767-26.767h-125.74S6375.233,6248.721,6374.992,6253.579Z" transform="translate(-5487 -3484)" fill="none" stroke="#e2e2e2" stroke-width="5"/>
<path id="Path_906" data-name="Path 906" d="M6505.862,6250.422v19.8s-1.04,5.419,5.419,5.419c5.5,0,16.238.609,18.622-.109.076.022,1.445-.765,1.215-.95-1.555-1.25-24.378-24.534-24.378-24.534Z" transform="translate(-5487 -3484)" fill="none" stroke="#e2e2e2" stroke-width="5"/>
<path id="Path_907" data-name="Path 907" d="M6432.609,6350.082s18.857-23,41.86,0" transform="translate(-5487 -3484)" fill="none" stroke="#e2e2e2" stroke-linecap="round" stroke-width="6"/>
<circle id="Ellipse_110" data-name="Ellipse 110" cx="9" cy="9" r="9" transform="translate(921 2812)" fill="#e2e2e2"/>
<circle id="Ellipse_111" data-name="Ellipse 111" cx="9" cy="9" r="9" transform="translate(994 2812)" fill="#e2e2e2"/>
<path id="Path_908" data-name="Path 908" d="M6532.972,6402.716l-15.387-7.99-12.825,7.99-13.338-7.99-11.957,7.99-12.786-7.99-13.588,7.99-12.247-7.99-12.814,7.99-12.29-7.99-13,7.99-13.109-7.99-14.65,7.99v53.441h152.66s5.165-.574,5.264-5.356S6532.972,6402.716,6532.972,6402.716Z" transform="translate(-5487 -3484)" fill="none" stroke="#e2e2e2" stroke-width="5"/>
<path id="Path_909" data-name="Path 909" d="M6374.874,6232.234l-10.947-30.492" transform="translate(-5487 -3484)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_910" data-name="Path 910" d="M6374.874,6232.234l-10.947-30.492" transform="matrix(0.914, -0.407, 0.407, 0.914, -7480.013, -342.844)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_911" data-name="Path 911" d="M6374.874,6232.234l-10.947-30.492" transform="translate(-8027.683 3335.398) rotate(-48)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_912" data-name="Path 912" d="M6306.292,6456.157h-64.1" transform="translate(-5487 -3484)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_913" data-name="Path 913" d="M6306.292,6456.157h-64.1" transform="translate(-5410 -3484)" fill="none" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_914" data-name="Path 914" d="M6305.34,6456.157h-63.147" transform="translate(-5436 -3497)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_915" data-name="Path 915" d="M6317.692,6456.157h-75.5" transform="translate(-5172 -3497)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_916" data-name="Path 916" d="M6342.917,6456.157H6242.193" transform="translate(-5159.226 -3484)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
<path id="Path_917" data-name="Path 917" d="M6254.419,6456.157h-12.226" transform="translate(-5184.226 -3484)" fill="#60656a" stroke="#e2e2e2" stroke-linecap="round" stroke-width="5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../.nuxt/tsconfig.server.json"
}
+84
View File
@@ -0,0 +1,84 @@
import type { User } from "~/types";
interface State {
isLoggedIn: boolean;
user?: User;
}
export const useAuthStore = defineStore("auth", () => {
const { toStreamerDisplay, toIndex } = useRouteLocation();
const {
checkSession: checkSessionApi,
login: loginApi,
signup: signupApi,
logout: logoutApi,
} = useServices();
const state: State = reactive({
isLoggedIn: false,
user: undefined,
});
const checkSession = async () => {
try {
const res = await checkSessionApi();
if (res.authenticated) {
state.isLoggedIn = true;
state.user = res.user;
} else {
state.isLoggedIn = false;
state.user = undefined;
}
console.log(res);
return res;
} catch (error) {
// @ts-ignore
console.log("error checking session", error?.response);
}
};
const afterAuth = async () => {
await checkSession();
return navigateTo(toStreamerDisplay()?.path);
};
const login = async (params: { username?: string; password?: string }) => {
await loginApi(params);
await afterAuth();
};
const signup = async (params: {
username?: string;
password?: string;
email?: string;
}) => {
await signupApi(params);
await afterAuth();
};
const logout = async () => {
try {
await logoutApi();
} catch (error) {
} finally {
await checkSession();
return navigateTo(toIndex()?.path);
}
};
const isLoggedIn = computed(() => state.isLoggedIn);
const userEmail = computed(() => state.user?.email);
return {
state,
checkSession,
isLoggedIn,
userEmail,
login,
signup,
logout
};
});
+17
View File
@@ -0,0 +1,17 @@
import type { Config } from "tailwindcss";
import colors from "tailwindcss/colors";
export default <Partial<Config>>{
theme: {
extend: {
// Nuxt UI generates primary color key. modified on @/assets/style/main.scss
colors: {
border: "rgba(var(--color-border), <alpha-value>)",
pale: "rgba(var(--color-pale), <alpha-value>)",
text: "rgba(var(--color-text-default), <alpha-value>)",
background: "rgba(var(--color-background), <alpha-value>)",
"background-2": "rgba(var(--color-background-2), <alpha-value>)",
},
},
},
};
+4
View File
@@ -0,0 +1,4 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
}
+90
View File
@@ -0,0 +1,90 @@
export type Numberic = string | number;
export interface LoginResponse {
user_id: string;
}
export interface MeResponse {
authenticated: boolean;
user?: User;
}
export interface User {
username: string;
email: string;
id: string;
}
export interface CreateFormFields {
adult?: boolean;
logo?: string;
cover_image?: string;
payment_address?: string;
view_key?: string;
slug?: string;
tiers?: TipTierField[];
}
export interface TipFormFields {
private?: boolean;
name?: string;
message?: string;
amount?: any;
}
export interface SlugReservationResponse {
payment_address: string;
amount: number;
reservation_timestamp: number;
}
export interface TipCreationResponse {
amount: string;
id: string;
payment_address: string;
}
export interface StreamerPage {
user_id: string;
id: string;
name: string;
path: string;
logo: string;
cover_image: string;
adult: boolean;
payment_address?: string;
view_key?: string;
tiers?: TipTier[];
}
export interface Tip {
id: string;
page_id: string;
tier_id?: string;
name: string;
amount: string;
message: string;
private?: boolean;
paid?: boolean;
paid_at?: string;
}
export interface TipTier {
amount: string;
name?: string;
id: string;
}
export interface TipTierField {
name?: string;
price?: string;
}
export interface PaymentSocketMessage {
data: {
type: string;
tip?: { paid?: boolean };
page?: { paid?: boolean };
};
error?: any;
}
+2
View File
@@ -0,0 +1,2 @@
export * from "./general";
export * from "./popup";
+15
View File
@@ -0,0 +1,15 @@
import type { Numberic } from "./general";
export type PopupKey = "confirm";
export interface BasePopupContext {
title?: string;
onDone?: () => any;
}
export interface ConfirmContext extends BasePopupContext {
text?: string;
onAccept?: (params: { loading: Ref<boolean> }) => Promise<void>;
title?: string;
color?: string;
}
+10
View File
@@ -0,0 +1,10 @@
export const getErrorMessage = (error?: any) => {
if (!error) return undefined;
if (error.response?.data?.error) return error.response?.data?.error;
if (error.message) return error.message;
return undefined;
};
export const getProperty = (obj: any, path: string): any => {
return path.split(".").reduce((prev, curr) => prev && prev[curr], obj);
};