Added aucun projet/glossaire
parent
4794c8f3b1
commit
708cbd9522
|
@ -176,14 +176,20 @@ fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.height(500.dp)
|
||||
.width(250.dp)
|
||||
.padding(10.dp)
|
||||
) {
|
||||
val scrollState = rememberLazyListState()
|
||||
LazyColumn(
|
||||
state = scrollState,
|
||||
modifier = Modifier.padding(10.dp).border(1.dp, Color.Black),
|
||||
modifier = Modifier.padding(10.dp).width(250.dp).border(1.dp, Color.Black),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
if (glossaries.isEmpty()) {
|
||||
item {
|
||||
Text("Aucun glossaire disponible")
|
||||
}
|
||||
} else {
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
|
@ -206,6 +212,7 @@ fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalScrollbar(
|
||||
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
|
||||
adapter = rememberScrollbarAdapter(scrollState)
|
||||
|
@ -240,14 +247,24 @@ fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, o
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.height(500.dp)
|
||||
.width(350.dp)
|
||||
.padding(10.dp)
|
||||
) {
|
||||
val scrollState = rememberLazyListState()
|
||||
LazyColumn(
|
||||
state = scrollState,
|
||||
modifier = Modifier.padding(10.dp).border(1.dp, Color.Black),
|
||||
modifier = Modifier
|
||||
.padding(10.dp)
|
||||
.width(250.dp)
|
||||
.height(300.dp)
|
||||
.border(1.dp, Color.Black),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
if (projects.isEmpty()) {
|
||||
item {
|
||||
Text("Aucun projet disponible")
|
||||
}
|
||||
} else {
|
||||
items(projects) { project: Project ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
|
@ -270,6 +287,7 @@ fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, o
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
VerticalScrollbar(
|
||||
modifier = Modifier.align(Alignment.CenterEnd).fillMaxHeight(),
|
||||
adapter = rememberScrollbarAdapter(scrollState)
|
||||
|
|
|
@ -81,16 +81,20 @@ fun app() {
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.height(300.dp)
|
||||
.width(250.dp)
|
||||
.padding(10.dp)
|
||||
.border(1.dp, Color.Black)
|
||||
) {
|
||||
val scrollState = rememberLazyListState()
|
||||
glossaries = loadGlossaries(appState.selectedProject!!)
|
||||
if (glossaries.isEmpty()) {
|
||||
Text("Aucun glossaire n'a été créé pour ce projet")
|
||||
} else {
|
||||
LazyColumn(
|
||||
state = scrollState,
|
||||
modifier = Modifier.padding(10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
glossaries = loadGlossaries(appState.selectedProject!!)
|
||||
println(glossaries)
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
|
@ -116,11 +120,16 @@ fun app() {
|
|||
onClick = {
|
||||
// Handle delete glossary action
|
||||
glossaries = glossaries.filterNot { it == glossary }
|
||||
val file = File(glossaryPath + (appState.selectedProject?.name ) + "/" + glossary.jsonFilePath)
|
||||
val file =
|
||||
File(glossaryPath + (appState.selectedProject?.name) + "/" + glossary.jsonFilePath)
|
||||
file.delete()
|
||||
}
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Delete, contentDescription = "Delete Glossary")
|
||||
Icon(
|
||||
imageVector = Icons.Default.Delete,
|
||||
contentDescription = "Delete Glossary"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package main
|
||||
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
|
@ -38,9 +39,18 @@ fun projectsPage(
|
|||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.padding(10.dp),
|
||||
modifier = Modifier
|
||||
.padding(10.dp)
|
||||
.width(200.dp)
|
||||
.height(300.dp)
|
||||
.border(1.dp, Color.Black),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
if (projects.isEmpty()) {
|
||||
item {
|
||||
Text("Aucun projet n'a été créé")
|
||||
}
|
||||
} else {
|
||||
items(projects, key = { project -> project.name }) { project ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
|
@ -77,6 +87,7 @@ fun projectsPage(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
|
|
Loading…
Reference in New Issue