Skip to content

Commit

Permalink
Removing randomize machine
Browse files Browse the repository at this point in the history
  • Loading branch information
orchestr7 committed Sep 12, 2024
1 parent fc557b0 commit dcde805
Show file tree
Hide file tree
Showing 14 changed files with 93 additions and 166 deletions.
5 changes: 4 additions & 1 deletion backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ spring:
servlet:
SecurityAutoConfiguration


server:
port : 8081

telegram:
bot:
token:
12345:mybottesttoken

14 changes: 13 additions & 1 deletion common/src/commonMain/kotlin/ru/posidata/common/Resources.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum class Resources(
FEEBAS(22, "A Water-type Pokémon that is often seen as unattractive, but evolves into the beautiful Milotic.", POKEMON),

// BigData
// phase 1
HADOOP(23, "Framework that allows for the distributed processing of large data sets across clusters using programming models.", BIG_DATA),
FLINK(24, "A stream processing framework that processes data in real time and is known for its low-latency performance.", BIG_DATA),
HIVE(25, "A data warehouse infrastructure built on top of Hadoop, enabling users to perform queries on large datasets.", BIG_DATA),
Expand All @@ -60,7 +61,18 @@ enum class Resources(
ARVADOS(41, "An open-source platform for managing and analyzing large-scale genomic and biomedical data.", BIG_DATA),
GEODE(42, "An open-source, distributed data management platform designed for high performance real-time data access and analytics.", BIG_DATA),
ADABAS(43, "A high-performance, transactional database management system designed to handle large volumes of data.", BIG_DATA),
ICEBERG(44, "An open table format for large analytic datasets that enables high-performance reads/writes and supports schema evolution.", BIG_DATA) ;
ICEBERG(44, "An open table format for large analytic datasets that enables high-performance reads/writes and supports schema evolution.", BIG_DATA),
// phase 2
KUDU(45, "A distributed, columnar storage engine optimized for fast analytics on large datasets, designed for integration with Hadoop.", BIG_DATA),
DRUID(46, "A real-time analytics database designed for fast slice-and-dice queries on large, high-dimensional data.", BIG_DATA),
LUIGI(47, "A Python-based workflow management system used to build complex pipelines of batch jobs.", BIG_DATA),
MILVUS(48, "An open-source vector database designed to manage, search, and index massive embedding vectors.", BIG_DATA),
WEAVIATE(49, "An open-source vector search engine and graph database designed for machine learning and semantic search.", BIG_DATA),
PAIMON(50, "A high-performance streaming table store for large-scale real-time data processing.", BIG_DATA),
DORIS(51, "An MPP-based interactive SQL data warehouse that provides sub-second query responses on large datasets.", BIG_DATA),
LANCE(52, "A data format and query engine designed for fast machine learning and analytics workflows with efficient version control.", BIG_DATA),
NIMBLE(53, "A lightweight, flexible, and scalable in-memory computing platform designed for real-time analytics.", BIG_DATA);
;

companion object {
fun getById(i: Int): Resources = Resources.entries.find { it.id == i }!!
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/jsMain/kotlin/ru/posidata/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ val App: FC<Props> = FC {
path = "/"
element = mainView.create()
errorElement = errorBoundary.create()
},
jso {
path = "/luckydraw"
element = luckyDrawCard.create()
errorElement = errorBoundary.create()
}
)
)
Expand All @@ -46,16 +41,13 @@ val App: FC<Props> = FC {

fun main() {
/* Workaround for issue: https://youtrack.jetbrains.com/issue/KT-31888 */
@Suppress("UnsafeCastFromDynamic")
if (window.asDynamic().__karma__) {
return
}
// this is needed for webpack to include resources
kotlinext.js.require<dynamic>("../scss/app.scss")
// this is needed for webpack to include bootstrap
kotlinext.js.require<dynamic>("bootstrap")
/* ReactModal.setAppElement(document.getElementById("wrapper") as HTMLElement) // required for accessibility in react-modal */

val mainDiv = document.getElementById("wrapper") as HTMLElement
createRoot(mainDiv).render(App.create())
}
181 changes: 67 additions & 114 deletions frontend/src/jsMain/kotlin/ru/posidata/views/main/MainView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package ru.posidata.views.main

import js.objects.jso
import react.*
import react.dom.html.ReactHTML
import react.dom.html.ReactHTML.button
import react.dom.html.ReactHTML.div
import ru.posidata.common.Answer.NONE
import ru.posidata.common.Selection
Expand All @@ -16,8 +14,6 @@ import ru.posidata.common.UserForSerializationDTO
import web.cssom.*

val mainView = FC {
val (luckyDraw, setLuckyDraw) = useState(false)

Particles::class.react {
id = "tsparticles"
url = "${kotlinx.browser.window.location.origin}/particles.json"
Expand All @@ -31,137 +27,94 @@ val mainView = FC {
val (user, setUser) = useState<UserForSerializationDTO?>(null)
val (tgUser, setTgUser) = useState<UserDataFromTelegram?>(null)

if (!luckyDraw) {
div {
className = ClassName("full-width-container")
div {
className = ClassName("full-width-container")
className = ClassName("row justify-content-center align-items-center")
style = jso {
minHeight = "100vh".unsafeCast<MinHeight>()
}

div {
className = ClassName("row justify-content-center align-items-center")
id = "back"
className = ClassName("card col-xl-4 col-lg-5 col-md-7 col-sm-8 col-12")
style = jso {
minHeight = "100vh".unsafeCast<MinHeight>()
minHeight = "80vh".unsafeCast<MinHeight>()
borderRadius = "40px 40px 40px 40px".unsafeCast<BorderRadius>()
boxShadow = "10px 10px 20px rgba(0, 0, 0, 0.5)".unsafeCast<BoxShadow>()
}

headerRow {}

div {
id = "back"
className = ClassName("card col-xl-4 col-lg-5 col-md-7 col-sm-8 col-12")
className = ClassName("row justify-content-center text-white mt-3 ")
style = jso {
minHeight = "80vh".unsafeCast<MinHeight>()
borderRadius = "40px 40px 40px 40px".unsafeCast<BorderRadius>()
boxShadow = "10px 10px 20px rgba(0, 0, 0, 0.5)".unsafeCast<BoxShadow>()
zIndex = "1000".unsafeCast<ZIndex>()
minHeight = "53vh".unsafeCast<MinHeight>()
display = Display.flex
}

headerRow {}

div {
className = ClassName("row justify-content-center text-white mt-3 ")
style = jso {
zIndex = "1000".unsafeCast<ZIndex>()
minHeight = "53vh".unsafeCast<MinHeight>()
display = Display.flex
}
if (user != null && user.gameNumber() == 4) {
ReactHTML.h6 {
className = ClassName("mb-2 text-white mx-2")
+"Ты отыграл уже три раза, в рейтинге участвовать больше не получится, обнови страницу если хочешь просто пройти тест. Твои результаты:"

when (selection) {
Selection.NONE -> {
welcomeCard {
this.setSelection = setSelection
this.setUser = setUser
this.tgUser = tgUser
this.setTgUser = setTgUser
}
ReactHTML.h6 {
className = ClassName("mb-2 text-center")
style = jso {
color = "yellow".unsafeCast<Color>()
}
+"${user.firstGameScore}/12"
}
ReactHTML.h6 {
className = ClassName("mb-2 text-center")
style = jso {
color = "yellow".unsafeCast<Color>()
}
+"${user.firstGameScore}/12"
}
ReactHTML.h6 {
className = ClassName("mb-2 text-center")
style = jso {
color = "yellow".unsafeCast<Color>()
}
+"${user.thirdGameScore}/12"
}
} else {
when (selection) {
Selection.NONE -> {
welcomeCard {
this.setSelection = setSelection
this.setUser = setUser
this.tgUser = tgUser
this.setTgUser = setTgUser
}
}

QUESTION -> questionCard {
this.counter = counter
this.setCounter = setCounter
this.answers = answers
this.setAnswers = setAnswers
this.setPokemonId = setPokemonId
this.pokemonId = pokemonId
this.setSelection = setSelection
this.uniqueRandom = uniqueRandom
this.setUniqueRandom = setUniqueRandom

this.user = user
this.tgUser = tgUser
this.setUser = setUser
}

ANSWER -> {
answerCard {
this.setSelection = setSelection
this.counter = counter
this.pokemonId = pokemonId
this.answers = answers
}
}
}

RESULTS -> {
resultCard {
this.counter = counter
this.answers = answers
this.setSelection = setSelection
this.setCounter = setCounter
this.setAnswers = setAnswers
this.setUniqueRandom = setUniqueRandom
this.setSelection = setSelection
QUESTION -> questionCard {
this.counter = counter
this.setCounter = setCounter
this.answers = answers
this.setAnswers = setAnswers
this.setPokemonId = setPokemonId
this.pokemonId = pokemonId
this.setSelection = setSelection
this.uniqueRandom = uniqueRandom
this.setUniqueRandom = setUniqueRandom

this.user = user
this.tgUser = tgUser
this.setUser = setUser
}

this.user = user
this.tgUser = tgUser
this.setUser = setUser
}
}
ANSWER -> {
answerCard {
this.setSelection = setSelection
this.counter = counter
this.pokemonId = pokemonId
this.answers = answers
}
}
}

if (selection != Selection.NONE) {
progressBar {
this.counter = counter
this.selection = selection
this.answers = answers
RESULTS -> {
resultCard {
this.counter = counter
this.answers = answers
this.setSelection = setSelection
this.setCounter = setCounter
this.setAnswers = setAnswers
this.setUniqueRandom = setUniqueRandom
this.setSelection = setSelection

this.user = user
this.tgUser = tgUser
this.setUser = setUser
}
}
}
}

button {
className = ClassName("btn btn-outline-info btn-lg")
onClick = {
setLuckyDraw(true)
}
+"Розыгрыш"
if (selection != Selection.NONE) {
progressBar {
this.counter = counter
this.selection = selection
this.answers = answers
}
}
}
}
} else {
luckyDrawCard {

}
}
}

51 changes: 9 additions & 42 deletions frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,12 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
response.ok -> {
props.setUser(response.decodeFromJsonString<UserForSerializationDTO>())
}
else -> window.alert("Failed to validate with telegram")
else -> window.alert("Failed to authorize you with telegram")
}
}
props.setSelection(Selection.QUESTION)
}

// just a small test
/*
div {
button {
onClick = {
console.log(props.tgUser)
getUser()
}
}
}
div {
button {
onClick = {
val feUser = UserDataFromTelegram(
authDate = 1725741859,
firstName = "Андрей",
lastName = "Кулешов",
hash = "4a8cb14838a9797d8994bf73ac9734e3fd634a5abec5be7371f83737d1dc82e8",
id = 221298772,
photoUrl = "https://t.me/i/userpic/320/d3fKyG306aXHDBCxZXfWTpGlii6fZqZMo1tBmMPEl_E.jpg",
username = "akuleshov7",
)
props.setTgUser(feUser)
}
}
}
*/


div {
className = ClassName("row justify-content-center mt-1 px-0")
div {
Expand All @@ -92,7 +62,7 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
display = "inline".unsafeCast<Display>()
color = "rgb(0, 206, 224)".unsafeCast<Color>()
}
+" или "
+" or "
}
h1 {
style = jso {
Expand All @@ -104,34 +74,31 @@ val welcomeCard = FC<WelcomeCardProps> { props ->
}

h6 {
// (https://docs.google.com/a/octo.com/forms/d/1kckcq_uv8dk9-W5rIdtqRwCHN4Uh209ELPUjTEZJDxc/viewform)
// (https://github.com/pixelastic/pokemonorbigdata)
className = ClassName("mt-3 mb-3 text-start")
+("Шуточный тест из 12 вопросов, сделаный за пару ночей, чтобы показать " +
"насколько большой зоопарк из названий образовался в дате. " +
"Изначальная идея родилась "
+("A humorous test of 12 questions, made over a couple of nights to show just how large a zoo of names " +
"has formed in the Big Data world. The original idea was born "
)
a {
href =
"https://docs.google.com/forms/d/e/1FAIpQLScRsfRHXPTuEXdNvUcI8DzJIU5iazqlpksWucPF0d8l2ztkkA/viewform"
className = ClassName("text-info")
+"тут"
+"here"
}

+" и "
+" and "

a {
href = "https://pixelastic.github.io/pokemonorbigdata/"
className = ClassName("text-info")
+"тут"
+"here"
}

+" Иходный код этого сайта открыт "
+" The source code of this site can be found on the "

a {
href = "https://github.com/orchestr7/PokemonOrBigData"
className = ClassName("text-info")
+"здесь"
+"GitHub"
}

+". ${if (props.tgUser == null) "Чтобы участвовать в розыгрыше и рейтинге - залогинься:" else ""}"
Expand Down
Binary file added frontend/src/jsMain/resources/img/Lets_start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit dcde805

Please sign in to comment.