@@ -2,83 +2,37 @@ package love.forte.simbot.codegen.gen.view
22
33import androidx.compose.animation.AnimatedVisibility
44import androidx.compose.animation.animateColor
5- import androidx.compose.animation.core.InfiniteRepeatableSpec
6- import androidx.compose.animation.core.RepeatMode
7- import androidx.compose.animation.core.infiniteRepeatable
8- import androidx.compose.animation.core.rememberInfiniteTransition
9- import androidx.compose.animation.core.tween
10- import androidx.compose.foundation.ExperimentalFoundationApi
11- import androidx.compose.foundation.focusGroup
12- import androidx.compose.foundation.layout.Arrangement
13- import androidx.compose.foundation.layout.Box
14- import androidx.compose.foundation.layout.Column
15- import androidx.compose.foundation.layout.ExperimentalLayoutApi
16- import androidx.compose.foundation.layout.FlowRow
17- import androidx.compose.foundation.layout.Row
18- import androidx.compose.foundation.layout.fillMaxSize
19- import androidx.compose.foundation.layout.fillMaxWidth
20- import androidx.compose.foundation.layout.padding
21- import androidx.compose.foundation.layout.size
22- import androidx.compose.foundation.onClick
23- import androidx.compose.foundation.rememberScrollState
5+ import androidx.compose.animation.core.*
6+ import androidx.compose.foundation.*
7+ import androidx.compose.foundation.layout.*
248import androidx.compose.foundation.text.ClickableText
25- import androidx.compose.foundation.verticalScroll
269import androidx.compose.material.icons.Icons
2710import androidx.compose.material.icons.filled.Done
2811import androidx.compose.material.icons.outlined.Search
29- import androidx.compose.material3.BottomAppBar
30- import androidx.compose.material3.CenterAlignedTopAppBar
31- import androidx.compose.material3.Checkbox
32- import androidx.compose.material3.ElevatedFilterChip
33- import androidx.compose.material3.ExperimentalMaterial3Api
34- import androidx.compose.material3.FilledTonalButton
35- import androidx.compose.material3.FilterChipDefaults
36- import androidx.compose.material3.Icon
37- import androidx.compose.material3.LocalContentColor
38- import androidx.compose.material3.OutlinedCard
39- import androidx.compose.material3.OutlinedTextField
40- import androidx.compose.material3.RadioButton
41- import androidx.compose.material3.Scaffold
42- import androidx.compose.material3.Text
12+ import androidx.compose.material3.*
4313import androidx.compose.material3.TopAppBarDefaults.topAppBarColors
44- import androidx.compose.runtime.Composable
45- import androidx.compose.runtime.LaunchedEffect
46- import androidx.compose.runtime.getValue
47- import androidx.compose.runtime.mutableIntStateOf
48- import androidx.compose.runtime.mutableStateOf
49- import androidx.compose.runtime.remember
50- import androidx.compose.runtime.rememberCoroutineScope
51- import androidx.compose.runtime.setValue
14+ import androidx.compose.runtime.*
5215import androidx.compose.ui.Alignment
5316import androidx.compose.ui.Modifier
5417import androidx.compose.ui.graphics.Color
5518import androidx.compose.ui.platform.LocalFocusManager
56- import androidx.compose.ui.text.ExperimentalTextApi
57- import androidx.compose.ui.text.SpanStyle
58- import androidx.compose.ui.text.UrlAnnotation
59- import androidx.compose.ui.text.buildAnnotatedString
19+ import androidx.compose.ui.text.*
6020import androidx.compose.ui.text.font.FontWeight
61- import androidx.compose.ui.text.withStyle
21+ import androidx.compose.ui.text.style.TextDecoration
6222import androidx.compose.ui.unit.dp
6323import androidx.lifecycle.ViewModel
6424import androidx.lifecycle.viewmodel.compose.viewModel
6525import kotlinx.browser.window
6626import kotlinx.coroutines.await
6727import kotlinx.coroutines.launch
6828import kotlinx.coroutines.withTimeout
29+ import love.forte.simbot.codegen.DefaultTextLinkStyles
6930import love.forte.simbot.codegen.JsDate
7031import love.forte.simbot.codegen.filesaver.saveAs
71- import love.forte.simbot.codegen.gen.COMPONENT_KOOK
72- import love.forte.simbot.codegen.gen.COMPONENT_OB_11
73- import love.forte.simbot.codegen.gen.COMPONENT_QQ
74- import love.forte.simbot.codegen.gen.ComponentVersion
75- import love.forte.simbot.codegen.gen.GradleProjectViewModel
76- import love.forte.simbot.codegen.gen.SIMBOT_VERSION
77- import love.forte.simbot.codegen.gen.SimbotComponent
78- import love.forte.simbot.codegen.gen.SimbotComponentWithVersion
79- import love.forte.simbot.codegen.gen.doGenerate
32+ import love.forte.simbot.codegen.gen.*
8033import love.forte.simbot.codegen.jszip.JsZipFileGenerateOptions
8134import love.forte.simbot.codegen.versions.fetchLatest
35+ import love.forte.simbot.codegen.withLink
8236import org.w3c.files.Blob
8337import kotlin.time.Duration.Companion.seconds
8438
@@ -107,7 +61,7 @@ operator fun LoadingCounter.dec(): LoadingCounter = apply { removeLoading() }
10761 * Composable function to display the view for configuring Gradle project settings.
10862 *
10963 * This view allows users to manage settings related to a*/
110- @OptIn(ExperimentalMaterial3Api ::class , ExperimentalTextApi :: class , ExperimentalFoundationApi ::class )
64+ @OptIn(ExperimentalMaterial3Api ::class , ExperimentalFoundationApi ::class )
11165@Composable
11266fun GradleSettingsView (
11367 projectViewModel : GradleProjectViewModel = viewModel { GradleProjectViewModel () },
@@ -135,18 +89,29 @@ fun GradleSettingsView(
13589 horizontalArrangement = Arrangement .Center ,
13690 verticalAlignment = Alignment .CenterVertically
13791 ) {
138- Text (" © ${JsDate ().getFullYear()} " )
139- val link = " https://github.com/simple-robot"
140- ClickableText (
141- buildAnnotatedString {
142- withStyle(SpanStyle (color = Color .Blue )) {
143- append(" Simple Robot." )
144- pushUrlAnnotation(UrlAnnotation (link))
145- }
146- }) {
147- window.open(link, target = " _blank" )
92+
93+ val textWithLink = buildAnnotatedString {
94+ append(" © " )
95+ append(JsDate ().getFullYear().toString())
96+ append(" " )
97+ withLink(text = " Simple Robot" , url = " https://github.com/simple-robot" )
98+ append(" All rights reserved." )
14899 }
149- Text (" All rights reserved." )
100+
101+ Text (textWithLink)
102+
103+ // Text("© ${JsDate().getFullYear()} ")
104+ // val link = "https://github.com/simple-robot"
105+ // ClickableText(
106+ // buildAnnotatedString {
107+ // withStyle(SpanStyle(color = Color.Blue)) {
108+ // append("Simple Robot.")
109+ // pushUrlAnnotation(UrlAnnotation(link))
110+ // }
111+ // }) {
112+ // window.open(link, target = "_blank")
113+ // }
114+ // Text("All rights reserved.")
150115 }
151116 }
152117 },
@@ -364,18 +329,13 @@ private fun SimbotVersion(
364329 Column {
365330 Text (" 输入一个要使用的simbot版本。" )
366331 Row {
367- Text (" 可前往 " )
368- val link = " https://github.com/simple-robot/simpler-robot/releases"
369- ClickableText (
332+ Text (
370333 buildAnnotatedString {
371- withStyle(SpanStyle (color = Color .Blue )) {
372- append(" Releases" )
373- pushUrlAnnotation(UrlAnnotation (link))
374- }
375- }) {
376- window.open(link, target = " _blank" )
377- }
378- Text (" 参考。" )
334+ append(" 可前往 " )
335+ withLink(" Releases" , " https://github.com/simple-robot/simpler-robot/releases" )
336+ append(" 参考并选择版本。" )
337+ }
338+ )
379339 }
380340 }
381341 }
0 commit comments