Skip to content
This repository was archived by the owner on Dec 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions app/src/main/assets/katex.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@
<title>Notation Card</title>
<style>
body {
margin: 0;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}

#katex-render {
margin: auto;
font-size: 22px;
/* Additional styling if needed */
}
</style>
</head>
Expand All @@ -29,10 +25,9 @@
<div id="katex-render"></div>

<script>
function setTheme(bgColor, textColor) {
document.body.style.backgroundColor = bgColor;
document.body.style.color = textColor;
}
function setTheme(textColor) {
document.body.style.color = textColor;
}
renderMathInElement(document.body, {
delimiters: [
{left: "$$", right: "$$", display: true},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.lifecycle.lifecycleScope
import com.belmontCrest.cardCrafter.model.application.AppViewModelProvider
import com.belmontCrest.cardCrafter.model.ui.PreferencesManager
import com.belmontCrest.cardCrafter.model.application.PreferencesManager
import com.belmontCrest.cardCrafter.model.application.setPreferenceValues
import com.belmontCrest.cardCrafter.supabase.controller.viewModels.DeepLinksViewModel
import com.belmontCrest.cardCrafter.ui.theme.ColorSchemeClass
import com.belmontCrest.cardCrafter.ui.theme.FlashcardsTheme
Expand Down Expand Up @@ -73,14 +74,14 @@ class DeepLinkerActivity : ComponentActivity() {
val colorScheme = remember { ColorSchemeClass() }
colorScheme.colorScheme = MaterialTheme.colorScheme

val pc = setPreferenceValues(preferences)
val getUIStyle = GetUIStyle(
colorScheme, preferences.darkTheme.value,
preferences.customScheme.value, preferences.cuteTheme.value
colorScheme, pc.darkTheme, pc.dynamicTheme, pc.cuteTheme
)
FlashcardsTheme(
darkTheme = preferences.darkTheme.value,
dynamicColor = preferences.customScheme.value,
cuteTheme = preferences.cuteTheme.value
darkTheme = pc.darkTheme,
dynamicColor = pc.dynamicTheme,
cuteTheme = pc.cuteTheme
) {
Scaffold(
modifier = Modifier.fillMaxSize(),
Expand Down Expand Up @@ -110,7 +111,7 @@ class DeepLinkerActivity : ComponentActivity() {
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Text("Successfully created you account!")
Text("Successfully created your account!")
Text(email)
Text(createdAt)
SubmitButton(
Expand Down
19 changes: 8 additions & 11 deletions app/src/main/java/com/belmontCrest/cardCrafter/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.coroutineScope
import androidx.navigation.compose.rememberNavController
import com.belmontCrest.cardCrafter.model.application.AppViewModelProvider
Expand All @@ -22,7 +23,7 @@ import com.belmontCrest.cardCrafter.navigation.navHosts.AppNavHost
import com.belmontCrest.cardCrafter.controller.viewModels.cardViewsModels.EditingCardListViewModel
import com.belmontCrest.cardCrafter.controller.viewModels.deckViewsModels.MainViewModel
import com.belmontCrest.cardCrafter.model.ui.Fields
import com.belmontCrest.cardCrafter.model.ui.PreferencesManager
import com.belmontCrest.cardCrafter.model.application.PreferencesManager
import com.belmontCrest.cardCrafter.supabase.controller.viewModels.SupabaseViewModel
import com.belmontCrest.cardCrafter.ui.theme.FlashcardsTheme
import io.github.jan.supabase.annotations.SupabaseInternal
Expand All @@ -42,7 +43,7 @@ class MainActivity : ComponentActivity() {
AppViewModelProvider.Factory
}

private val navViewModel : NavViewModel by viewModels{
private val navViewModel: NavViewModel by viewModels {
AppViewModelProvider.Factory
}

Expand All @@ -55,11 +56,7 @@ class MainActivity : ComponentActivity() {
enableEdgeToEdge()
setContent {
val navController = rememberNavController()
preferences = rememberUpdatedState(
PreferencesManager(
applicationContext
)
).value
preferences = rememberUpdatedState(PreferencesManager(applicationContext)).value

/**
* Making sure that if it's their first time,
Expand Down Expand Up @@ -88,15 +85,14 @@ class MainActivity : ComponentActivity() {


if (preferences.getIsFirstTime()) {
preferences.darkTheme.value = isSystemDark
preferences.setDarkTheme(isSystemDark)
preferences.setIsFirstTime()
}

FlashcardsTheme(
darkTheme = preferences.darkTheme.value,
dynamicColor = preferences.customScheme.value,
cuteTheme = preferences.cuteTheme.value
darkTheme = preferences.darkTheme.collectAsStateWithLifecycle().value,
dynamicColor = preferences.dynamicTheme.collectAsStateWithLifecycle().value,
cuteTheme = preferences.cuteTheme.collectAsStateWithLifecycle().value
) {
AppNavHost(
mainNavController = navController,
Expand Down Expand Up @@ -132,6 +128,7 @@ class MainActivity : ComponentActivity() {
preferences.savePreferences()
}
}

}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.lifecycle.lifecycleScope
import com.belmontCrest.cardCrafter.model.application.AppViewModelProvider
import com.belmontCrest.cardCrafter.model.ui.PreferencesManager
import com.belmontCrest.cardCrafter.model.application.PreferencesManager
import com.belmontCrest.cardCrafter.model.application.setPreferenceValues
import com.belmontCrest.cardCrafter.supabase.controller.viewModels.DeepLinksViewModel
import com.belmontCrest.cardCrafter.ui.theme.ColorSchemeClass
import com.belmontCrest.cardCrafter.ui.theme.FlashcardsTheme
Expand Down Expand Up @@ -64,25 +65,23 @@ class ResetPasswordActivity : ComponentActivity() {
createdAtState.value = created
}
}
preferences = rememberUpdatedState(
PreferencesManager(applicationContext)
).value
preferences = rememberUpdatedState(PreferencesManager(applicationContext)).value
val colorScheme = remember { ColorSchemeClass() }
colorScheme.colorScheme = MaterialTheme.colorScheme

val pc = setPreferenceValues(preferences)
val getUIStyle = GetUIStyle(
colorScheme, preferences.darkTheme.value,
preferences.customScheme.value, preferences.cuteTheme.value
colorScheme, pc.darkTheme, pc.dynamicTheme, pc.cuteTheme
)
var password by rememberSaveable { mutableStateOf("") }
var confirmPass by rememberSaveable { mutableStateOf("") }
var enabled by rememberSaveable { mutableStateOf(true) }
val coroutineScope = rememberCoroutineScope()
val context = LocalContext.current
FlashcardsTheme(
darkTheme = preferences.darkTheme.value,
dynamicColor = preferences.customScheme.value,
cuteTheme = preferences.cuteTheme.value
darkTheme = pc.darkTheme,
dynamicColor = pc.dynamicTheme,
cuteTheme = pc.cuteTheme
) {
Scaffold(
modifier = Modifier.fillMaxSize(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import com.belmontCrest.cardCrafter.localDatabase.tables.AllCardTypes
import com.belmontCrest.cardCrafter.localDatabase.tables.CT
import com.belmontCrest.cardCrafter.localDatabase.tables.Card
import com.belmontCrest.cardCrafter.localDatabase.tables.Deck
import com.belmontCrest.cardCrafter.localDatabase.tables.PartOfQorA
import com.belmontCrest.cardCrafter.model.ui.states.CDetails


fun CT.toCard(): Card = when (this) {
Expand Down Expand Up @@ -43,6 +45,45 @@ fun List<CT>.toThreeFieldList() = filterIsInstance<CT.ThreeField>().map { it.thr
fun List<CT>.toMultiChoiceList() = filterIsInstance<CT.MultiChoice>().map { it.multiChoiceCard }
fun List<CT>.toNotationList() = filterIsInstance<CT.Notation>().map { it.notationCard }

fun CT.Basic.question(): String = this.basicCard.question
fun CT.Basic.answer(): String = this.basicCard.answer

fun CT.Hint.question(): String = this.hintCard.question
fun CT.Hint.hint(): String = this.hintCard.hint
fun CT.Hint.answer(): String = this.hintCard.answer

fun CT.ThreeField.question(): String = this.threeFieldCard.question
fun CT.ThreeField.middle(): String = this.threeFieldCard.middle
fun CT.ThreeField.field(): PartOfQorA = this.threeFieldCard.field
fun CT.ThreeField.answer(): String = this.threeFieldCard.answer

fun CT.MultiChoice.question(): String = this.multiChoiceCard.question
fun CT.MultiChoice.choices(): List<String> = listOf(
this.multiChoiceCard.choiceA, this.multiChoiceCard.choiceB,
this.multiChoiceCard.choiceC, this.multiChoiceCard.choiceD
)

fun CT.MultiChoice.correct(): Char = this.multiChoiceCard.correct

fun CT.Notation.question(): String = this.notationCard.question
fun CT.Notation.steps(): List<String> = this.notationCard.steps
fun CT.Notation.answer(): String = this.notationCard.answer

fun CT.toCDetails(): CDetails = when (this) {
is CT.Basic -> CDetails(question = this.question(), answer = this.answer())
is CT.Hint -> CDetails(question = this.question(), middle = this.hint(), answer = this.answer())
is CT.MultiChoice -> CDetails(
question = this.question(), choices = this.choices(), correct = this.correct()
)
is CT.Notation -> CDetails(
question = this.question(), steps = this.steps(), answer = this.answer()
)
is CT.ThreeField -> CDetails(
question = this.question(), middle = this.middle(), answer = this.answer(),
isQOrA = this.field()
)
}

fun updateCTCard(
ct: CT, dueCT: CT,
deck: Deck, vm: CardDeckViewModel,
Expand Down
Loading