Added aucun projet/glossaire
parent
4794c8f3b1
commit
708cbd9522
|
@ -176,32 +176,39 @@ 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)
|
||||
) {
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Button(
|
||||
onClick = {
|
||||
onGlossarySelected(glossary)
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.padding(10.dp, 0.dp, 0.dp, 0.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
if (glossaries.isEmpty()) {
|
||||
item {
|
||||
Text("Aucun glossaire disponible")
|
||||
}
|
||||
} else {
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(glossary.name)
|
||||
Button(
|
||||
onClick = {
|
||||
onGlossarySelected(glossary)
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.padding(10.dp, 0.dp, 0.dp, 0.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(glossary.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -240,32 +247,43 @@ 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)
|
||||
) {
|
||||
items(projects) { project: Project ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Button(
|
||||
onClick = {
|
||||
onProjectSelected(project)
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.padding(10.dp, 0.dp, 0.dp, 0.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
if (projects.isEmpty()) {
|
||||
item {
|
||||
Text("Aucun projet disponible")
|
||||
}
|
||||
} else {
|
||||
items(projects) { project: Project ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(project.name)
|
||||
Button(
|
||||
onClick = {
|
||||
onProjectSelected(project)
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp)
|
||||
.padding(10.dp, 0.dp, 0.dp, 0.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(project.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,46 +81,55 @@ fun app() {
|
|||
Box(
|
||||
modifier = Modifier
|
||||
.height(300.dp)
|
||||
.width(250.dp)
|
||||
.padding(10.dp)
|
||||
.border(1.dp, Color.Black)
|
||||
) {
|
||||
val scrollState = rememberLazyListState()
|
||||
LazyColumn(
|
||||
state = scrollState,
|
||||
modifier = Modifier.padding(10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
glossaries = loadGlossaries(appState.selectedProject!!)
|
||||
println(glossaries)
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Button(
|
||||
onClick = {
|
||||
selectedGlossary = glossary
|
||||
currentPage.value = "glossaireOptions"
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
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)
|
||||
) {
|
||||
println(glossaries)
|
||||
items(glossaries) { glossary ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(glossary.name)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
// Handle delete glossary action
|
||||
glossaries = glossaries.filterNot { it == glossary }
|
||||
val file = File(glossaryPath + (appState.selectedProject?.name ) + "/" + glossary.jsonFilePath)
|
||||
file.delete()
|
||||
Button(
|
||||
onClick = {
|
||||
selectedGlossary = glossary
|
||||
currentPage.value = "glossaireOptions"
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(glossary.name)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
// Handle delete glossary action
|
||||
glossaries = glossaries.filterNot { it == glossary }
|
||||
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,41 +39,51 @@ 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)
|
||||
) {
|
||||
items(projects, key = { project -> project.name }) { project ->
|
||||
Row(
|
||||
modifier = Modifier.width(200.dp).fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Button(
|
||||
onClick = {
|
||||
appState.selectedProject = project
|
||||
currentPage.value = "glossaires"
|
||||
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
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(),
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Text(project.name)
|
||||
}
|
||||
Button(
|
||||
onClick = {
|
||||
appState.selectedProject = project
|
||||
currentPage.value = "glossaires"
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
// Handle delete project action
|
||||
projects = projects.filterNot { it.name == project.name }
|
||||
println(projects)
|
||||
val directory = File("src/main/resources/projects/${project.name}/")
|
||||
directory.deleteRecursively()
|
||||
currentPage.value = "projects"
|
||||
},
|
||||
modifier = Modifier
|
||||
.width(150.dp),
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = customRedColor,
|
||||
contentColor = Color.White
|
||||
)
|
||||
) {
|
||||
Text(project.name)
|
||||
}
|
||||
|
||||
IconButton(
|
||||
onClick = {
|
||||
// Handle delete project action
|
||||
projects = projects.filterNot { it.name == project.name }
|
||||
println(projects)
|
||||
val directory = File("src/main/resources/projects/${project.name}/")
|
||||
directory.deleteRecursively()
|
||||
currentPage.value = "projects"
|
||||
}
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Delete, contentDescription = "Delete Project")
|
||||
}
|
||||
) {
|
||||
Icon(imageVector = Icons.Default.Delete, contentDescription = "Delete Project")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue