Add menu button on every views
parent
60d7cf84c6
commit
04ed49e551
|
@ -6,28 +6,36 @@ import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.material.Button
|
import androidx.compose.material.Button
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun compareResults(
|
fun compareResults(
|
||||||
glossaryWords: List<Word>,
|
glossaryWords: List<Word>,
|
||||||
codeWords: List<String>,
|
codeWords: List<String>,
|
||||||
onBackClick: () -> Unit
|
onBackClick: () -> Unit,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
println(glossaryWords)
|
println(glossaryWords)
|
||||||
val commonWords = findCommonWords(glossaryWords, codeWords)
|
val commonWords = findCommonWords(glossaryWords, codeWords)
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Top,
|
verticalArrangement = Arrangement.Top,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
|
Text(text = "Comparaison glossaire / code", style = MaterialTheme.typography.h3)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
@ -36,9 +44,10 @@ fun compareResults(
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
// Légende
|
// Légende
|
||||||
Column(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth().padding(16.dp),
|
modifier = Modifier.fillMaxWidth().padding(16.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
// Espace entre les éléments
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(16.dp)
|
||||||
) {
|
) {
|
||||||
LegendItem(color = Color.Green, label = "Mot dans le glossaire et dans le code")
|
LegendItem(color = Color.Green, label = "Mot dans le glossaire et dans le code")
|
||||||
LegendItem(color = Color.White, label = "Mot seulement dans le glossaire")
|
LegendItem(color = Color.White, label = "Mot seulement dans le glossaire")
|
||||||
|
@ -58,6 +67,23 @@ fun compareResults(
|
||||||
Text("Retour")
|
Text("Retour")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ajouter une légende au tableau
|
// Ajouter une légende au tableau
|
||||||
|
|
|
@ -9,14 +9,14 @@ import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowBack
|
import androidx.compose.material.icons.filled.ArrowBack
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import main.component.buttonComponent
|
import main.component.buttonComponent
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterialApi::class)
|
@OptIn(ExperimentalMaterialApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -26,8 +26,13 @@ fun glossaryDetailedPage(
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onAddWordClick: () -> Unit,
|
onAddWordClick: () -> Unit,
|
||||||
onExportClick: () -> Unit,
|
onExportClick: () -> Unit,
|
||||||
onImportClick: () -> Unit
|
onImportClick: () -> Unit,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
println(glossary)
|
println(glossary)
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
@ -124,7 +129,23 @@ fun glossaryDetailedPage(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var importedSuccessfully = mutableStateOf(false)
|
var importedSuccessfully = mutableStateOf(false)
|
||||||
|
|
|
@ -29,6 +29,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.key.*
|
import androidx.compose.ui.input.key.*
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
|
|
||||||
|
|
||||||
data class Glossary(val name: String, val jsonFilePath: String)
|
data class Glossary(val name: String, val jsonFilePath: String)
|
||||||
|
@ -37,10 +38,14 @@ val frame = Frame()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun glossariesPage(
|
fun glossariesPage(
|
||||||
currentPage: MutableState<String>
|
currentPage: MutableState<String>,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit
|
||||||
) {
|
) {
|
||||||
|
|
||||||
var glossaries by remember { mutableStateOf(emptyList<Glossary>()) }
|
var glossaries by remember { mutableStateOf(emptyList<Glossary>()) }
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
@ -148,6 +153,23 @@ fun glossariesPage(
|
||||||
Text("Retour")
|
Text("Retour")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalStdlibApi::class, ExperimentalComposeUiApi::class)
|
@OptIn(ExperimentalStdlibApi::class, ExperimentalComposeUiApi::class)
|
||||||
|
|
|
@ -13,6 +13,7 @@ import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import main.component.buttonComponent
|
import main.component.buttonComponent
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
|
|
||||||
var mostUsedWordList = mutableMapOf<String, Int>()
|
var mostUsedWordList = mutableMapOf<String, Int>()
|
||||||
|
|
||||||
|
@ -143,7 +144,9 @@ fun homePage(
|
||||||
isCompareClicked = false
|
isCompareClicked = false
|
||||||
selectedGlossary = null
|
selectedGlossary = null
|
||||||
selectedProject = null
|
selectedProject = null
|
||||||
}
|
},
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +160,9 @@ fun homePage(
|
||||||
isCompareClicked = false
|
isCompareClicked = false
|
||||||
selectedGlossary = null
|
selectedGlossary = null
|
||||||
selectedProject = null
|
selectedProject = null
|
||||||
}
|
},
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +175,11 @@ fun homePage(
|
||||||
isCompareClicked = false
|
isCompareClicked = false
|
||||||
selectedGlossary = null
|
selectedGlossary = null
|
||||||
selectedProject = null
|
selectedProject = null
|
||||||
}
|
},
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +192,17 @@ fun homePage(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> Unit, onBackClick: () -> Unit) {
|
fun glossaryList(
|
||||||
|
glossaries: List<Glossary>,
|
||||||
|
onGlossarySelected: (Glossary) -> Unit,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit
|
||||||
|
) {
|
||||||
|
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
|
@ -234,10 +252,38 @@ fun glossaryList(glossaries: List<Glossary>, onGlossarySelected: (Glossary) -> U
|
||||||
|
|
||||||
buttonComponent("Retour", onBackClick)
|
buttonComponent("Retour", onBackClick)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, onBackClick: () -> Unit) {
|
fun projectList(
|
||||||
|
projects: List<Project>,
|
||||||
|
onProjectSelected: (Project) -> Unit,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit
|
||||||
|
) {
|
||||||
|
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
|
@ -287,4 +333,21 @@ fun projectList(projects: List<Project>, onProjectSelected: (Project) -> Unit, o
|
||||||
|
|
||||||
buttonComponent("Retour", onBackClick)
|
buttonComponent("Retour", onBackClick)
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -57,6 +57,8 @@ fun app() {
|
||||||
"glossaires" -> {
|
"glossaires" -> {
|
||||||
glossariesPage(
|
glossariesPage(
|
||||||
currentPage = currentPage,
|
currentPage = currentPage,
|
||||||
|
onProjectClick = { currentPage.value = "projets" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +72,9 @@ fun app() {
|
||||||
|
|
||||||
"projects" -> {
|
"projects" -> {
|
||||||
projectsPage(
|
projectsPage(
|
||||||
currentPage = currentPage
|
currentPage = currentPage,
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +110,9 @@ fun app() {
|
||||||
println("Importing file: $filePath")
|
println("Importing file: $filePath")
|
||||||
appState.selectedGlossary?.let { importFile(it, filePath) }
|
appState.selectedGlossary?.let { importFile(it, filePath) }
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,11 +143,18 @@ fun app() {
|
||||||
mostUsedWordList = parser(filePath) // Change by parser functions
|
mostUsedWordList = parser(filePath) // Change by parser functions
|
||||||
isJavaScriptFileSelected = true
|
isJavaScriptFileSelected = true
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
"occurrence" -> {
|
"occurrence" -> {
|
||||||
parsedWordsTable(mostUsedWordList, onBackClick = { currentPage.value = "choixLangage" })
|
parsedWordsTable(
|
||||||
|
mostUsedWordList,
|
||||||
|
onBackClick = { currentPage.value = "choixLangage" },
|
||||||
|
onProjectClick = { currentPage.value = "projects" },
|
||||||
|
onCodeToVerifyClick = { currentPage.value = "choixLangage" },
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isJavaScriptFileSelected) {
|
if (isJavaScriptFileSelected) {
|
||||||
|
@ -161,7 +174,6 @@ fun app() {
|
||||||
onClick = {
|
onClick = {
|
||||||
// Handle the confirm button action
|
// Handle the confirm button action
|
||||||
isJavaScriptFileSelected = false
|
isJavaScriptFileSelected = false
|
||||||
currentPage.value = "occurrence"
|
|
||||||
},
|
},
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
backgroundColor = customRedColor,
|
backgroundColor = customRedColor,
|
||||||
|
|
|
@ -16,6 +16,7 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.key.*
|
import androidx.compose.ui.input.key.*
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
data class Project(val name: String)
|
data class Project(val name: String)
|
||||||
|
@ -28,16 +29,21 @@ fun loadProjects(): List<Project> {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun projectsPage(
|
fun projectsPage(
|
||||||
currentPage: MutableState<String>
|
currentPage: MutableState<String>,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit
|
||||||
) {
|
) {
|
||||||
val appState = AppState
|
val appState = AppState
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
var projects: List<Project> by remember { mutableStateOf(loadProjects()) }
|
var projects: List<Project> by remember { mutableStateOf(loadProjects()) }
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Text("Sélectionnez un projet", style = MaterialTheme.typography.h5)
|
Text("Sélectionnez un projet", style = MaterialTheme.typography.h5)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
@ -135,6 +141,23 @@ fun projectsPage(
|
||||||
Text("Retour")
|
Text("Retour")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalComposeUiApi::class)
|
@OptIn(ExperimentalComposeUiApi::class)
|
||||||
|
|
|
@ -5,11 +5,12 @@ import androidx.compose.material.Button
|
||||||
import androidx.compose.material.ButtonDefaults
|
import androidx.compose.material.ButtonDefaults
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun choixLangagePage(
|
fun choixLangagePage(
|
||||||
|
@ -17,8 +18,12 @@ fun choixLangagePage(
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onPythonClick: () -> Unit,
|
onPythonClick: () -> Unit,
|
||||||
onJavaClick: () -> Unit,
|
onJavaClick: () -> Unit,
|
||||||
onJavaScriptClick: () -> Unit
|
onJavaScriptClick: () -> Unit,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
@ -40,7 +45,7 @@ fun choixLangagePage(
|
||||||
Button(
|
Button(
|
||||||
onClick = onPythonClick,
|
onClick = onPythonClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(125.dp),
|
.width(150.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
backgroundColor = customRedColor,
|
backgroundColor = customRedColor,
|
||||||
contentColor = Color.White
|
contentColor = Color.White
|
||||||
|
@ -53,7 +58,7 @@ fun choixLangagePage(
|
||||||
Button(
|
Button(
|
||||||
onClick = onJavaClick,
|
onClick = onJavaClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(125.dp),
|
.width(150.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
backgroundColor = customRedColor,
|
backgroundColor = customRedColor,
|
||||||
contentColor = Color.White
|
contentColor = Color.White
|
||||||
|
@ -66,7 +71,7 @@ fun choixLangagePage(
|
||||||
Button(
|
Button(
|
||||||
onClick = onJavaScriptClick,
|
onClick = onJavaScriptClick,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.width(125.dp),
|
.width(150.dp),
|
||||||
colors = ButtonDefaults.buttonColors(
|
colors = ButtonDefaults.buttonColors(
|
||||||
backgroundColor = customRedColor,
|
backgroundColor = customRedColor,
|
||||||
contentColor = Color.White
|
contentColor = Color.White
|
||||||
|
@ -74,6 +79,29 @@ fun choixLangagePage(
|
||||||
) {
|
) {
|
||||||
Text("JavaScript")
|
Text("JavaScript")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Faire un bouton qui affiche la vue "occurence" si on a déjà importer un fichier
|
||||||
|
// Sinon afficher un snackbar qui dit qu'il faut importer un fichier
|
||||||
|
Button(
|
||||||
|
onClick = {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@Button
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
currentPage.value = "occurrence"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modifier = Modifier
|
||||||
|
.width(150.dp),
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
backgroundColor = customRedColor,
|
||||||
|
contentColor = Color.White
|
||||||
|
),
|
||||||
|
enabled = mostUsedWordList.isNotEmpty()
|
||||||
|
) {
|
||||||
|
Text("Mots parsés")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
|
@ -91,5 +119,21 @@ fun choixLangagePage(
|
||||||
Text(languageManager.getBackButtonText())
|
Text(languageManager.getBackButtonText())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package main.component
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
|
@ -8,6 +8,7 @@ import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import main.customRedColor
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun dropdownButtonComponent(
|
fun dropdownButtonComponent(
|
|
@ -8,21 +8,31 @@ import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.Button
|
import androidx.compose.material.Button
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import main.component.dropdownButtonComponent
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun parsedWordsTable(parsedWords: Map<String, Int>, onBackClick: () -> Unit) {
|
fun parsedWordsTable(
|
||||||
|
parsedWords: Map<String, Int>,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
onProjectClick: () -> Unit,
|
||||||
|
onCodeToVerifyClick: () -> Unit,
|
||||||
|
) {
|
||||||
|
|
||||||
|
var isCompareClicked by remember { mutableStateOf(false) }
|
||||||
|
val noFileSnackbarVisibleState = remember { mutableStateOf(false) }
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
verticalArrangement = Arrangement.Top,
|
verticalArrangement = Arrangement.Top,
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
Text(text = "Mots Parsés", style = MaterialTheme.typography.h3)
|
Text(text = "Mots parsés", style = MaterialTheme.typography.h3)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|
||||||
|
@ -48,6 +58,23 @@ fun parsedWordsTable(parsedWords: Map<String, Int>, onBackClick: () -> Unit) {
|
||||||
Text("Retour")
|
Text("Retour")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dropdownButtonComponent(
|
||||||
|
items = listOf("Glossaire", "Code à vérifier", "Comparer")
|
||||||
|
) { selectedOption ->
|
||||||
|
// Handle the selected option
|
||||||
|
when (selectedOption) {
|
||||||
|
"Glossaire" -> onProjectClick()
|
||||||
|
"Code à vérifier" -> onCodeToVerifyClick()
|
||||||
|
"Comparer" -> {
|
||||||
|
if (mostUsedWordList.isEmpty()) {
|
||||||
|
noFileSnackbarVisibleState.value = true
|
||||||
|
return@dropdownButtonComponent
|
||||||
|
} else {
|
||||||
|
isCompareClicked = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
Loading…
Reference in New Issue