diff --git a/README.md b/README.md index 0586c62..1f6dead 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ -# Важно -Сделано за 3 ночи 1 человеком, который был и швец, и жнец, и на дуде игрец. И девопс, и бэкендер и фронтендер. -Спасибо ChatGpt и моей маме. +# Pokemon or BigData +This full-stack Kotlin app is a humorous test of 12 questions, made over a couple of nights to illustrate how large a zoo of names has formed in the Big Data world. +The original idea was born [here](https://docs.google.com/forms/d/e/1FAIpQLScRsfRHXPTuEXdNvUcI8DzJIU5iazqlpksWucPF0d8l2ztkkA/viewform) and [here](https://pixelastic.github.io/pokemonorbigdata/). -# Покемон Или BigData +# How to +### Internals +-- frontend: React application powered by KotlinJS +-- backend: Spring Boot application powered by KotlinJVM -Шутливое приложение, которое показывает, насколько огромный зоопарк из названий образовался в дате. -Оригинальная идея и отсылки к [этой форме](https://docs.google.com/a/octo.com/forms/d/1kckcq_uv8dk9-W5rIdtqRwCHN4Uh209ELPUjTEZJDxc/viewform) и к [этому](https://github.com/pixelastic/pokemonorbigdata) проекту. - - -### How to +### Build and run 1) Build: `./gradlew build` -2) Run locally: `./gradlew frontend:jsBrowserDevelopmentRun` +2) Run backend locally: `./gradlew backend:bootRun` + +3) Run frontend locally: `./gradlew frontend:jsBrowserDevelopmentRun` -### Runbook -We are using deploy-gh action, which will build the project in gh-pages branch. -To configure it do: +### Deployment +We are using deploy-gh action, which will build the frontend in `gh-pages` branch (without resources and images included). +To configure it do the following: ``` If you do not supply the action with an access token or an SSH key, you must access your repositories settings and provide Read and Write Permissions to the provided GITHUB_TOKEN, otherwise you'll potentially run into permission issues. Alternatively you can set the following in your workflow file to grant the action the permissions it needs. ``` diff --git a/frontend/src/jsMain/kotlin/ru/posidata/views/main/AnswerCard.kt b/frontend/src/jsMain/kotlin/ru/posidata/views/main/AnswerCard.kt index d681fd2..01cb1a4 100644 --- a/frontend/src/jsMain/kotlin/ru/posidata/views/main/AnswerCard.kt +++ b/frontend/src/jsMain/kotlin/ru/posidata/views/main/AnswerCard.kt @@ -36,7 +36,7 @@ val answerCard = FC { props -> style = jso { display = "inline".unsafeCast() } - +"${pokemon.getName()} - это " + +"${pokemon.getName()} - is from " } h2 { style = jso { @@ -44,7 +44,7 @@ val answerCard = FC { props -> color = "yellow".unsafeCast() display = "inline".unsafeCast() } - +(if (pokemon.type == BIG_DATA) "из БигДаты!" else "Pokémon!") + +(if (pokemon.type == BIG_DATA) "BigData!" else "Pokémon!") } } } @@ -94,12 +94,12 @@ val answerCard = FC { props -> className = ClassName("btn btn-outline-info") if (props.counter < props.answers.size) { - +"Следующий вопрос" + +"Next question" onClick = { props.setSelection(QUESTION) } } else { - +"Результаты" + +"Your results" onClick = { props.setSelection(RESULTS) } diff --git a/frontend/src/jsMain/kotlin/ru/posidata/views/main/QuestionCard.kt b/frontend/src/jsMain/kotlin/ru/posidata/views/main/QuestionCard.kt index 3b432c2..195f9db 100644 --- a/frontend/src/jsMain/kotlin/ru/posidata/views/main/QuestionCard.kt +++ b/frontend/src/jsMain/kotlin/ru/posidata/views/main/QuestionCard.kt @@ -151,7 +151,7 @@ val questionCard = FC { props -> display = "inline".unsafeCast() color = "rgb(0, 206, 224)".unsafeCast() } - +" или " + +" or " } h1 { onClick = { diff --git a/frontend/src/jsMain/kotlin/ru/posidata/views/main/ResultCard.kt b/frontend/src/jsMain/kotlin/ru/posidata/views/main/ResultCard.kt index 618df6c..05b21f5 100644 --- a/frontend/src/jsMain/kotlin/ru/posidata/views/main/ResultCard.kt +++ b/frontend/src/jsMain/kotlin/ru/posidata/views/main/ResultCard.kt @@ -26,7 +26,7 @@ import web.cssom.* val resultCard = FC { props -> val correctAnswers = props.answers.count { it == CORRECT } - var (loading, setLoading) = useState(true) + val (loading, setLoading) = useState(true) val updateRound = useDeferredRequest { if (props.tgUser != null) { @@ -66,13 +66,15 @@ val resultCard = FC { props -> h1 { className = ClassName("text-center") style = jso { + fontSize = 50.unsafeCast() color = "yellow".unsafeCast() display = "inline".unsafeCast() } +"$correctAnswers" } - h2 { + h1 { style = jso { + fontSize = 35.unsafeCast() color = "white".unsafeCast() display = "inline".unsafeCast() } @@ -80,10 +82,10 @@ val resultCard = FC { props -> } val textMeme = when (correctAnswers) { - in 0..4 -> Pair("А ты точно пришел на SmartData?", "areyousure.png") - in 5..8 -> Pair("Тебе надо поисследовать мир Даты (и Покемонов)", "choose-you.webp") - in 9..11 -> Pair("Ты хорош, но не идеален", "choose-you.webp") - 12 -> Pair("Я выбираю тебя!", "choose-you.webp") + in 0..4 -> Pair("Are you related to IT?", "areyousure.png") + in 5..8 -> Pair("You need to learn more about the world of Data (and Pokemons)", "end.jpeg") + in 9..11 -> Pair("You are good, but not the best", "end.jpeg") + 12 -> Pair("I choose you!", "choose-you.webp") else -> Pair("", "") } @@ -121,7 +123,7 @@ val resultCard = FC { props -> props.setUniqueRandom(listOf()) updateRound() } - +"Еще раз!" + +"Once more!" } } div { diff --git a/frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt b/frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt index f98ed24..ae3b0ac 100644 --- a/frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt +++ b/frontend/src/jsMain/kotlin/ru/posidata/views/main/Welcome.kt @@ -38,6 +38,7 @@ val welcomeCard = FC { props -> response.ok -> { props.setUser(response.decodeFromJsonString()) } + else -> window.alert("Failed to authorize you with telegram") } } @@ -75,7 +76,7 @@ val welcomeCard = FC { props -> h6 { className = ClassName("mt-3 mb-3 text-start") - +("A humorous test of 12 questions, made over a couple of nights to show just how large a zoo of names " + + +("A humorous test of 12 questions, made over a couple of nights to illustrate how large a zoo of names " + "has formed in the Big Data world. The original idea was born " ) a { @@ -93,7 +94,7 @@ val welcomeCard = FC { props -> +"here" } - +" The source code of this site can be found on the " + +". The source code of this site can be found on the " a { href = "https://github.com/orchestr7/PokemonOrBigData" @@ -101,14 +102,14 @@ val welcomeCard = FC { props -> +"GitHub" } - +". ${if (props.tgUser == null) "Чтобы участвовать в розыгрыше и рейтинге - залогинься:" else ""}" + +". ${if (props.tgUser == null) "If you wish to share your results - you can register with Telegram using the button below:" else ""}" } if (props.tgUser == null) { TLoginButton { botName = "PosiDataBot" - buttonSize = "large" + buttonSize = "small" redirectUrl = null cornerRadius = 15.0 requestAccess = "write" @@ -135,17 +136,28 @@ val welcomeCard = FC { props -> style = jso { color = "yellow".unsafeCast() } - +"Привет, ${props.tgUser?.username}! Теперь ты участвуешь в розыгрыше на SmartData. Если захочешь просто поиграть - обнови страницу." + +"Hello, ${props.tgUser?.username}! Now your results are being recorded, if you don't want this - just refresh the page." + } + } + + img { + className = + ClassName("mt-1 mb-2") + src = "img/pokemon-vs-data.jpeg" + style = jso { + width = "100%".unsafeCast() + borderRadius = "2px 2px 2px 2px".unsafeCast() + boxShadow = "10px 10px 20px rgba(0, 0, 0, 0.5)".unsafeCast() } } img { className = - ClassName("animate__animated animate__shakeX mt-1 border border-info border-5 img-glow3 mb-3") - src = "img/pokemonVSBigData.jpeg" + ClassName("animate__animated animate__shakeX border border-info border-4 img-glow3 mb-3") + src = if (props.tgUser == null) "img/lets-start.png" else "img/lets-start-registered.png" style = jso { width = "100%".unsafeCast() - borderRadius = "20px 20px 20px 20px".unsafeCast() + borderRadius = "15px 15px 15px 15px".unsafeCast() boxShadow = "10px 10px 20px rgba(0, 0, 0, 0.5)".unsafeCast() cursor = "pointer".unsafeCast() } diff --git a/frontend/src/jsMain/resources/img/Lets_start.png b/frontend/src/jsMain/resources/img/Lets_start.png deleted file mode 100644 index b6bc8ed..0000000 Binary files a/frontend/src/jsMain/resources/img/Lets_start.png and /dev/null differ diff --git a/frontend/src/jsMain/resources/img/bigdata/DORIS-min.png b/frontend/src/jsMain/resources/img/bigdata/DORIS-min.png new file mode 100644 index 0000000..4a19052 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/DORIS-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/DRUID-min.png b/frontend/src/jsMain/resources/img/bigdata/DRUID-min.png new file mode 100644 index 0000000..95f1c4e Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/DRUID-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/KUDU-min.png b/frontend/src/jsMain/resources/img/bigdata/KUDU-min.png new file mode 100644 index 0000000..97a0332 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/KUDU-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/KUDU.png b/frontend/src/jsMain/resources/img/bigdata/KUDU.png new file mode 100644 index 0000000..97a0332 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/KUDU.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/LANCE-min.png b/frontend/src/jsMain/resources/img/bigdata/LANCE-min.png new file mode 100644 index 0000000..d51bbb1 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/LANCE-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/LUIGI-min.png b/frontend/src/jsMain/resources/img/bigdata/LUIGI-min.png new file mode 100644 index 0000000..1bfad75 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/LUIGI-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/MILVUS-min.png b/frontend/src/jsMain/resources/img/bigdata/MILVUS-min.png new file mode 100644 index 0000000..3037695 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/MILVUS-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/NIMBLE-min.png b/frontend/src/jsMain/resources/img/bigdata/NIMBLE-min.png new file mode 100644 index 0000000..bb181af Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/NIMBLE-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/PAIMON-min.png b/frontend/src/jsMain/resources/img/bigdata/PAIMON-min.png new file mode 100644 index 0000000..e2d3190 Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/PAIMON-min.png differ diff --git a/frontend/src/jsMain/resources/img/bigdata/WEAVIATE-min.png b/frontend/src/jsMain/resources/img/bigdata/WEAVIATE-min.png new file mode 100644 index 0000000..b305f9e Binary files /dev/null and b/frontend/src/jsMain/resources/img/bigdata/WEAVIATE-min.png differ diff --git a/frontend/src/jsMain/resources/img/lets-start-registered.png b/frontend/src/jsMain/resources/img/lets-start-registered.png new file mode 100644 index 0000000..605a4f0 Binary files /dev/null and b/frontend/src/jsMain/resources/img/lets-start-registered.png differ diff --git a/frontend/src/jsMain/resources/img/lets-start.png b/frontend/src/jsMain/resources/img/lets-start.png new file mode 100644 index 0000000..68b4576 Binary files /dev/null and b/frontend/src/jsMain/resources/img/lets-start.png differ diff --git a/frontend/src/jsMain/resources/img/pokemon-vs-data.jpeg b/frontend/src/jsMain/resources/img/pokemon-vs-data.jpeg new file mode 100644 index 0000000..4c49ab2 Binary files /dev/null and b/frontend/src/jsMain/resources/img/pokemon-vs-data.jpeg differ diff --git a/frontend/src/jsMain/resources/img/pokemonVSBigData.jpeg b/frontend/src/jsMain/resources/img/pokemonVSBigData.jpeg deleted file mode 100644 index 034b75c..0000000 Binary files a/frontend/src/jsMain/resources/img/pokemonVSBigData.jpeg and /dev/null differ