Skip to content

Commit

Permalink
Source format and optimized imports
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanOltmann committed Oct 22, 2024
1 parent 7258478 commit 63925a8
Show file tree
Hide file tree
Showing 21 changed files with 409 additions and 52 deletions.
25 changes: 24 additions & 1 deletion app/src/commonMain/kotlin/model/WorldTrait.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,30 @@ package model

import androidx.compose.ui.graphics.Color
import kotlinx.serialization.Serializable
import oni_seed_browser.app.generated.resources.*
import oni_seed_browser.app.generated.resources.Res
import oni_seed_browser.app.generated.resources.worldTraitBouldersLarge
import oni_seed_browser.app.generated.resources.worldTraitBouldersMedium
import oni_seed_browser.app.generated.resources.worldTraitBouldersMixed
import oni_seed_browser.app.generated.resources.worldTraitBouldersSmall
import oni_seed_browser.app.generated.resources.worldTraitCrashedSatellites
import oni_seed_browser.app.generated.resources.worldTraitDeepOil
import oni_seed_browser.app.generated.resources.worldTraitDistressSignal
import oni_seed_browser.app.generated.resources.worldTraitFrozenCore
import oni_seed_browser.app.generated.resources.worldTraitGeoActive
import oni_seed_browser.app.generated.resources.worldTraitGeoDormant
import oni_seed_browser.app.generated.resources.worldTraitGeodes
import oni_seed_browser.app.generated.resources.worldTraitGlaciersLarge
import oni_seed_browser.app.generated.resources.worldTraitIrregularOil
import oni_seed_browser.app.generated.resources.worldTraitLushCore
import oni_seed_browser.app.generated.resources.worldTraitMagmaVents
import oni_seed_browser.app.generated.resources.worldTraitMetalCaves
import oni_seed_browser.app.generated.resources.worldTraitMetalPoor
import oni_seed_browser.app.generated.resources.worldTraitMetalRich
import oni_seed_browser.app.generated.resources.worldTraitMisalignedStart
import oni_seed_browser.app.generated.resources.worldTraitRadioactiveCrust
import oni_seed_browser.app.generated.resources.worldTraitSlimeSplats
import oni_seed_browser.app.generated.resources.worldTraitSubsurfaceOcean
import oni_seed_browser.app.generated.resources.worldTraitVolcanoes
import org.jetbrains.compose.resources.StringResource

/*
Expand Down
2 changes: 2 additions & 0 deletions app/src/commonMain/kotlin/model/ZoneType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ enum class ZoneType(
Space(7, "Space", Color(0xFF242424)),

FrozenWastes(0, "Tundra", Color(0xFF9DC9D6)),

// CrystalCaverns(1, Color(0xFFAC72C1)),
BoggyMarsh(2, "Marsh", Color(0xFF7B974B)),
ToxicJungle(4, "Jungle", Color(0xFFCB95A3)),
Expand All @@ -51,6 +52,7 @@ enum class ZoneType(
Radioactive(11, "Radioactive", Color(0xFF4AE458)),
Swamp(12, "Swampy", Color(0xFFEB9B3F)),
Wasteland(13, "Wasteland", Color(0xFFCC3636)),

// RocketInterior(14, Color(0xFF9E48DF)),
Metallic(15, "Metallic", Color(0xFFFFA007)),
Moo(17, "Moo", Color(0xFF8EC039)),
Expand Down
20 changes: 13 additions & 7 deletions app/src/commonMain/kotlin/service/DefaultWebClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@

package service

import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.plugins.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.client.request.*
import io.ktor.http.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.client.HttpClient
import io.ktor.client.call.body
import io.ktor.client.plugins.contentnegotiation.ContentNegotiation
import io.ktor.client.plugins.defaultRequest
import io.ktor.client.request.get
import io.ktor.client.request.header
import io.ktor.client.request.post
import io.ktor.client.request.setBody
import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.HttpStatusCode
import io.ktor.http.contentType
import io.ktor.serialization.kotlinx.json.json
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import model.Cluster
Expand Down
24 changes: 21 additions & 3 deletions app/src/commonMain/kotlin/ui/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,27 @@ package ui
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -47,7 +61,11 @@ import org.jetbrains.compose.resources.painterResource
import service.DefaultWebClient
import service.sampleWorldsJson
import ui.filter.FilterPanel
import ui.theme.*
import ui.theme.AppTypography
import ui.theme.HalfSpacer
import ui.theme.appColorScheme
import ui.theme.defaultPadding
import ui.theme.defaultRoundedCornerShape

val logoIconHeight = 80.dp

Expand Down
15 changes: 13 additions & 2 deletions app/src/commonMain/kotlin/ui/AsteroidDetails.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,19 @@

package ui

import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.defaultScrollbarStyle
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down
41 changes: 36 additions & 5 deletions app/src/commonMain/kotlin/ui/AsteroidMapView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,39 @@

package ui

import androidx.compose.foundation.*
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.Image
import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.defaultScrollbarStyle
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -38,6 +61,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import kotlin.math.min
import kotlinx.coroutines.launch
import model.Asteroid
import model.BiomePaths
Expand All @@ -46,8 +70,15 @@ import model.ZoneType
import oni_seed_browser.app.generated.resources.Res
import oni_seed_browser.app.generated.resources.background_space
import org.jetbrains.compose.resources.painterResource
import ui.theme.*
import kotlin.math.min
import ui.theme.DefaultSpacer
import ui.theme.anthraticeTransparentBackgroundColor
import ui.theme.defaultPadding
import ui.theme.defaultRoundedCornerShape
import ui.theme.defaultSpacing
import ui.theme.doubleSpacing
import ui.theme.hoverColor
import ui.theme.lightGray
import ui.theme.lightGrayTransparentBorderColor

@Composable
fun AsteroidMapPopup(
Expand Down
33 changes: 27 additions & 6 deletions app/src/commonMain/kotlin/ui/ClusterView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,47 @@ package ui

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContentCopy
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import kotlin.math.max
import kotlinx.coroutines.delay
import model.Asteroid
import model.Cluster
import ui.theme.*
import kotlin.math.max
import ui.theme.DefaultSpacer
import ui.theme.FillSpacer
import ui.theme.HalfSpacer
import ui.theme.anthraticeTransparentBackgroundColor
import ui.theme.defaultRoundedCornerShape
import ui.theme.defaultSpacing
import ui.theme.halfSpacing
import ui.theme.hoverColor
import ui.theme.lightGrayTransparentBorderColor

val widthPerWorld: Dp = 380.dp

Expand Down Expand Up @@ -132,8 +153,8 @@ fun ClusterView(
contentDescription = null,
tint = if (hovered.value)
hoverColor
else
MaterialTheme.colorScheme.onBackground,
else
MaterialTheme.colorScheme.onBackground,
modifier = Modifier
.onHover(hovered)
.size(16.dp)
Expand Down
14 changes: 12 additions & 2 deletions app/src/commonMain/kotlin/ui/CoordinateBox.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ package ui

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ContentCopy
Expand All @@ -43,7 +48,12 @@ import kotlinx.coroutines.delay
import oni_seed_browser.app.generated.resources.Res
import oni_seed_browser.app.generated.resources.space_hexagon
import org.jetbrains.compose.resources.painterResource
import ui.theme.*
import ui.theme.DoubleSpacer
import ui.theme.defaultRoundedCornerShape
import ui.theme.defaultSpacing
import ui.theme.halfPadding
import ui.theme.halfSpacing
import ui.theme.hoverColor

@Composable
fun CoordinateBox(
Expand Down
Loading

0 comments on commit 63925a8

Please sign in to comment.