Fix register view on WASM, remove edit buttons when viewing non-editable project

This commit is contained in:
2026-08-24 18:42:18 +02:00
parent 8928446444
commit 8dc67adad3
2 changed files with 44 additions and 41 deletions
@@ -181,7 +181,6 @@ fun LoginView(server: String?, error: String?, onSwitchSignup: () -> Unit, onLog
Text("Log in", style = MaterialTheme.typography.headlineMedium) Text("Log in", style = MaterialTheme.typography.headlineMedium)
ServerSelect(serverUrl) { serverUrl = it } ServerSelect(serverUrl) { serverUrl = it }
// OutlinedTextField(serverUrl, { serverUrl = it }, Modifier.fillMaxWidth(), label = { Text("Server URL") }, singleLine = true)
OutlinedTextField(username, { username = it }, Modifier.fillMaxWidth(), label = { Text("Username") }, singleLine = true) OutlinedTextField(username, { username = it }, Modifier.fillMaxWidth(), label = { Text("Username") }, singleLine = true)
OutlinedTextField(password, { password = it }, Modifier.fillMaxWidth(), label = { Text("Password") }, visualTransformation = PasswordVisualTransformation(), singleLine = true) OutlinedTextField(password, { password = it }, Modifier.fillMaxWidth(), label = { Text("Password") }, visualTransformation = PasswordVisualTransformation(), singleLine = true)
@@ -213,7 +212,7 @@ fun SignupView(server: String?, error: String?, onSwitchLogin: () -> Unit, onSig
Column(Modifier.padding(5.dp).widthIn(min = 250.dp).width(IntrinsicSize.Min), horizontalAlignment = Alignment.CenterHorizontally) { Column(Modifier.padding(5.dp).widthIn(min = 250.dp).width(IntrinsicSize.Min), horizontalAlignment = Alignment.CenterHorizontally) {
Text("Sign up", style = MaterialTheme.typography.headlineMedium) Text("Sign up", style = MaterialTheme.typography.headlineMedium)
OutlinedTextField(serverUrl, { serverUrl = it }, Modifier.fillMaxWidth(), label = { Text("Server URL") }, singleLine = true) ServerSelect(serverUrl) { serverUrl = it }
OutlinedTextField(inviteCode, { inviteCode = it }, Modifier.fillMaxWidth(), label = { Text("Invite code") }, singleLine = true) OutlinedTextField(inviteCode, { inviteCode = it }, Modifier.fillMaxWidth(), label = { Text("Invite code") }, singleLine = true)
OutlinedTextField(username, { username = it }, Modifier.fillMaxWidth(), label = { Text("Username") }, singleLine = true) OutlinedTextField(username, { username = it }, Modifier.fillMaxWidth(), label = { Text("Username") }, singleLine = true)
@@ -77,6 +77,7 @@ fun ProjectView(id: Uuid, forceBack: () -> Unit) {
Box(Modifier.fillMaxSize().padding(15.dp)) { Box(Modifier.fillMaxSize().padding(15.dp)) {
ProjectPlotArea(vm) ProjectPlotArea(vm)
if(editable) {
if(addOpen) { if(addOpen) {
CompositionLocalProvider(LocalIndication provides NoFeedbackIndication()) { CompositionLocalProvider(LocalIndication provides NoFeedbackIndication()) {
Box(Modifier.clickable { addOpen = false }.fillMaxSize()) Box(Modifier.clickable { addOpen = false }.fillMaxSize())
@@ -84,7 +85,7 @@ fun ProjectView(id: Uuid, forceBack: () -> Unit) {
} }
Column(Modifier.align(Alignment.BottomEnd).padding(25.dp), horizontalAlignment = Alignment.End) { Column(Modifier.align(Alignment.BottomEnd).padding(25.dp), horizontalAlignment = Alignment.End) {
if(addOpen) { if (addOpen) {
var lblWidth by mutableStateOf(1000.dp) var lblWidth by mutableStateOf(1000.dp)
var dataWidth by mutableStateOf(1000.dp) var dataWidth by mutableStateOf(1000.dp)
val density = LocalDensity.current val density = LocalDensity.current
@@ -117,7 +118,8 @@ fun ProjectView(id: Uuid, forceBack: () -> Unit) {
} }
IconButton({ addOpen = !addOpen }, Modifier.scale(1.5f), shape = MaterialTheme.shapes.medium) { IconButton({ addOpen = !addOpen }, Modifier.scale(1.5f), shape = MaterialTheme.shapes.medium) {
Icon(if(addOpen) Lucide.X else Lucide.Plus, if(addOpen) "Add data" else "Close menu") Icon(if (addOpen) Lucide.X else Lucide.Plus, if (addOpen) "Add data" else "Close menu")
}
} }
} }
} }
@@ -621,6 +623,7 @@ fun ProjectPlotArea(vm: ProjectVM){
} }
else Icon(Lucide.RulerDimensionLine, "Use as baseline") else Icon(Lucide.RulerDimensionLine, "Use as baseline")
} }
if(editable) {
IconButton({ deletingVersion = lbl }, Modifier.align(Alignment.CenterVertically)) { IconButton({ deletingVersion = lbl }, Modifier.align(Alignment.CenterVertically)) {
Icon(Lucide.Trash, "Delete version") Icon(Lucide.Trash, "Delete version")
} }
@@ -630,6 +633,7 @@ fun ProjectPlotArea(vm: ProjectVM){
} }
} }
} }
}
Spacer(Modifier.width(15.dp)) Spacer(Modifier.width(15.dp))
LazyColumn(Modifier.weight(0.5f)) { LazyColumn(Modifier.weight(0.5f)) {
item { Text("Inputs", style = MaterialTheme.typography.headlineSmall) } item { Text("Inputs", style = MaterialTheme.typography.headlineSmall) }