review (solid version) (pun intented)

This commit is contained in:
amy 2024-08-04 09:46:51 +03:30
parent 56fa987021
commit 4adf257cbf
7 changed files with 153 additions and 5 deletions

45
review/App.tsx Normal file
View file

@ -0,0 +1,45 @@
import '../src/App.css'
import "./reviewed.css"
import { sendReview } from '../src/components/api'
export default function App() {
const token = window.location.hash.substring(window.location.hash.indexOf("access_token") + "access_token".length + 1).substring(0, 30)
let ref!: HTMLTextAreaElement;
return <div class='reviewOuterparent'>
<div class='reviewParent'>
<textarea
ref={ref}
onKeyPress={async (e) => {
if (e.key === "Enter") {
e.preventDefault()
if (await sendReview(ref.value, token)) {
alert("review sent!")
} else {
alert("something went wrong, check your network tab or something idfk")
}
}
}}
placeholder='your shitty review'
class='reviewText'
name="" id="" cols="25" rows="3">
</textarea>
<div class='flexButton'>
<button onclick={async () => {
try {
const success = await sendReview(ref.value, token);
if (success) {
alert("Review sent successfully!");
} else {
alert("Failed to send review. open your browser's network tab for more info lmao");
}
} catch (error) {
alert("how");
}
}} class='sendButton'>send yo shi</button>
</div>
</div>
</div>
}

20
review/index.html Normal file
View file

@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="https://dp.nea.moe/avatar/712639419785412668.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ehco</title>
<meta content="review" property="og:title" />
<meta content="rewviewdb, but not turkish" property="og:description" />
<meta content="https://dp.nea.moe/avatar/712639419785412668.png" property="og:image" />
<meta content="#43B581" data-react-helmet="true" name="theme-color" />
</head>
<body>
<div id="reviewroot"></div>
<script type="module" src="./index.tsx"></script>
</body>
</html>

11
review/index.tsx Normal file
View file

@ -0,0 +1,11 @@
import { render } from 'solid-js/web'
import App from './App'
const root = document.getElementById('reviewroot')
render(() => (
<>
<App />
</>
), root!)

53
review/reviewed.css Normal file
View file

@ -0,0 +1,53 @@
textarea {
resize: none;
}
.parent {
height: 100%;
/* just */
}
.reviewOuterparent {
height: 90vh;
display: flex;
flex-direction: row;
justify-content: space-around;
}
.reviewText {
color: pink;
margin-bottom: 10%;
font-size: xx-large;
background-color: #1e1e1e;
font-family: monospace;
outline: none;
border: none;
text-align: center;
display: flex;
align-items: center;
}
.reviewParent {
display: flex;
/* background-color: ; */
flex-direction: column;
justify-content: center;
}
.sendButton {
color: pink;
background-color: #0a0a0a;
font-size: 19px;
border: 2px solid #0a0a0a;
padding: 15px 50px;
cursor: pointer
}
.sendButton:hover {
background-color: #2c2c2c;
border: 2px solid #2c2c2c;
}
.flexButton {
display: flex;
justify-content: center;
}

View file

@ -85,7 +85,7 @@ function App() {
<img onClick={() => { <img onClick={() => {
setanimatedwoem(true) setanimatedwoem(true)
setTimeout(() => { setTimeout(() => {
window.location.href = "https://woem.men/@exhq" window.location.href = "https://woem.men/@echo"
}, 200); }, 200);
}} classList={{ 'woemimg': true, 'animate': animatedwoem() }} src="https://woem.men/files/356134d8-df3b-41dc-ac73-c4420442bf3a" alt="LMAO IMAGINE BEING BLIND" /> }} classList={{ 'woemimg': true, 'animate': animatedwoem() }} src="https://woem.men/files/356134d8-df3b-41dc-ac73-c4420442bf3a" alt="LMAO IMAGINE BEING BLIND" />
</div> </div>

View file

@ -44,7 +44,7 @@ export default function Reviews() {
<> <>
<a style={{ <a style={{
display: ishover() ? "inline" : "none" display: ishover() ? "inline" : "none"
}} href="https://discord.com/oauth2/authorize?client_id=1208380910525743134&response_type=token&redirect_uri=https%3A%2F%2Freview.exhq.dev%2F&scope=identify"> }} href="https://discord.com/oauth2/authorize?client_id=1208380910525743134&response_type=token&redirect_uri=https%3A%2F%2Fexhq.dev%2Freview%2F&scope=identify">
<p>add your reviews here</p> <p>add your reviews here</p>
</a> </a>
<h1 class="reviewheadertext">Reviews</h1> <h1 class="reviewheadertext">Reviews</h1>
@ -75,3 +75,22 @@ function SingleReview(props: NeoReview) {
</div> </div>
</div> </div>
} }
export async function sendReview(review: string, token: string): Promise<boolean> {
try {
const response = await fetch(`https://api.review.exhq.dev/sendreview?review=${review}`, {
headers: {
"Auth": token,
},
method: "POST"
});
if (response.status !== 200) {
return false;
}
return true;
} catch (error) {
return false;
}
}

View file

@ -24,5 +24,5 @@
"noUnusedParameters": true, "noUnusedParameters": true,
"noFallthroughCasesInSwitch": true "noFallthroughCasesInSwitch": true
}, },
"include": ["src", "hacked"] "include": ["src", "hacked", "review"]
} }