Explorar o código

ktlint 120 cols, inline expression bodies

Milan Jurkulak hai 3 meses
pai
achega
cf0c641369
Modificáronse 100 ficheiros con 1402 adicións e 1524 borrados
  1. 5 5
      shared/shared.gradle.kts
  2. 25 26
      shared/src/androidMain/kotlin/org/mjdev/desktop/context/DesktopContext.kt
  3. 11 11
      shared/src/androidMain/kotlin/org/mjdev/desktop/data/App.kt
  4. 3 4
      shared/src/androidMain/kotlin/org/mjdev/desktop/data/Theme.kt
  5. 9 11
      shared/src/androidMain/kotlin/org/mjdev/desktop/data/User.kt
  6. 17 18
      shared/src/androidMain/kotlin/org/mjdev/desktop/extensions/ImageBitmapExt.kt
  7. 8 9
      shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/DecoderAndroid.kt
  8. 17 18
      shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/font/MaterialIconFont.android.kt
  9. 4 5
      shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/gif/GifCacheDir.kt
  10. 16 20
      shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/persistence/StorageProvider.kt
  11. 1 2
      shared/src/androidMain/kotlin/org/mjdev/desktop/managers/connectivity/ConnectivityManager.kt
  12. 3 4
      shared/src/androidMain/kotlin/org/mjdev/desktop/managers/keys/KeysManager.kt
  13. 1 2
      shared/src/androidMain/kotlin/org/mjdev/desktop/managers/os/OSManager.kt
  14. 1 2
      shared/src/androidMain/kotlin/org/mjdev/desktop/managers/theme/ThemeManager.kt
  15. 3 4
      shared/src/androidMain/kotlin/org/mjdev/desktop/system/Filesystem.android.kt
  16. 132 136
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appbar/AppBar.kt
  17. 6 7
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/AppsMenu.kt
  18. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsBottomBar.kt
  19. 13 14
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsList.kt
  20. 8 9
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsMenuActions.kt
  21. 12 13
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsMenuApp.kt
  22. 12 13
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsMenuCategory.kt
  23. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/background/BackgroundImage.kt
  24. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/blur/BlurPanel.kt
  25. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/button/ButtonPrimary.kt
  26. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/button/ButtonSecondary.kt
  27. 8 9
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/button/TransparentButton.kt
  28. 11 12
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/Card.kt
  29. 13 14
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/CardContent.kt
  30. 28 29
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/ClassicCard.kt
  31. 29 30
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/CompactCard.kt
  32. 18 19
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/FocusableCard.kt
  33. 18 19
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/ItemCard.kt
  34. 17 19
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/PhotoCard.kt
  35. 30 31
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/WideClassicCard.kt
  36. 2 3
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/base/CardBorder.kt
  37. 7 8
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/base/CardColors.kt
  38. 53 59
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/base/CardDefaults.kt
  39. 16 17
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/chart/DonutChart.kt
  40. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/ControlCenter.kt
  41. 2 1
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/base/ControlCenterPageScope.kt
  42. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/base/PageHeader.kt
  43. 11 12
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/base/PersistentPageSaver.kt
  44. 13 15
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/about/AboutPage.kt
  45. 82 84
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/ai/AIPage.kt
  46. 15 17
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/bluetooth/BluetoothSettingsPage.kt
  47. 175 170
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/desktop/DesktopSettingsPage.kt
  48. 14 16
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/devices/Devices.kt
  49. 12 14
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/display/DisplaySettingsPage.kt
  50. 15 17
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/ethernet/EthSettingsPage.kt
  51. 88 90
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/main/MainSettingsPage.kt
  52. 13 15
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/remotes/RemotesSettingsPage.kt
  53. 13 15
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/sound/SoundSettingsPage.kt
  54. 13 15
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/theme/ThemeSettingsPage.kt
  55. 12 14
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/wifi/WifiRow.kt
  56. 66 68
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/wifi/WifiSettingsPage.kt
  57. 4 5
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSection.kt
  58. 8 9
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSelectRow.kt
  59. 8 9
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSliderRow.kt
  60. 7 8
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSwitchRow.kt
  61. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/BrushedLayout.kt
  62. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/Clock.kt
  63. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/DateTime.kt
  64. 10 11
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/MeasureUnconstrainedView.kt
  65. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/PowerBlock.kt
  66. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/VerticalScrollableBox.kt
  67. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktop/Desktop.kt
  68. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktop/widgets/MemoryChart.kt
  69. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/DesktopPanel.kt
  70. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopMenuIcon.kt
  71. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelDateTime.kt
  72. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelFavoriteApps.kt
  73. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelIcon.kt
  74. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelLanguage.kt
  75. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelText.kt
  76. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelTray.kt
  77. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/draggable/DraggableView.kt
  78. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/file/FolderIcon.kt
  79. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/file/FolderView.kt
  80. 14 15
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/fonticon/FontIcon.kt
  81. 35 37
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/greeter/Greeter.kt
  82. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/GridPlaced.kt
  83. 2 1
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedCellSize.kt
  84. 12 16
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedCells.kt
  85. 14 16
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedScopeImpl.kt
  86. 16 20
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedSpanAnchor.kt
  87. 19 20
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/Measure.kt
  88. 7 8
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/guide/GuideView.kt
  89. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/icon/ShapedIcon.kt
  90. 6 7
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/icon/WifiLevelIcon.kt
  91. 8 10
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/image/GifView.kt
  92. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/image/ImageAny.kt
  93. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/image/PhotoImage.kt
  94. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/immersivelist/ImmersiveList.kt
  95. 4 5
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/immersivelist/base/ImmersiveListScope.kt
  96. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/info/Info.kt
  97. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/input/PasswordTextView.kt
  98. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/input/SearchFieldPassive.kt
  99. 5 6
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/input/SelectableOutlineEditText.kt
  100. 3 4
      shared/src/commonMain/kotlin/org/mjdev/desktop/components/installer/Installer.kt

+ 5 - 5
shared/shared.gradle.kts

@@ -35,15 +35,15 @@ plugins {
 
 // <editor-fold desc="helpers">----------------------------------------------------------------------
 
-fun NamedDomainObjectContainer<KotlinSourceSet>.getOrCreate(name: String): KotlinSourceSet = findByName(name) ?: create(name)
+fun NamedDomainObjectContainer<KotlinSourceSet>.getOrCreate(name: String): KotlinSourceSet =
+    findByName(name) ?: create(name)
 
 fun NamedDomainObjectContainer<KotlinSourceSet>.desktopMain(block: KotlinSourceSet.() -> Unit = {}): KotlinSourceSet =
     getOrCreate("desktopMain").apply(block)
 
-fun KotlinTargetContainerWithPresetFunctions.desktopTarget(configure: Action<KotlinJvmTarget>) =
-    jvm("desktop").apply {
-        configure.execute(this)
-    }
+fun KotlinTargetContainerWithPresetFunctions.desktopTarget(configure: Action<KotlinJvmTarget>) = jvm("desktop").apply {
+    configure.execute(this)
+}
 
 val Project.compose: ComposeExtension
     get() = extensions.getByType()

+ 25 - 26
shared/src/androidMain/kotlin/org/mjdev/desktop/context/DesktopContext.kt

@@ -126,32 +126,31 @@ class DesktopContext(
     override fun dispose() {
     }
 
-    override fun createManager(cls: KClass<*>): IDelegate =
-        when (cls) {
-            IOSManager::class -> OsManager(this)
-            IPalette::class -> Palette(this)
-            ITranslator::class -> Translator(this)
-            IConnectivityManager::class -> ConnectivityManager(this)
-            IAiManager::class ->
-                AiManager(
-                    context = this,
-                    // todo user can configure
-                    pluginAI = AiPluginOpenAi(this@DesktopContext),
-                    pluginTTS = TTSPluginAndroid(this@DesktopContext),
-                    pluginSTT = STTPluginEmpty(this@DesktopContext),
-                )
-
-            IAppsManager::class -> AppsManager(this)
-            IThemeManager::class -> ThemeManager(this)
-            IProcessManager::class -> ProcessManager(this)
-            IKeyManager::class -> KeysManager(this)
-            else ->
-                cls.companionObject
-                    ?.members
-                    ?.first {
-                        it.name == "EMPTY"
-                    }?.call() as IDelegate
-        }
+    override fun createManager(cls: KClass<*>): IDelegate = when (cls) {
+        IOSManager::class -> OsManager(this)
+        IPalette::class -> Palette(this)
+        ITranslator::class -> Translator(this)
+        IConnectivityManager::class -> ConnectivityManager(this)
+        IAiManager::class ->
+            AiManager(
+                context = this,
+                // todo user can configure
+                pluginAI = AiPluginOpenAi(this@DesktopContext),
+                pluginTTS = TTSPluginAndroid(this@DesktopContext),
+                pluginSTT = STTPluginEmpty(this@DesktopContext),
+            )
+
+        IAppsManager::class -> AppsManager(this)
+        IThemeManager::class -> ThemeManager(this)
+        IProcessManager::class -> ProcessManager(this)
+        IKeyManager::class -> KeysManager(this)
+        else ->
+            cls.companionObject
+                ?.members
+                ?.first {
+                    it.name == "EMPTY"
+                }?.call() as IDelegate
+    }
 
     companion object {
         @Composable

+ 11 - 11
shared/src/androidMain/kotlin/org/mjdev/desktop/data/App.kt

@@ -40,22 +40,22 @@ class App(
 
     override fun toString(): String = name
 
-    private fun PackageInfo.isSystemPackage(): Boolean = ((applicationInfo?.flags ?: 0) and ApplicationInfo.FLAG_SYSTEM) != 0
+    private fun PackageInfo.isSystemPackage(): Boolean =
+        ((applicationInfo?.flags ?: 0) and ApplicationInfo.FLAG_SYSTEM) != 0
 
     companion object {
         @SuppressLint("NewApi")
         private fun guessCategory(
             context: Context?,
             info: LauncherActivityInfo,
-        ): Category =
-            try {
-                ApplicationInfo
-                    .getCategoryTitle(
-                        context,
-                        info.applicationInfo.category,
-                    )?.let { Category(it.toString()) } ?: Category.Empty
-            } catch (e: Throwable) {
-                Category.Empty
-            }
+        ): Category = try {
+            ApplicationInfo
+                .getCategoryTitle(
+                    context,
+                    info.applicationInfo.category,
+                )?.let { Category(it.toString()) } ?: Category.Empty
+        } catch (e: Throwable) {
+            Category.Empty
+        }
     }
 }

+ 3 - 4
shared/src/androidMain/kotlin/org/mjdev/desktop/data/Theme.kt

@@ -123,9 +123,8 @@ class Theme(
             )
 
         // todo load from user settings
-        fun load(user: IUser): Theme =
-            themeCache[user.userName] ?: DEFAULT.apply {
-                themeCache[user.userName] = this
-            }
+        fun load(user: IUser): Theme = themeCache[user.userName] ?: DEFAULT.apply {
+            themeCache[user.userName] = this
+        }
     }
 }

+ 9 - 11
shared/src/androidMain/kotlin/org/mjdev/desktop/data/User.kt

@@ -69,18 +69,16 @@ class User(
         fun loadPicture(
             homeDir: File,
             picName: String,
-        ): File? =
-            File(homeDir, picName).let { f ->
-                if (f.exists()) f else null
-            }
+        ): File? = File(homeDir, picName).let { f ->
+            if (f.exists()) f else null
+        }
 
-        fun allUsers(context: IDesktopContext): List<User> =
-            if (context is DesktopContext) {
-                AccountManager.get(context.context).accounts.map { a ->
-                    User(a)
-                }
-            } else {
-                emptyList()
+        fun allUsers(context: IDesktopContext): List<User> = if (context is DesktopContext) {
+            AccountManager.get(context.context).accounts.map { a ->
+                User(a)
             }
+        } else {
+            emptyList()
+        }
     }
 }

+ 17 - 18
shared/src/androidMain/kotlin/org/mjdev/desktop/extensions/ImageBitmapExt.kt

@@ -11,22 +11,21 @@ import org.mjdev.desktop.context.IDesktopContext
 
 @Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
 actual object ImageBitmapExt {
-    actual suspend fun IDesktopContext.loadPicture(src: Any?): ImageBitmap? =
-        runCatching {
-            ImageRequest
-                .Builder(platformContext!!)
-                .data(
-                    when (src) {
-                        is Path -> src.toFile()
-                        else -> src.toString()
-                    },
-                ).build()
-                .let { req ->
-                    imageLoader
-                        ?.execute(req)
-                        ?.image
-                        ?.toBitmap()
-                        ?.asImageBitmap()
-                }
-        }.getOrNull()
+    actual suspend fun IDesktopContext.loadPicture(src: Any?): ImageBitmap? = runCatching {
+        ImageRequest
+            .Builder(platformContext!!)
+            .data(
+                when (src) {
+                    is Path -> src.toFile()
+                    else -> src.toString()
+                },
+            ).build()
+            .let { req ->
+                imageLoader
+                    ?.execute(req)
+                    ?.image
+                    ?.toBitmap()
+                    ?.asImageBitmap()
+            }
+    }.getOrNull()
 }

+ 8 - 9
shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/DecoderAndroid.kt

@@ -4,12 +4,11 @@ import android.graphics.BitmapFactory
 import androidx.compose.ui.graphics.asImageBitmap
 import org.mjdev.desktop.data.DecodedImage
 
-actual fun decodeImage(bytes: ByteArray): DecodedImage? =
-    try {
-        val bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
-        val imageBitmap = bmp.asImageBitmap()
-        DecodedImage(imageBitmap, bmp.width, bmp.height)
-    } catch (e: Exception) {
-        e.printStackTrace()
-        null
-    }
+actual fun decodeImage(bytes: ByteArray): DecodedImage? = try {
+    val bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
+    val imageBitmap = bmp.asImageBitmap()
+    DecodedImage(imageBitmap, bmp.width, bmp.height)
+} catch (e: Exception) {
+    e.printStackTrace()
+    null
+}

+ 17 - 18
shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/font/MaterialIconFont.android.kt

@@ -21,24 +21,23 @@ actual class MaterialIconFont actual constructor(
 
     private val cache: MutableMap<String, Int> = mutableMapOf()
 
-    override fun iconForName(iconName: String?): Int? =
-        runCatching {
-            if (iconName != null) {
-                if (cache.containsKey(iconName)) {
-                    cache[iconName]
-                } else {
-                    codePointsFile.icons
-                        .map { icon ->
-                            Pair(FuzzySearch.ratio(iconName, icon.key), icon)
-                        }.maxByOrNull { it.first }
-                        ?.second
-                        ?.value
-                        ?.also {
-                            cache[iconName] = it
-                        }
-                }
+    override fun iconForName(iconName: String?): Int? = runCatching {
+        if (iconName != null) {
+            if (cache.containsKey(iconName)) {
+                cache[iconName]
             } else {
-                null
+                codePointsFile.icons
+                    .map { icon ->
+                        Pair(FuzzySearch.ratio(iconName, icon.key), icon)
+                    }.maxByOrNull { it.first }
+                    ?.second
+                    ?.value
+                    ?.also {
+                        cache[iconName] = it
+                    }
             }
-        }.getOrNull()
+        } else {
+            null
+        }
+    }.getOrNull()
 }

+ 4 - 5
shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/gif/GifCacheDir.kt

@@ -5,8 +5,7 @@ import okio.Path.Companion.toPath
 
 // Animated GIF wallpapers are a desktop feature; on Android we just point at the JVM temp dir so
 // the shared code compiles and still works if ever used.
-actual fun gifCacheBaseDir(): Path =
-    (System.getProperty("java.io.tmpdir") ?: "/tmp")
-        .trimEnd('/')
-        .plus("/mjdev-desktop/gif-cache")
-        .toPath()
+actual fun gifCacheBaseDir(): Path = (System.getProperty("java.io.tmpdir") ?: "/tmp")
+    .trimEnd('/')
+    .plus("/mjdev-desktop/gif-cache")
+    .toPath()

+ 16 - 20
shared/src/androidMain/kotlin/org/mjdev/desktop/helpers/persistence/StorageProvider.kt

@@ -32,24 +32,20 @@ actual open class StorageProvider actual constructor(
     actual open fun get(
         key: String,
         default: String?,
-    ): String? =
-        prefs?.getString(
-            key,
-            default,
-        ) ?: throw IllegalStateException("SharedPreferences not initialized")
-
-    actual open fun remove(key: String) =
-        prefs?.edit {
-            remove(key)
-        } ?: throw IllegalStateException("SharedPreferences not initialized")
-
-    actual open fun clear() =
-        prefs?.edit {
-            clear()
-        } ?: throw IllegalStateException("SharedPreferences not initialized")
-
-    actual open fun getAll(): Map<String, String> =
-        prefs?.all?.mapValues { entry ->
-            entry.value?.toString() ?: ""
-        } ?: emptyMap()
+    ): String? = prefs?.getString(
+        key,
+        default,
+    ) ?: throw IllegalStateException("SharedPreferences not initialized")
+
+    actual open fun remove(key: String) = prefs?.edit {
+        remove(key)
+    } ?: throw IllegalStateException("SharedPreferences not initialized")
+
+    actual open fun clear() = prefs?.edit {
+        clear()
+    } ?: throw IllegalStateException("SharedPreferences not initialized")
+
+    actual open fun getAll(): Map<String, String> = prefs?.all?.mapValues { entry ->
+        entry.value?.toString() ?: ""
+    } ?: emptyMap()
 }

+ 1 - 2
shared/src/androidMain/kotlin/org/mjdev/desktop/managers/connectivity/ConnectivityManager.kt

@@ -3,8 +3,7 @@ package org.mjdev.desktop.managers.connectivity
 import org.mjdev.desktop.context.IDesktopContext
 
 @Suppress("FunctionName")
-fun ConnectivityManager(context: IDesktopContext) =
-    // when (hostOs) {
+fun ConnectivityManager(context: IDesktopContext) = // when (hostOs) {
 // todo other platforms
     // else ->
     ConnectivityManagerStub(context)

+ 3 - 4
shared/src/androidMain/kotlin/org/mjdev/desktop/managers/keys/KeysManager.kt

@@ -8,8 +8,7 @@ class KeysManager(
     val context: IDesktopContext,
     val scope: CoroutineScope = context.scope,
 ) : IKeyManager {
-    override fun loadKey(key: String): String =
-        runCatching {
-            ResourceStream("keys/$key.key").text
-        }.getOrNull().orEmpty()
+    override fun loadKey(key: String): String = runCatching {
+        ResourceStream("keys/$key.key").text
+    }.getOrNull().orEmpty()
 }

+ 1 - 2
shared/src/androidMain/kotlin/org/mjdev/desktop/managers/os/OSManager.kt

@@ -12,8 +12,7 @@ import org.mjdev.desktop.context.IDesktopContext
 import org.mjdev.desktop.managers.os.base.OSManagerStub
 
 @Suppress("FunctionName")
-fun OsManager(context: IDesktopContext) =
-    // when (hostOs) {
+fun OsManager(context: IDesktopContext) = // when (hostOs) {
 // todo other platforms
 // OS.Linux -> OSManagerLinux(context)
     // else ->

+ 1 - 2
shared/src/androidMain/kotlin/org/mjdev/desktop/managers/theme/ThemeManager.kt

@@ -13,8 +13,7 @@ import org.mjdev.desktop.managers.theme.base.ThemeManagerStub
 
 // todo other platforms
 @Suppress("FunctionName")
-fun ThemeManager(context: IDesktopContext) =
-    // when (hostOs) {
+fun ThemeManager(context: IDesktopContext) = // when (hostOs) {
 //    OS.Linux -> ThemeManagerLinux(context)
 //    else ->
     ThemeManagerStub(context)

+ 3 - 4
shared/src/androidMain/kotlin/org/mjdev/desktop/system/Filesystem.android.kt

@@ -81,10 +81,9 @@ actual object Filesystem : FileSystem() {
 
     actual fun readText(path: Path): String = SYSTEM.source(path).buffer().readString(Charset.forName("UTF-8"))
 
-    actual fun readLines(path: Path): List<String> =
-        readText(path)
-            .replace("\r", "")
-            .split("\n")
+    actual fun readLines(path: Path): List<String> = readText(path)
+        .replace("\r", "")
+        .split("\n")
 
     actual fun writeText(
         path: Path,

+ 132 - 136
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appbar/AppBar.kt

@@ -139,148 +139,144 @@ fun AppBar(
 
 @Preview
 @Composable
-fun PreviewAppBarHorizontal() =
-    preview {
-        AppBar(
-            modifier =
-                Modifier
-                    .height(48.dp)
-                    .background(Color.Green),
-            orientation = Orientation.Horizontal,
-            fillCenter = false,
-            icon = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Red),
-                )
-            },
-            title = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Blue),
-                )
-            },
-            actions = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp, 24.dp)
-                            .background(Color.Yellow),
-                )
-            },
-        )
-    }
+fun PreviewAppBarHorizontal() = preview {
+    AppBar(
+        modifier =
+            Modifier
+                .height(48.dp)
+                .background(Color.Green),
+        orientation = Orientation.Horizontal,
+        fillCenter = false,
+        icon = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Red),
+            )
+        },
+        title = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Blue),
+            )
+        },
+        actions = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp, 24.dp)
+                        .background(Color.Yellow),
+            )
+        },
+    )
+}
 
 @Preview
 @Composable
-fun PreviewAppBarHorizontalFill() =
-    preview {
-        AppBar(
-            modifier =
-                Modifier
-                    .height(48.dp)
-                    .background(Color.Green),
-            orientation = Orientation.Horizontal,
-            fillCenter = true,
-            icon = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Red),
-                )
-            },
-            title = {
-                Box(
-                    modifier =
-                        Modifier
-                            .fillMaxWidth()
-                            .height(24.dp)
-                            .background(Color.Blue),
-                )
-            },
-            actions = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp, 24.dp)
-                            .background(Color.Yellow),
-                )
-            },
-        )
-    }
+fun PreviewAppBarHorizontalFill() = preview {
+    AppBar(
+        modifier =
+            Modifier
+                .height(48.dp)
+                .background(Color.Green),
+        orientation = Orientation.Horizontal,
+        fillCenter = true,
+        icon = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Red),
+            )
+        },
+        title = {
+            Box(
+                modifier =
+                    Modifier
+                        .fillMaxWidth()
+                        .height(24.dp)
+                        .background(Color.Blue),
+            )
+        },
+        actions = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp, 24.dp)
+                        .background(Color.Yellow),
+            )
+        },
+    )
+}
 
 @Preview
 @Composable
-fun PreviewAppBarVertical() =
-    preview {
-        AppBar(
-            modifier = Modifier.background(Color.Green),
-            orientation = Orientation.Vertical,
-            fillCenter = false,
-            icon = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Red),
-                )
-            },
-            title = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Blue),
-                )
-            },
-            actions = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Yellow),
-                )
-            },
-        )
-    }
+fun PreviewAppBarVertical() = preview {
+    AppBar(
+        modifier = Modifier.background(Color.Green),
+        orientation = Orientation.Vertical,
+        fillCenter = false,
+        icon = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Red),
+            )
+        },
+        title = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Blue),
+            )
+        },
+        actions = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Yellow),
+            )
+        },
+    )
+}
 
 @Preview
 @Composable
-fun PreviewAppBarVerticalFill() =
-    preview {
-        AppBar(
-            modifier = Modifier.background(Color.Green),
-            orientation = Orientation.Vertical,
-            fillCenter = true,
-            icon = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Red),
-                )
-            },
-            title = {
-                Box(
-                    modifier =
-                        Modifier
-                            .width(24.dp)
-                            .fillMaxHeight()
-                            .background(Color.Blue),
-                )
-            },
-            actions = {
-                Box(
-                    modifier =
-                        Modifier
-                            .size(24.dp)
-                            .background(Color.Yellow),
-                )
-            },
-        )
-    }
+fun PreviewAppBarVerticalFill() = preview {
+    AppBar(
+        modifier = Modifier.background(Color.Green),
+        orientation = Orientation.Vertical,
+        fillCenter = true,
+        icon = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Red),
+            )
+        },
+        title = {
+            Box(
+                modifier =
+                    Modifier
+                        .width(24.dp)
+                        .fillMaxHeight()
+                        .background(Color.Blue),
+            )
+        },
+        actions = {
+            Box(
+                modifier =
+                    Modifier
+                        .size(24.dp)
+                        .background(Color.Yellow),
+            )
+        },
+    )
+}

+ 6 - 7
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/AppsMenu.kt

@@ -291,10 +291,9 @@ class AppsMenuState(
 
 @Preview
 @Composable
-fun PreviewAppsMenu() =
-    preview {
-        AppsMenu(
-            appsMenuState = rememberAppsMenuState(true),
-            panelState = rememberVisibilityState(true),
-        )
-    }
+fun PreviewAppsMenu() = preview {
+    AppsMenu(
+        appsMenuState = rememberAppsMenuState(true),
+        panelState = rememberVisibilityState(true),
+    )
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsBottomBar.kt

@@ -80,9 +80,8 @@ fun AppsBottomBar(
 
 @Preview
 @Composable
-fun PreviewAppsBottomBar() =
-    preview {
-        AppsBottomBar(
-            modifier = Modifier.background(Color.SuperDarkGray),
-        )
-    }
+fun PreviewAppsBottomBar() = preview {
+    AppsBottomBar(
+        modifier = Modifier.background(Color.SuperDarkGray),
+    )
+}

+ 13 - 14
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsList.kt

@@ -102,20 +102,19 @@ fun AppsList(
 
 @Preview
 @Composable
-fun PreviewAppsList() =
-    preview(320, 640) {
-        AppsList(
-            modifier =
-                Modifier
-                    .background(
-                        Color.SuperDarkGray,
-                        RoundedCornerShape(16.dp),
-                    ).padding(8.dp),
-            items =
-                listOf(
+fun PreviewAppsList() = preview(320, 640) {
+    AppsList(
+        modifier =
+            Modifier
+                .background(
+                    Color.SuperDarkGray,
+                    RoundedCornerShape(16.dp),
+                ).padding(8.dp),
+        items =
+            listOf(
 //            App.Test,
 //            App.Test,
 //            App.Test
-                ),
-        )
-    }
+            ),
+    )
+}

+ 8 - 9
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsMenuActions.kt

@@ -92,12 +92,11 @@ fun AppsMenuActions(
 
 @Preview
 @Composable
-fun PreviewAppsMenuActions() =
-    preview {
-        AppsMenuActions(
-            modifier =
-                Modifier
-                    .background(Color.SuperDarkGray, RoundedCornerShape(16.dp))
-                    .padding(8.dp),
-        )
-    }
+fun PreviewAppsMenuActions() = preview {
+    AppsMenuActions(
+        modifier =
+            Modifier
+                .background(Color.SuperDarkGray, RoundedCornerShape(16.dp))
+                .padding(8.dp),
+    )
+}

+ 12 - 13
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsMenuApp.kt

@@ -106,16 +106,15 @@ fun AppsMenuApp(
 
 @Preview
 @Composable
-fun PreviewAppsMenuApp() =
-    preview {
-        AppsMenuApp(
-            modifier =
-                Modifier
-                    .padding(8.dp)
-                    .background(
-                        Color.SuperDarkGray,
-                        RoundedCornerShape(16.dp),
-                    ).padding(8.dp),
-            app = null, // App.Test
-        )
-    }
+fun PreviewAppsMenuApp() = preview {
+    AppsMenuApp(
+        modifier =
+            Modifier
+                .padding(8.dp)
+                .background(
+                    Color.SuperDarkGray,
+                    RoundedCornerShape(16.dp),
+                ).padding(8.dp),
+        app = null, // App.Test
+    )
+}

+ 12 - 13
shared/src/commonMain/kotlin/org/mjdev/desktop/components/appsmenu/components/AppsMenuCategory.kt

@@ -97,16 +97,15 @@ fun AppsMenuCategory(
 
 @Preview
 @Composable
-fun PreviewAppsMenuCategory() =
-    preview {
-        AppsMenuCategory(
-            modifier =
-                Modifier
-                    .padding(8.dp)
-                    .background(
-                        Color.SuperDarkGray,
-                        RoundedCornerShape(16.dp),
-                    ).padding(8.dp),
-            category = Category("Audio"),
-        )
-    }
+fun PreviewAppsMenuCategory() = preview {
+    AppsMenuCategory(
+        modifier =
+            Modifier
+                .padding(8.dp)
+                .background(
+                    Color.SuperDarkGray,
+                    RoundedCornerShape(16.dp),
+                ).padding(8.dp),
+        category = Category("Audio"),
+    )
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/background/BackgroundImage.kt

@@ -113,7 +113,6 @@ fun BackgroundImage(
 @Suppress("unused")
 @Preview
 @Composable
-fun PreviewBackgroundImage() =
-    preview {
-        BackgroundImage()
-    }
+fun PreviewBackgroundImage() = preview {
+    BackgroundImage()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/blur/BlurPanel.kt

@@ -87,7 +87,6 @@ fun BlurPanel(
 
 @Preview
 @Composable
-fun PreviewBlurPanel() =
-    preview(480, 800) {
-        BlurPanel()
-    }
+fun PreviewBlurPanel() = preview(480, 800) {
+    BlurPanel()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/button/ButtonPrimary.kt

@@ -35,7 +35,6 @@ fun ButtonPrimary(
 
 @Preview
 @Composable
-fun PreviewButtonPrimary() =
-    preview {
-        ButtonPrimary()
-    }
+fun PreviewButtonPrimary() = preview {
+    ButtonPrimary()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/button/ButtonSecondary.kt

@@ -36,7 +36,6 @@ fun ButtonSecondary(
 
 @Preview
 @Composable
-fun PreviewButtonSecondary() =
-    preview {
-        ButtonSecondary()
-    }
+fun PreviewButtonSecondary() = preview {
+    ButtonSecondary()
+}

+ 8 - 9
shared/src/commonMain/kotlin/org/mjdev/desktop/components/button/TransparentButton.kt

@@ -39,13 +39,12 @@ fun TransparentButton(
 
 @Preview
 @Composable
-fun PreviewTransparentButton() =
-    preview {
-        TransparentButton {
-            Icon(
-                imageVector = AccountCircle,
-                contentDescription = "",
-                tint = Color.White,
-            )
-        }
+fun PreviewTransparentButton() = preview {
+    TransparentButton {
+        Icon(
+            imageVector = AccountCircle,
+            contentDescription = "",
+            tint = Color.White,
+        )
     }
+}

+ 11 - 12
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/Card.kt

@@ -61,15 +61,14 @@ fun Card(
 
 @Preview
 @Composable
-fun PreviewCard() =
-    preview {
-        Card(
-            modifier = Modifier.size(200.dp, 128.dp),
-            colors =
-                CardDefaults.colors(
-                    containerColor = Color.White,
-                ),
-            border = CardDefaults.border(2.dp),
-            glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
-        )
-    }
+fun PreviewCard() = preview {
+    Card(
+        modifier = Modifier.size(200.dp, 128.dp),
+        colors =
+            CardDefaults.colors(
+                containerColor = Color.White,
+            ),
+        border = CardDefaults.border(2.dp),
+        glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
+    )
+}

+ 13 - 14
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/CardContent.kt

@@ -46,17 +46,16 @@ fun CardContent(
 
 @Preview
 @Composable
-fun PreviewCardContent() =
-    preview {
-        CardContent(
-            title = {
-                Text("title")
-            },
-            subtitle = {
-                Text("subtitle")
-            },
-            description = {
-                Text("description")
-            },
-        )
-    }
+fun PreviewCardContent() = preview {
+    CardContent(
+        title = {
+            Text("title")
+        },
+        subtitle = {
+            Text("subtitle")
+        },
+        description = {
+            Text("description")
+        },
+    )
+}

+ 28 - 29
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/ClassicCard.kt

@@ -69,32 +69,31 @@ fun ClassicCard(
 
 @Preview
 @Composable
-fun PreviewClassicCard() =
-    preview {
-        ClassicCard(
-            modifier = Modifier.size(320.dp, 200.dp),
-            colors =
-                CardDefaults.colors(
-                    containerColor = Color.White,
-                ),
-            border = CardDefaults.border(2.dp),
-            glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
-            contentPadding = PaddingValues(8.dp),
-            scale = CardDefaults.scale(1f),
-            image = {
-                ImageAny(
-                    src = AccountCircle,
-                    contentDescription = "",
-                )
-            },
-            title = {
-                TextAny("title")
-            },
-            subtitle = {
-                TextAny("subtitle")
-            },
-            description = {
-                TextAny("description")
-            },
-        )
-    }
+fun PreviewClassicCard() = preview {
+    ClassicCard(
+        modifier = Modifier.size(320.dp, 200.dp),
+        colors =
+            CardDefaults.colors(
+                containerColor = Color.White,
+            ),
+        border = CardDefaults.border(2.dp),
+        glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
+        contentPadding = PaddingValues(8.dp),
+        scale = CardDefaults.scale(1f),
+        image = {
+            ImageAny(
+                src = AccountCircle,
+                contentDescription = "",
+            )
+        },
+        title = {
+            TextAny("title")
+        },
+        subtitle = {
+            TextAny("subtitle")
+        },
+        description = {
+            TextAny("description")
+        },
+    )
+}

+ 29 - 30
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/CompactCard.kt

@@ -88,33 +88,32 @@ fun CompactCard(
 
 @Preview
 @Composable
-fun CompactCardPreview() =
-    preview {
-        CompactCard(
-            modifier = Modifier.size(200.dp, 128.dp),
-            colors =
-                CardDefaults.colors(
-                    containerColor = Color.White,
-                ),
-            border = CardDefaults.border(),
-            glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
-            scale = CardDefaults.scale(1f),
-            scrimBrush = CardDefaults.ScrimBrush,
-            image = {
-                ImageAny(
-                    modifier = Modifier.fillMaxSize(),
-                    src = AccountCircle,
-                    contentDescription = "",
-                )
-            },
-            title = {
-                TextAny("title")
-            },
-            subtitle = {
-                TextAny("subtitle")
-            },
-            description = {
-                TextAny("description")
-            },
-        )
-    }
+fun CompactCardPreview() = preview {
+    CompactCard(
+        modifier = Modifier.size(200.dp, 128.dp),
+        colors =
+            CardDefaults.colors(
+                containerColor = Color.White,
+            ),
+        border = CardDefaults.border(),
+        glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
+        scale = CardDefaults.scale(1f),
+        scrimBrush = CardDefaults.ScrimBrush,
+        image = {
+            ImageAny(
+                modifier = Modifier.fillMaxSize(),
+                src = AccountCircle,
+                contentDescription = "",
+            )
+        },
+        title = {
+            TextAny("title")
+        },
+        subtitle = {
+            TextAny("subtitle")
+        },
+        description = {
+            TextAny("description")
+        },
+    )
+}

+ 18 - 19
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/FocusableCard.kt

@@ -181,22 +181,21 @@ fun FocusableCard(
 
 @Preview
 @Composable
-fun PreviewFocusableCard() =
-    preview {
-        FocusableCard(
-            item = "test",
-            modifier = Modifier.size(200.dp, 128.dp),
-            colors =
-                CardDefaults.colors(
-                    containerColor = Color.White,
-                ),
-            border = CardDefaults.border(),
-            glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
-            scale = CardDefaults.scale(1f),
-            contentScale = ContentScale.Crop,
-            textColor = Color.Black,
-            showTitle = true,
-            focused = true,
-            aspectRatio = HorizontalImageAspectRatio,
-        )
-    }
+fun PreviewFocusableCard() = preview {
+    FocusableCard(
+        item = "test",
+        modifier = Modifier.size(200.dp, 128.dp),
+        colors =
+            CardDefaults.colors(
+                containerColor = Color.White,
+            ),
+        border = CardDefaults.border(),
+        glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
+        scale = CardDefaults.scale(1f),
+        contentScale = ContentScale.Crop,
+        textColor = Color.Black,
+        showTitle = true,
+        focused = true,
+        aspectRatio = HorizontalImageAspectRatio,
+    )
+}

+ 18 - 19
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/ItemCard.kt

@@ -105,22 +105,21 @@ fun ItemCard(
 
 @Preview
 @Composable
-fun PreviewItemCard() =
-    preview {
-        ItemCard(
-            item = "test",
-            modifier = Modifier.size(200.dp, 128.dp),
-            colors =
-                CardDefaults.colors(
-                    containerColor = Color.White,
-                ),
-            border = CardDefaults.border(),
-            glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
-            scale = CardDefaults.scale(1f),
-            contentScale = ContentScale.Crop,
-            textColor = Color.Black,
-            showTitle = true,
-            focused = true,
-            aspectRatio = HorizontalImageAspectRatio,
-        )
-    }
+fun PreviewItemCard() = preview {
+    ItemCard(
+        item = "test",
+        modifier = Modifier.size(200.dp, 128.dp),
+        colors =
+            CardDefaults.colors(
+                containerColor = Color.White,
+            ),
+        border = CardDefaults.border(),
+        glow = CardDefaults.glow(glow = Glow(Color.Green, 4.dp)),
+        scale = CardDefaults.scale(1f),
+        contentScale = ContentScale.Crop,
+        textColor = Color.Black,
+        showTitle = true,
+        focused = true,
+        aspectRatio = HorizontalImageAspectRatio,
+    )
+}

+ 17 - 19
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/PhotoCard.kt

@@ -90,25 +90,23 @@ fun PhotoCard(
 fun computeCardWidth(
     api: IDesktopContext = LocalDesktopContext.current,
     ratio: Float = 2.5f,
-): Dp =
-    if (api.containerSize.let { it.height > it.width }) {
-        api.containerSize.width / ratio
-    } else {
-        api.containerSize.height / ratio
-    }
+): Dp = if (api.containerSize.let { it.height > it.width }) {
+    api.containerSize.width / ratio
+} else {
+    api.containerSize.height / ratio
+}
 
 @Preview
 @Composable
-fun PreviewPhotoCard() =
-    preview {
-        PhotoCard(
-            item = "test",
-            modifier = Modifier.size(200.dp, 128.dp),
-            scale = CardDefaults.scale(1f),
-            contentScale = ContentScale.Crop,
-            textColor = Color.Black,
-            showTitle = true,
-            focused = true,
-            aspectRatio = HorizontalImageAspectRatio,
-        )
-    }
+fun PreviewPhotoCard() = preview {
+    PhotoCard(
+        item = "test",
+        modifier = Modifier.size(200.dp, 128.dp),
+        scale = CardDefaults.scale(1f),
+        contentScale = ContentScale.Crop,
+        textColor = Color.Black,
+        showTitle = true,
+        focused = true,
+        aspectRatio = HorizontalImageAspectRatio,
+    )
+}

+ 30 - 31
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/WideClassicCard.kt

@@ -69,34 +69,33 @@ fun WideClassicCard(
 
 @Preview
 @Composable
-fun PreviewWideClassicCard() =
-    preview {
-        WideClassicCard(
-            colors =
-                CardDefaults.colors(
-                    containerColor = Color.White,
-                ),
-            border = CardDefaults.border(),
-            glow =
-                CardDefaults.glow(
-                    glow = Glow(Color.Green, 4.dp),
-                ),
-            contentPadding = PaddingValues(8.dp),
-            scale = CardDefaults.scale(1f),
-            image = {
-                ImageAny(
-                    src = AccountCircle,
-                    contentDescription = "",
-                )
-            },
-            title = {
-                TextAny("title")
-            },
-            subtitle = {
-                TextAny("subtitle")
-            },
-            description = {
-                TextAny("description")
-            },
-        )
-    }
+fun PreviewWideClassicCard() = preview {
+    WideClassicCard(
+        colors =
+            CardDefaults.colors(
+                containerColor = Color.White,
+            ),
+        border = CardDefaults.border(),
+        glow =
+            CardDefaults.glow(
+                glow = Glow(Color.Green, 4.dp),
+            ),
+        contentPadding = PaddingValues(8.dp),
+        scale = CardDefaults.scale(1f),
+        image = {
+            ImageAny(
+                src = AccountCircle,
+                contentDescription = "",
+            )
+        },
+        title = {
+            TextAny("title")
+        },
+        subtitle = {
+            TextAny("subtitle")
+        },
+        description = {
+            TextAny("description")
+        },
+    )
+}

+ 2 - 3
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/base/CardBorder.kt

@@ -34,7 +34,6 @@ class CardBorder(
         return result
     }
 
-    override fun toString(): String =
-        "CardBorder(border=$border, focusedBorder=$focusedBorder, " +
-            "pressedBorder=$pressedBorder)"
+    override fun toString(): String = "CardBorder(border=$border, focusedBorder=$focusedBorder, " +
+        "pressedBorder=$pressedBorder)"
 }

+ 7 - 8
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/base/CardColors.kt

@@ -43,12 +43,11 @@ class CardColors(
         return result
     }
 
-    override fun toString(): String =
-        "CardColors(" +
-            "containerColor=$containerColor, " +
-            "contentColor=$contentColor, " +
-            "focusedContainerColor=$focusedContainerColor, " +
-            "focusedContentColor=$focusedContentColor, " +
-            "pressedContainerColor=$pressedContainerColor, " +
-            "pressedContentColor=$pressedContentColor)"
+    override fun toString(): String = "CardColors(" +
+        "containerColor=$containerColor, " +
+        "contentColor=$contentColor, " +
+        "focusedContainerColor=$focusedContainerColor, " +
+        "focusedContentColor=$focusedContentColor, " +
+        "pressedContainerColor=$pressedContainerColor, " +
+        "pressedContentColor=$pressedContentColor)"
 }

+ 53 - 59
shared/src/commonMain/kotlin/org/mjdev/desktop/components/card/base/CardDefaults.kt

@@ -132,24 +132,23 @@ object CardDefaults {
         focusColor: Color = Color.Green,
         onUnFocusColor: Color = Color.Transparent,
         elevation: Dp = 10.dp,
-    ): CardGlow =
-        glow(
-            glow =
-                Glow(
-                    elevationColor = onUnFocusColor,
-                    elevation = elevation,
-                ),
-            focusedGlow =
-                Glow(
-                    elevationColor = focusColor,
-                    elevation = elevation,
-                ),
-            pressedGlow =
-                Glow(
-                    elevationColor = onUnFocusColor,
-                    elevation = elevation,
-                ),
-        )
+    ): CardGlow = glow(
+        glow =
+            Glow(
+                elevationColor = onUnFocusColor,
+                elevation = elevation,
+            ),
+        focusedGlow =
+            Glow(
+                elevationColor = focusColor,
+                elevation = elevation,
+            ),
+        pressedGlow =
+            Glow(
+                elevationColor = onUnFocusColor,
+                elevation = elevation,
+            ),
+    )
 
     fun scale(
         scale: Float = 1f,
@@ -204,49 +203,44 @@ object CardDefaults {
         pressedGlow = pressedGlow,
     )
 
-    fun CardColors.toClickableSurfaceColors() =
-        ClickableSurfaceColors(
-            containerColor = containerColor,
-            contentColor = contentColor,
-            focusedContainerColor = focusedContainerColor,
-            focusedContentColor = focusedContentColor,
-            pressedContainerColor = pressedContainerColor,
-            pressedContentColor = pressedContentColor,
-            disabledContainerColor = containerColor,
-            disabledContentColor = contentColor,
-        )
+    fun CardColors.toClickableSurfaceColors() = ClickableSurfaceColors(
+        containerColor = containerColor,
+        contentColor = contentColor,
+        focusedContainerColor = focusedContainerColor,
+        focusedContentColor = focusedContentColor,
+        pressedContainerColor = pressedContainerColor,
+        pressedContentColor = pressedContentColor,
+        disabledContainerColor = containerColor,
+        disabledContentColor = contentColor,
+    )
 
-    fun CardShape.toClickableSurfaceShape() =
-        ClickableSurfaceShape(
-            shape = shape,
-            focusedShape = focusedShape,
-            pressedShape = pressedShape,
-            disabledShape = shape,
-            focusedDisabledShape = shape,
-        )
+    fun CardShape.toClickableSurfaceShape() = ClickableSurfaceShape(
+        shape = shape,
+        focusedShape = focusedShape,
+        pressedShape = pressedShape,
+        disabledShape = shape,
+        focusedDisabledShape = shape,
+    )
 
-    fun CardScale.toClickableSurfaceScale() =
-        ClickableSurfaceScale(
-            scale = scale,
-            focusedScale = focusedScale,
-            pressedScale = pressedScale,
-            disabledScale = scale,
-            focusedDisabledScale = scale,
-        )
+    fun CardScale.toClickableSurfaceScale() = ClickableSurfaceScale(
+        scale = scale,
+        focusedScale = focusedScale,
+        pressedScale = pressedScale,
+        disabledScale = scale,
+        focusedDisabledScale = scale,
+    )
 
-    fun CardBorder.toClickableSurfaceBorder() =
-        ClickableSurfaceBorder(
-            border = border,
-            focusedBorder = focusedBorder,
-            pressedBorder = pressedBorder,
-            disabledBorder = border,
-            focusedDisabledBorder = border,
-        )
+    fun CardBorder.toClickableSurfaceBorder() = ClickableSurfaceBorder(
+        border = border,
+        focusedBorder = focusedBorder,
+        pressedBorder = pressedBorder,
+        disabledBorder = border,
+        focusedDisabledBorder = border,
+    )
 
-    fun CardGlow.toClickableSurfaceGlow() =
-        ClickableSurfaceGlow(
-            glow = glow,
-            focusedGlow = focusedGlow,
-            pressedGlow = pressedGlow,
-        )
+    fun CardGlow.toClickableSurfaceGlow() = ClickableSurfaceGlow(
+        glow = glow,
+        focusedGlow = focusedGlow,
+        pressedGlow = pressedGlow,
+    )
 }

+ 16 - 17
shared/src/commonMain/kotlin/org/mjdev/desktop/components/chart/DonutChart.kt

@@ -68,20 +68,19 @@ fun DonutChart(
 
 @Preview
 @Composable
-fun PreviewDonutChart() =
-    preview(480) {
-        DonutChart(
-            textColor = Color.White,
-            outerCircularColor = Color.White,
-            innerCircularColor = Color.White,
-            ratioLineColor = Color.White,
-            title = "Donut Chart",
-            legendPosition = LegendPosition.BOTTOM,
-            dataHandler = {
-                listOf(
-                    PieChartData(24.0, Color.Blue, "test1"),
-                    PieChartData(32.0, Color.Gray, "test2"),
-                )
-            },
-        )
-    }
+fun PreviewDonutChart() = preview(480) {
+    DonutChart(
+        textColor = Color.White,
+        outerCircularColor = Color.White,
+        innerCircularColor = Color.White,
+        ratioLineColor = Color.White,
+        title = "Donut Chart",
+        legendPosition = LegendPosition.BOTTOM,
+        dataHandler = {
+            listOf(
+                PieChartData(24.0, Color.Blue, "test1"),
+                PieChartData(32.0, Color.Gray, "test2"),
+            )
+        },
+    )
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/ControlCenter.kt

@@ -190,9 +190,8 @@ fun ControlCenter(
 
 @Preview
 @Composable
-fun PreviewControlCenter() =
-    preview {
-        ControlCenter(
-            controlCenterState = rememberVisibilityState(true),
-        )
-    }
+fun PreviewControlCenter() = preview {
+    ControlCenter(
+        controlCenterState = rememberVisibilityState(true),
+    )
+}

+ 2 - 1
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/base/ControlCenterPageScope.kt

@@ -24,7 +24,8 @@ class ControlCenterPageScope(
         }
 
         @Composable
-        fun <T> ControlCenterPageScope.remember(calculation: @DisallowComposableCalls () -> T): T = cache.cache(false, calculation)
+        fun <T> ControlCenterPageScope.remember(calculation: @DisallowComposableCalls () -> T): T =
+            cache.cache(false, calculation)
 
         @Composable
         fun <T> ControlCenterPageScope.rememberComputed(

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/base/PageHeader.kt

@@ -79,9 +79,8 @@ fun PageHeader(
 
 @Preview
 @Composable
-fun PreviewPageHeader() =
-    preview {
-        PageHeader(
-            page = ControlCenterPage(context),
-        )
-    }
+fun PreviewPageHeader() = preview {
+    PageHeader(
+        page = ControlCenterPage(context),
+    )
+}

+ 11 - 12
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/base/PersistentPageSaver.kt

@@ -15,17 +15,16 @@ class PersistentPageSaver(
         context.storageProvider.put(key, data.asJson())
     }
 
-    override fun load(): Map<Int, Any> =
-        runCatching {
-            Log.d("Loading data for $key")
-            context.storageProvider.get(key)?.to<Map<Int, Any>>()
-        }.onFailure { e ->
-            Log.e(e)
-        }.getOrNull() ?: emptyMap<Int, Any>().also { data ->
-            if (data.isEmpty()) {
-                Log.d("No data found for $key, returning empty map.")
-            } else {
-                Log.d("Loaded data for $key: $data.")
-            }
+    override fun load(): Map<Int, Any> = runCatching {
+        Log.d("Loading data for $key")
+        context.storageProvider.get(key)?.to<Map<Int, Any>>()
+    }.onFailure { e ->
+        Log.e(e)
+    }.getOrNull() ?: emptyMap<Int, Any>().also { data ->
+        if (data.isEmpty()) {
+            Log.d("No data found for $key, returning empty map.")
+        } else {
+            Log.d("Loaded data for $key: $data.")
         }
+    }
 }

+ 13 - 15
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/about/AboutPage.kt

@@ -11,21 +11,19 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.custom.Mjdev
 
 @Suppress("FunctionName")
-fun AboutPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = Mjdev,
-        name = "About",
-        condition = { true },
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+fun AboutPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = Mjdev,
+    name = "About",
+    condition = { true },
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun PreviewAboutPage() =
-    preview {
-        AboutPage(context).Render()
-    }
+fun PreviewAboutPage() = preview {
+    AboutPage(context).Render()
+}

+ 82 - 84
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/ai/AIPage.kt

@@ -46,97 +46,96 @@ import org.mjdev.desktop.icons.chat.Chat
 import org.mjdev.desktop.icons.system.ContentCopy
 
 @Suppress("FunctionName")
-fun AIPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = Chat,
-        name = "Assistant",
-        condition = {
-            ai.isAvailable()
-        },
-        saver = { ctx ->
-            PersistentPageSaver(ctx, "Assistant") // todo name
-        },
-    ) {
-        val scrollState = rememberForeverLazyListState("Assistant")
-        val questionsList = remember { mutableStateListOf<Pair<String, String>>() }
-        val request = remember { mutableStateOf("") }
-        val onDone: () -> Unit = {
-            val what = request.value.replace("\n", "")
-            if (what.isNotEmpty()) {
-                questionsList.add(Pair(what, ""))
-                request.value = ""
-                scrollState.scrollWithAnimToLast(scope)
-                context.ai.ask(what) { _, res ->
-                    res
-                        .replace("* **", "")
-                        .replace("**", "")
-                        .trim()
-                        .let { resx ->
-                            questionsList.replaceLast(Pair(what, resx))
-                            scrollState.scrollWithAnimToLast(scope)
-                            context.ai.say(resx)
-                        }
-                }
+fun AIPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = Chat,
+    name = "Assistant",
+    condition = {
+        ai.isAvailable()
+    },
+    saver = { ctx ->
+        PersistentPageSaver(ctx, "Assistant") // todo name
+    },
+) {
+    val scrollState = rememberForeverLazyListState("Assistant")
+    val questionsList = remember { mutableStateListOf<Pair<String, String>>() }
+    val request = remember { mutableStateOf("") }
+    val onDone: () -> Unit = {
+        val what = request.value.replace("\n", "")
+        if (what.isNotEmpty()) {
+            questionsList.add(Pair(what, ""))
+            request.value = ""
+            scrollState.scrollWithAnimToLast(scope)
+            context.ai.ask(what) { _, res ->
+                res
+                    .replace("* **", "")
+                    .replace("**", "")
+                    .trim()
+                    .let { resx ->
+                        questionsList.replaceLast(Pair(what, resx))
+                        scrollState.scrollWithAnimToLast(scope)
+                        context.ai.say(resx)
+                    }
             }
         }
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        ) {
-            Row {
-                Column(
+    }
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    ) {
+        Row {
+            Column(
+                modifier =
+                    Modifier
+                        .fillMaxSize()
+                        .padding(16.dp),
+            ) {
+                JetLimeColumn(
                     modifier =
                         Modifier
-                            .fillMaxSize()
-                            .padding(16.dp),
-                ) {
-                    JetLimeColumn(
-                        modifier =
-                            Modifier
-                                .fillMaxWidth()
-                                .weight(1f)
-                                .background(
-                                    Color.Black.copy(alpha = 0.3f),
-                                    RoundedCornerShape(8.dp),
-                                ).verticalTouchScrollable(scrollState),
-                        itemsList = ItemsList(questionsList),
+                            .fillMaxWidth()
+                            .weight(1f)
+                            .background(
+                                Color.Black.copy(alpha = 0.3f),
+                                RoundedCornerShape(8.dp),
+                            ).verticalTouchScrollable(scrollState),
+                    itemsList = ItemsList(questionsList),
+                    style =
+                        JetLimeDefaults.columnStyle(
+                            lineThickness = 2.dp,
+                            lineBrush =
+                                JetLimeDefaults.lineSolidBrush(
+                                    color = Color.White.alpha(0.6f),
+                                ),
+                        ),
+                ) { idx, item, position ->
+                    JetLimeEvent(
                         style =
-                            JetLimeDefaults.columnStyle(
-                                lineThickness = 2.dp,
-                                lineBrush =
-                                    JetLimeDefaults.lineSolidBrush(
-                                        color = Color.White.alpha(0.6f),
-                                    ),
+                            JetLimeEventDefaults.eventStyle(
+                                pointColor = Color.Black,
+                                pointFillColor = Color.White.alpha(0.5f),
+                                pointRadius = 8.dp,
+                                position = position,
+                                pointAnimation = JetLimeEventDefaults.pointAnimation(),
+                                pointType = EventPointType.filled(0.8f),
+                                pointStrokeWidth = 2.dp,
+                                pointStrokeColor = Color.Black,
                             ),
-                    ) { idx, item, position ->
-                        JetLimeEvent(
-                            style =
-                                JetLimeEventDefaults.eventStyle(
-                                    pointColor = Color.Black,
-                                    pointFillColor = Color.White.alpha(0.5f),
-                                    pointRadius = 8.dp,
-                                    position = position,
-                                    pointAnimation = JetLimeEventDefaults.pointAnimation(),
-                                    pointType = EventPointType.filled(0.8f),
-                                    pointStrokeWidth = 2.dp,
-                                    pointStrokeColor = Color.Black,
-                                ),
-                        ) {
-                            TimeLineItem(
-                                idx = idx,
-                                item = item,
-                            )
-                        }
+                    ) {
+                        TimeLineItem(
+                            idx = idx,
+                            item = item,
+                        )
                     }
-                    TextArea(
-                        modifier = Modifier.padding(top = 8.dp).fillMaxWidth(),
-                        textState = request,
-                        onDone = onDone,
-                    )
                 }
+                TextArea(
+                    modifier = Modifier.padding(top = 8.dp).fillMaxWidth(),
+                    textState = request,
+                    onDone = onDone,
+                )
             }
         }
     }
+}
 
 @Composable
 fun TimeLineItem(
@@ -210,7 +209,6 @@ fun TextBlock(
 
 @Preview
 @Composable
-fun PreviewAIPage() =
-    preview {
-        AIPage(context).Render()
-    }
+fun PreviewAIPage() = preview {
+    AIPage(context).Render()
+}

+ 15 - 17
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/bluetooth/BluetoothSettingsPage.kt

@@ -11,24 +11,22 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.network.Bluetooth
 
 @Suppress("FunctionName")
-fun BluetoothSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = Bluetooth,
-        name = "Bluetooth",
-        condition = {
-            false
+fun BluetoothSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = Bluetooth,
+    name = "Bluetooth",
+    condition = {
+        false
 //        connectionManager.isBthAdapterAvailable
-        },
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+    },
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun BluetoothSettingsPagePreview() =
-    preview {
-        BluetoothSettingsPage(context).Render()
-    }
+fun BluetoothSettingsPagePreview() = preview {
+    BluetoothSettingsPage(context).Render()
+}

+ 175 - 170
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/desktop/DesktopSettingsPage.kt

@@ -42,196 +42,201 @@ import org.mjdev.desktop.icons.settings.SettingsMonitor
  * save writes the JSON back, applies it to the live theme and rebuilds the background sources.
  */
 @Suppress("FunctionName")
-fun DesktopSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = SettingsMonitor,
-        name = "Desktop",
-    ) {
-        val store = remember { DesktopConfigStore(currentUser) }
-        var data by remember { mutableStateOf(store.load()) }
+fun DesktopSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = SettingsMonitor,
+    name = "Desktop",
+) {
+    val store = remember { DesktopConfigStore(currentUser) }
+    var data by remember { mutableStateOf(store.load()) }
 
-        Box(
-            modifier = Modifier.fillMaxSize(),
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    ) {
+        Column(
+            modifier =
+                Modifier
+                    .fillMaxSize()
+                    .verticalScroll(rememberScrollState())
+                    .padding(16.dp)
+                    .padding(bottom = 56.dp),
         ) {
-            Column(
-                modifier =
-                    Modifier
-                        .fillMaxSize()
-                        .verticalScroll(rememberScrollState())
-                        .padding(16.dp)
-                        .padding(bottom = 56.dp),
-            ) {
-                SettingsSection(title = "Background") {
-                    SettingsSliderRow(
-                        label = "Rotation delay",
-                        value = data.backgroundRotationDelay.toFloat(),
-                        valueRange = 5_000f..600_000f,
-                        format = { "${(it / 1000f).toInt()}s" },
-                        onValueChange = { data = data.copy(backgroundRotationDelay = it.toLong()) },
+            SettingsSection(title = "Background") {
+                SettingsSliderRow(
+                    label = "Rotation delay",
+                    value = data.backgroundRotationDelay.toFloat(),
+                    valueRange = 5_000f..600_000f,
+                    format = { "${(it / 1000f).toInt()}s" },
+                    onValueChange = { data = data.copy(backgroundRotationDelay = it.toLong()) },
+                )
+                data.providers.forEach { provider ->
+                    SettingsSwitchRow(
+                        label = provider.label,
+                        checked = provider.enabled,
+                        onCheckedChange = { enabled ->
+                            data =
+                                data.copy(
+                                    providers =
+                                        data.providers
+                                            .map { p -> if (p.id == provider.id) p.copy(enabled = enabled) else p }
+                                            .toMutableList(),
+                                )
+                        },
                     )
-                    data.providers.forEach { provider ->
-                        SettingsSwitchRow(
-                            label = provider.label,
-                            checked = provider.enabled,
-                            onCheckedChange = { enabled ->
+                    if (provider.enabled && provider.hasLoadCount) {
+                        SettingsSliderRow(
+                            label = "  ${provider.label} images",
+                            value = provider.loadCount.toFloat(),
+                            valueRange = 1f..50f,
+                            steps = 48,
+                            onValueChange = { count ->
                                 data =
                                     data.copy(
                                         providers =
                                             data.providers
-                                                .map { p -> if (p.id == provider.id) p.copy(enabled = enabled) else p }
-                                                .toMutableList(),
+                                                .map { p ->
+                                                    if (p.id ==
+                                                        provider.id
+                                                    ) {
+                                                        p.copy(loadCount = count.toInt())
+                                                    } else {
+                                                        p
+                                                    }
+                                                }.toMutableList(),
                                     )
                             },
                         )
-                        if (provider.enabled && provider.hasLoadCount) {
-                            SettingsSliderRow(
-                                label = "  ${provider.label} images",
-                                value = provider.loadCount.toFloat(),
-                                valueRange = 1f..50f,
-                                steps = 48,
-                                onValueChange = { count ->
-                                    data =
-                                        data.copy(
-                                            providers =
-                                                data.providers
-                                                    .map { p -> if (p.id == provider.id) p.copy(loadCount = count.toInt()) else p }
-                                                    .toMutableList(),
-                                        )
-                                },
-                            )
-                        }
                     }
                 }
+            }
 
-                SettingsSection(title = "Panel") {
-                    SettingsSelectRow(
-                        label = "Location",
-                        selected = data.panelLocation,
-                        options = PanelLocation.entries.map { it.name },
-                        onSelected = { data = data.copy(panelLocation = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Auto-hide delay",
-                        value = data.panelHideDelay.toFloat(),
-                        valueRange = 0f..10_000f,
-                        format = { if (it <= 0f) "off" else "${(it / 1000f).toInt()}s" },
-                        onValueChange = { data = data.copy(panelHideDelay = it.toLong()) },
-                    )
-                    SettingsSliderRow(
-                        label = "Divider width",
-                        value = data.panelDividerWidth,
-                        valueRange = 0f..32f,
-                        format = { "${it.toInt()}dp" },
-                        onValueChange = { data = data.copy(panelDividerWidth = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Content padding",
-                        value = data.panelContentPadding,
-                        valueRange = 0f..32f,
-                        format = { "${it.toInt()}dp" },
-                        onValueChange = { data = data.copy(panelContentPadding = it) },
-                    )
-                }
-
-                SettingsSection(title = "Control center") {
-                    SettingsSelectRow(
-                        label = "Location",
-                        selected = data.controlCenterLocation,
-                        options = ControlCenterLocation.entries.map { it.name },
-                        onSelected = { data = data.copy(controlCenterLocation = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Auto-hide delay",
-                        value = data.controlPanelHideDelay.toFloat(),
-                        valueRange = 0f..10_000f,
-                        format = { if (it <= 0f) "off" else "${(it / 1000f).toInt()}s" },
-                        onValueChange = { data = data.copy(controlPanelHideDelay = it.toLong()) },
-                    )
-                    SettingsSliderRow(
-                        label = "Expanded width",
-                        value = data.controlCenterExpandedWidthPercent.toFloat(),
-                        valueRange = 10f..80f,
-                        steps = 69,
-                        format = { "${it.toInt()}%" },
-                        onValueChange = { data = data.copy(controlCenterExpandedWidthPercent = it.toInt()) },
-                    )
-                    SettingsSliderRow(
-                        label = "Divider width",
-                        value = data.controlCenterDividerWidth,
-                        valueRange = 0f..32f,
-                        format = { "${it.toInt()}dp" },
-                        onValueChange = { data = data.copy(controlCenterDividerWidth = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Icon size",
-                        value = data.controlCenterIconSize,
-                        valueRange = 16f..64f,
-                        format = { "${it.toInt()}dp" },
-                        onValueChange = { data = data.copy(controlCenterIconSize = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Background opacity",
-                        value = data.controlCenterBackgroundAlpha,
-                        valueRange = 0f..1f,
-                        format = { "${(it * 100).toInt()}%" },
-                        onValueChange = { data = data.copy(controlCenterBackgroundAlpha = it) },
-                    )
-                }
+            SettingsSection(title = "Panel") {
+                SettingsSelectRow(
+                    label = "Location",
+                    selected = data.panelLocation,
+                    options = PanelLocation.entries.map { it.name },
+                    onSelected = { data = data.copy(panelLocation = it) },
+                )
+                SettingsSliderRow(
+                    label = "Auto-hide delay",
+                    value = data.panelHideDelay.toFloat(),
+                    valueRange = 0f..10_000f,
+                    format = { if (it <= 0f) "off" else "${(it / 1000f).toInt()}s" },
+                    onValueChange = { data = data.copy(panelHideDelay = it.toLong()) },
+                )
+                SettingsSliderRow(
+                    label = "Divider width",
+                    value = data.panelDividerWidth,
+                    valueRange = 0f..32f,
+                    format = { "${it.toInt()}dp" },
+                    onValueChange = { data = data.copy(panelDividerWidth = it) },
+                )
+                SettingsSliderRow(
+                    label = "Content padding",
+                    value = data.panelContentPadding,
+                    valueRange = 0f..32f,
+                    format = { "${it.toInt()}dp" },
+                    onValueChange = { data = data.copy(panelContentPadding = it) },
+                )
+            }
 
-                SettingsSection(title = "App menu") {
-                    SettingsSliderRow(
-                        label = "Min width",
-                        value = data.appMenuMinWidthRatio,
-                        valueRange = 0.1f..1f,
-                        format = { "${(it * 100).toInt()}%" },
-                        onValueChange = { data = data.copy(appMenuMinWidthRatio = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Min height",
-                        value = data.appMenuMinHeightRatio,
-                        valueRange = 0.1f..1f,
-                        format = { "${(it * 100).toInt()}%" },
-                        onValueChange = { data = data.copy(appMenuMinHeightRatio = it) },
-                    )
-                    SettingsSliderRow(
-                        label = "Outer padding",
-                        value = data.appMenuOuterPadding,
-                        valueRange = 0f..32f,
-                        format = { "${it.toInt()}dp" },
-                        onValueChange = { data = data.copy(appMenuOuterPadding = it) },
-                    )
-                }
+            SettingsSection(title = "Control center") {
+                SettingsSelectRow(
+                    label = "Location",
+                    selected = data.controlCenterLocation,
+                    options = ControlCenterLocation.entries.map { it.name },
+                    onSelected = { data = data.copy(controlCenterLocation = it) },
+                )
+                SettingsSliderRow(
+                    label = "Auto-hide delay",
+                    value = data.controlPanelHideDelay.toFloat(),
+                    valueRange = 0f..10_000f,
+                    format = { if (it <= 0f) "off" else "${(it / 1000f).toInt()}s" },
+                    onValueChange = { data = data.copy(controlPanelHideDelay = it.toLong()) },
+                )
+                SettingsSliderRow(
+                    label = "Expanded width",
+                    value = data.controlCenterExpandedWidthPercent.toFloat(),
+                    valueRange = 10f..80f,
+                    steps = 69,
+                    format = { "${it.toInt()}%" },
+                    onValueChange = { data = data.copy(controlCenterExpandedWidthPercent = it.toInt()) },
+                )
+                SettingsSliderRow(
+                    label = "Divider width",
+                    value = data.controlCenterDividerWidth,
+                    valueRange = 0f..32f,
+                    format = { "${it.toInt()}dp" },
+                    onValueChange = { data = data.copy(controlCenterDividerWidth = it) },
+                )
+                SettingsSliderRow(
+                    label = "Icon size",
+                    value = data.controlCenterIconSize,
+                    valueRange = 16f..64f,
+                    format = { "${it.toInt()}dp" },
+                    onValueChange = { data = data.copy(controlCenterIconSize = it) },
+                )
+                SettingsSliderRow(
+                    label = "Background opacity",
+                    value = data.controlCenterBackgroundAlpha,
+                    valueRange = 0f..1f,
+                    format = { "${(it * 100).toInt()}%" },
+                    onValueChange = { data = data.copy(controlCenterBackgroundAlpha = it) },
+                )
             }
 
-            Box(
-                modifier =
-                    Modifier
-                        .align(Alignment.BottomCenter)
-                        .fillMaxWidth()
-                        .padding(16.dp)
-                        .border(1.dp, borderColor.alpha(0.6f), RoundedCornerShape(8.dp))
-                        .clickable {
-                            store.save(data)
-                            data.applyTo(currentUser.theme)
-                            runAsync {
-                                currentUser.config.reloadBackgrounds(data.buildProviders(currentUser))
-                            }
-                        }.padding(vertical = 12.dp),
-                contentAlignment = Alignment.Center,
-            ) {
-                TextAny(
-                    text = "Save & apply",
-                    color = textColor,
-                    fontSize = 16.sp,
+            SettingsSection(title = "App menu") {
+                SettingsSliderRow(
+                    label = "Min width",
+                    value = data.appMenuMinWidthRatio,
+                    valueRange = 0.1f..1f,
+                    format = { "${(it * 100).toInt()}%" },
+                    onValueChange = { data = data.copy(appMenuMinWidthRatio = it) },
+                )
+                SettingsSliderRow(
+                    label = "Min height",
+                    value = data.appMenuMinHeightRatio,
+                    valueRange = 0.1f..1f,
+                    format = { "${(it * 100).toInt()}%" },
+                    onValueChange = { data = data.copy(appMenuMinHeightRatio = it) },
+                )
+                SettingsSliderRow(
+                    label = "Outer padding",
+                    value = data.appMenuOuterPadding,
+                    valueRange = 0f..32f,
+                    format = { "${it.toInt()}dp" },
+                    onValueChange = { data = data.copy(appMenuOuterPadding = it) },
                 )
             }
         }
+
+        Box(
+            modifier =
+                Modifier
+                    .align(Alignment.BottomCenter)
+                    .fillMaxWidth()
+                    .padding(16.dp)
+                    .border(1.dp, borderColor.alpha(0.6f), RoundedCornerShape(8.dp))
+                    .clickable {
+                        store.save(data)
+                        data.applyTo(currentUser.theme)
+                        runAsync {
+                            currentUser.config.reloadBackgrounds(data.buildProviders(currentUser))
+                        }
+                    }.padding(vertical = 12.dp),
+            contentAlignment = Alignment.Center,
+        ) {
+            TextAny(
+                text = "Save & apply",
+                color = textColor,
+                fontSize = 16.sp,
+            )
+        }
     }
+}
 
 @Preview
 @Composable
-fun PreviewDesktopSettingsPage() =
-    preview {
-        DesktopSettingsPage(context).Render()
-    }
+fun PreviewDesktopSettingsPage() = preview {
+    DesktopSettingsPage(context).Render()
+}

+ 14 - 16
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/devices/Devices.kt

@@ -11,25 +11,23 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.mobile.MobileFriendly
 
 @Suppress("FunctionName")
-fun DevicesPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = MobileFriendly,
-        name = "Connected devices",
-        condition = {
-            false
+fun DevicesPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = MobileFriendly,
+    name = "Connected devices",
+    condition = {
+        false
 //        connectionManager.hasConnectedDevices
-        },
+    },
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
     ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        ) {
-        }
     }
+}
 
 @Preview
 @Composable
-fun DevicesPagePreview() =
-    preview {
-        DevicesPage(context).Render()
-    }
+fun DevicesPagePreview() = preview {
+    DevicesPage(context).Render()
+}

+ 12 - 14
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/display/DisplaySettingsPage.kt

@@ -11,20 +11,18 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.settings.SettingsMonitor
 
 @Suppress("FunctionName")
-fun DisplaySettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = SettingsMonitor,
-        name = "Display",
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+fun DisplaySettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = SettingsMonitor,
+    name = "Display",
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun DisplaySettingsPagePreview() =
-    preview {
-        DisplaySettingsPage(context).Render()
-    }
+fun DisplaySettingsPagePreview() = preview {
+    DisplaySettingsPage(context).Render()
+}

+ 15 - 17
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/ethernet/EthSettingsPage.kt

@@ -11,24 +11,22 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.settings.SettingsEthernet
 
 @Suppress("FunctionName")
-fun EthSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = SettingsEthernet,
-        name = "Ethernet",
-        condition = {
-            false
+fun EthSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = SettingsEthernet,
+    name = "Ethernet",
+    condition = {
+        false
 //        connectionManager.isEthAdapterAvailable
-        },
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+    },
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun EthSettingsPagePreview() =
-    preview {
-        EthSettingsPage(context).Render()
-    }
+fun EthSettingsPagePreview() = preview {
+    EthSettingsPage(context).Render()
+}

+ 88 - 90
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/main/MainSettingsPage.kt

@@ -25,84 +25,83 @@ import org.mjdev.desktop.helpers.shape.BarShape
 import org.mjdev.desktop.icons.settings.SettingsHome
 
 @Suppress("FunctionName")
-fun MainSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = SettingsHome,
-        name = "Home",
-        showHeader = false,
+fun MainSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = SettingsHome,
+    name = "Home",
+    showHeader = false,
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
     ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
+        Column(
+            modifier =
+                Modifier
+                    .fillMaxWidth()
+                    .align(Alignment.TopCenter),
         ) {
-            Column(
-                modifier =
-                    Modifier
-                        .fillMaxWidth()
-                        .align(Alignment.TopCenter),
+            Box(
+                modifier = Modifier.clip(RectangleShape),
+                contentAlignment = Alignment.BottomStart,
             ) {
-                Box(
-                    modifier = Modifier.clip(RectangleShape),
-                    contentAlignment = Alignment.BottomStart,
-                ) {
-                    val shape =
-                        BarShape(
-                            offset = 80.dp,
-                            circleRadius = 52.dp,
-                            cornerRadius = 0.dp,
-                            circleGap = 4.dp,
-                        )
-                    val brush =
-                        Brush.horizontalGradient(
-                            listOf(
-                                backgroundColor.darker(0.1f),
-                                backgroundColor.darker(0.1f),
-                                backgroundColor.darker(0.1f),
-                                backgroundColor.alpha(0.9f),
-                                backgroundColor.alpha(0.7f),
-                                backgroundColor.alpha(0.3f),
-                                backgroundColor.darker(0.1f).alpha(0.5f),
-                            ),
+                val shape =
+                    BarShape(
+                        offset = 80.dp,
+                        circleRadius = 52.dp,
+                        cornerRadius = 0.dp,
+                        circleGap = 4.dp,
+                    )
+                val brush =
+                    Brush.horizontalGradient(
+                        listOf(
+                            backgroundColor.darker(0.1f),
+                            backgroundColor.darker(0.1f),
+                            backgroundColor.darker(0.1f),
+                            backgroundColor.alpha(0.9f),
+                            backgroundColor.alpha(0.7f),
+                            backgroundColor.alpha(0.3f),
+                            backgroundColor.darker(0.1f).alpha(0.5f),
+                        ),
 //                    startX = 0f,
 //                    endX = 0f
-                        )
-                    Box(
-                        modifier =
-                            Modifier
-                                .fillMaxWidth()
-                                .height(64.dp)
-                                .background(
-                                    brush = brush,
-                                    shape = shape,
-                                ),
                     )
-                    UserAvatar(
-                        avatarSize = 96.dp,
-                        titleTextSize = 20.sp,
-                        detailTextSize = 16.sp,
-                        onUserAvatarClick = {
-                            // todo
-                        },
-                        orientation = Orientation.Horizontal,
-                    )
-                }
-                HorizontalDivider(
-                    color = borderColor.alpha(0.5f),
-                    thickness = 2.dp,
+                Box(
+                    modifier =
+                        Modifier
+                            .fillMaxWidth()
+                            .height(64.dp)
+                            .background(
+                                brush = brush,
+                                shape = shape,
+                            ),
                 )
-                DateTime(
-                    modifier = Modifier.fillMaxWidth(),
-                    timeTextColor = textColor,
-                    dateTextColor = textColor,
-                    backgroundColor = backgroundColor,
+                UserAvatar(
+                    avatarSize = 96.dp,
+                    titleTextSize = 20.sp,
+                    detailTextSize = 16.sp,
+                    onUserAvatarClick = {
+                        // todo
+                    },
+                    orientation = Orientation.Horizontal,
                 )
             }
-            Box(
-                modifier =
-                    Modifier
-                        .fillMaxWidth()
-                        .align(Alignment.BottomCenter),
-            ) {
+            HorizontalDivider(
+                color = borderColor.alpha(0.5f),
+                thickness = 2.dp,
+            )
+            DateTime(
+                modifier = Modifier.fillMaxWidth(),
+                timeTextColor = textColor,
+                dateTextColor = textColor,
+                backgroundColor = backgroundColor,
+            )
+        }
+        Box(
+            modifier =
+                Modifier
+                    .fillMaxWidth()
+                    .align(Alignment.BottomCenter),
+        ) {
 //            FlexibleBottomSheet(
 //                onDismissRequest = {},
 //                sheetState = rememberFlexibleBottomSheetState(
@@ -125,30 +124,29 @@ fun MainSettingsPage(context: IDesktopContext) =
 //                    color = Color.White,
 //                )
 //            }
-                Column(
-                    modifier =
-                        Modifier
-                            .fillMaxWidth()
-                            .wrapContentHeight()
-                            .align(Alignment.BottomCenter),
-                ) {
-                    PowerBlock(
-                        shadowColor = borderColor.alpha(0.3f),
-                        onPowerButtonClick = {
-                            // todo : dialog
-                            runAsync {
-                                context.logOut()
-                            }
-                        },
-                    )
-                }
+            Column(
+                modifier =
+                    Modifier
+                        .fillMaxWidth()
+                        .wrapContentHeight()
+                        .align(Alignment.BottomCenter),
+            ) {
+                PowerBlock(
+                    shadowColor = borderColor.alpha(0.3f),
+                    onPowerButtonClick = {
+                        // todo : dialog
+                        runAsync {
+                            context.logOut()
+                        }
+                    },
+                )
             }
         }
     }
+}
 
 @Preview
 @Composable
-fun PreviewMainSettingsPage() =
-    preview {
-        MainSettingsPage(context).Render()
-    }
+fun PreviewMainSettingsPage() = preview {
+    MainSettingsPage(context).Render()
+}

+ 13 - 15
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/remotes/RemotesSettingsPage.kt

@@ -11,21 +11,19 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.custom.Mjdev
 
 @Suppress("FunctionName")
-fun RemotesSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = Mjdev, // todo
-        name = "Remote",
-        condition = { true },
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+fun RemotesSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = Mjdev, // todo
+    name = "Remote",
+    condition = { true },
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun RemotesSettingsPagePreview() =
-    preview {
-        RemotesSettingsPage(context).Render()
-    }
+fun RemotesSettingsPagePreview() = preview {
+    RemotesSettingsPage(context).Render()
+}

+ 13 - 15
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/sound/SoundSettingsPage.kt

@@ -11,21 +11,19 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.settings.SettingsSound
 
 @Suppress("FunctionName")
-fun SoundSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = SettingsSound,
-        name = "Sound",
-        condition = { true }, // todo sound manager
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+fun SoundSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = SettingsSound,
+    name = "Sound",
+    condition = { true }, // todo sound manager
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun PreviewSoundSettingsPage() =
-    preview {
-        SoundSettingsPage(context).Render()
-    }
+fun PreviewSoundSettingsPage() = preview {
+    SoundSettingsPage(context).Render()
+}

+ 13 - 15
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/theme/ThemeSettingsPage.kt

@@ -11,21 +11,19 @@ import org.mjdev.desktop.extensions.Compose.preview
 import org.mjdev.desktop.icons.custom.Mjdev
 
 @Suppress("FunctionName")
-fun ThemeSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = Mjdev, // todo
-        name = "Theme",
-        condition = { true },
-    ) {
-        Box(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+fun ThemeSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = Mjdev, // todo
+    name = "Theme",
+    condition = { true },
+) {
+    Box(
+        modifier = Modifier.fillMaxSize(),
+    )
+}
 
 @Preview
 @Composable
-fun ThemeSettingsPagePreview() =
-    preview {
-        ThemeSettingsPage(context).Render()
-    }
+fun ThemeSettingsPagePreview() = preview {
+    ThemeSettingsPage(context).Render()
+}

+ 12 - 14
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/wifi/WifiRow.kt

@@ -165,20 +165,18 @@ fun WifiRow(
 
 @Preview
 @Composable
-fun PreviewWifiRow() =
-    preview {
-        WifiRow(
-            item = WifiNetwork(),
-            expandedState = mutableStateOf(false),
-        )
-    }
+fun PreviewWifiRow() = preview {
+    WifiRow(
+        item = WifiNetwork(),
+        expandedState = mutableStateOf(false),
+    )
+}
 
 @Preview
 @Composable
-fun WifiRowPreview2() =
-    preview {
-        WifiRow(
-            item = WifiNetwork(),
-            expandedState = mutableStateOf(true),
-        )
-    }
+fun WifiRowPreview2() = preview {
+    WifiRow(
+        item = WifiNetwork(),
+        expandedState = mutableStateOf(true),
+    )
+}

+ 66 - 68
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/pages/wifi/WifiSettingsPage.kt

@@ -21,78 +21,76 @@ import org.mjdev.desktop.icons.settings.SettingsWifi
 import org.mjdev.desktop.log.Log
 
 @Suppress("FunctionName")
-fun WifiSettingsPage(context: IDesktopContext) =
-    ControlCenterPage(
-        context = context,
-        icon = SettingsWifi,
-        name = "Wifi",
-        condition = {
-            connectionManager.isWifiAdapterAvailable
-        },
-        saver = { ctx ->
-            PersistentPageSaver(ctx, "Assistant")
-        },
-    ) {
-        val shape = RoundedCornerShape(8.dp)
-        var isConnecting by mutableStateOf(false)
-        val wifiList: Map<String, WifiNetwork> by flowBlock(
-            emptyMap(),
-            250L,
-        ) { context.connectionManager.wifiNetworks }
-        val items: List<WifiNetwork> by rememberComputed(isConnecting) {
-            if (wifiList.isEmpty()) {
-                emptyList()
-            } else {
-                wifiList.map { e -> e.value }
-            }
+fun WifiSettingsPage(context: IDesktopContext) = ControlCenterPage(
+    context = context,
+    icon = SettingsWifi,
+    name = "Wifi",
+    condition = {
+        connectionManager.isWifiAdapterAvailable
+    },
+    saver = { ctx ->
+        PersistentPageSaver(ctx, "Assistant")
+    },
+) {
+    val shape = RoundedCornerShape(8.dp)
+    var isConnecting by mutableStateOf(false)
+    val wifiList: Map<String, WifiNetwork> by flowBlock(
+        emptyMap(),
+        250L,
+    ) { context.connectionManager.wifiNetworks }
+    val items: List<WifiNetwork> by rememberComputed(isConnecting) {
+        if (wifiList.isEmpty()) {
+            emptyList()
+        } else {
+            wifiList.map { e -> e.value }
         }
-        val connect: (item: WifiNetwork) -> Unit =
-            remember {
-                { wn ->
-                    isConnecting = true
-                    context.connectionManager
-                        .connectWifi(wn.ssid)
-                        .onSuccess {
-                            Log.d("Connected to ${wn.ssid}")
-                            isConnecting = false
-                        }.onFailure { e ->
-                            Log.e(e)
-                            isConnecting = false
-                        }
-                }
+    }
+    val connect: (item: WifiNetwork) -> Unit =
+        remember {
+            { wn ->
+                isConnecting = true
+                context.connectionManager
+                    .connectWifi(wn.ssid)
+                    .onSuccess {
+                        Log.d("Connected to ${wn.ssid}")
+                        isConnecting = false
+                    }.onFailure { e ->
+                        Log.e(e)
+                        isConnecting = false
+                    }
             }
-
-        ExpandableLazyColumn(
-            modifier = Modifier.fillMaxWidth(),
-            items = items,
-        ) { idx, item, expandedState ->
-            WifiRow(
-                modifier =
-                    Modifier
-                        .padding(4.dp)
-                        .fillMaxWidth()
-                        .background(
-                            Color.White.copy(alpha = 0.1f),
-                            shape,
-                        ).border(
-                            2.dp,
-                            if (item.isActive) textColor else borderColor,
-                            shape,
-                        ).padding(8.dp),
-                idx = idx,
-                item = item,
-                expandedState = expandedState,
-                isConnecting = isConnecting,
-                connect = {
-                    connect(item)
-                },
-            )
         }
+
+    ExpandableLazyColumn(
+        modifier = Modifier.fillMaxWidth(),
+        items = items,
+    ) { idx, item, expandedState ->
+        WifiRow(
+            modifier =
+                Modifier
+                    .padding(4.dp)
+                    .fillMaxWidth()
+                    .background(
+                        Color.White.copy(alpha = 0.1f),
+                        shape,
+                    ).border(
+                        2.dp,
+                        if (item.isActive) textColor else borderColor,
+                        shape,
+                    ).padding(8.dp),
+            idx = idx,
+            item = item,
+            expandedState = expandedState,
+            isConnecting = isConnecting,
+            connect = {
+                connect(item)
+            },
+        )
     }
+}
 
 @Preview
 @Composable
-fun WifiSettingsPagePreview() =
-    preview {
-        WifiSettingsPage(context).Render()
-    }
+fun WifiSettingsPagePreview() = preview {
+    WifiSettingsPage(context).Render()
+}

+ 4 - 5
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSection.kt

@@ -47,9 +47,8 @@ fun SettingsSection(
 
 @Preview
 @Composable
-fun PreviewSettingsSection() =
-    preview {
-        SettingsSection(title = "Background") {
-            TextAny(text = "content")
-        }
+fun PreviewSettingsSection() = preview {
+    SettingsSection(title = "Background") {
+        TextAny(text = "content")
     }
+}

+ 8 - 9
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSelectRow.kt

@@ -97,12 +97,11 @@ fun SettingsSelectRow(
 
 @Preview
 @Composable
-fun PreviewSettingsSelectRow() =
-    preview {
-        SettingsSelectRow(
-            label = "Panel location",
-            selected = "Bottom",
-            options = listOf("Bottom", "Top", "Left", "Right"),
-            onSelected = {},
-        )
-    }
+fun PreviewSettingsSelectRow() = preview {
+    SettingsSelectRow(
+        label = "Panel location",
+        selected = "Bottom",
+        options = listOf("Bottom", "Top", "Left", "Right"),
+        onSelected = {},
+    )
+}

+ 8 - 9
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSliderRow.kt

@@ -74,12 +74,11 @@ fun SettingsSliderRow(
 
 @Preview
 @Composable
-fun PreviewSettingsSliderRow() =
-    preview {
-        SettingsSliderRow(
-            label = "Rotation delay",
-            value = 60f,
-            valueRange = 5f..600f,
-            onValueChange = {},
-        )
-    }
+fun PreviewSettingsSliderRow() = preview {
+    SettingsSliderRow(
+        label = "Rotation delay",
+        value = 60f,
+        valueRange = 5f..600f,
+        onValueChange = {},
+    )
+}

+ 7 - 8
shared/src/commonMain/kotlin/org/mjdev/desktop/components/controlcenter/settings/SettingsSwitchRow.kt

@@ -57,11 +57,10 @@ fun SettingsSwitchRow(
 
 @Preview
 @Composable
-fun PreviewSettingsSwitchRow() =
-    preview {
-        SettingsSwitchRow(
-            label = "Local folder",
-            checked = true,
-            onCheckedChange = {},
-        )
-    }
+fun PreviewSettingsSwitchRow() = preview {
+    SettingsSwitchRow(
+        label = "Local folder",
+        checked = true,
+        onCheckedChange = {},
+    )
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/BrushedLayout.kt

@@ -32,7 +32,6 @@ fun BrushedLayout(
 
 @Preview
 @Composable
-fun PreviewBrushedLayout() =
-    preview(320) {
-        BrushedLayout()
-    }
+fun PreviewBrushedLayout() = preview(320) {
+    BrushedLayout()
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/Clock.kt

@@ -93,9 +93,8 @@ fun Clock(
 
 @Preview
 @Composable
-fun PreviewClock() =
-    preview {
-        Clock(
-            modifier = Modifier.size(320, 200),
-        )
-    }
+fun PreviewClock() = preview {
+    Clock(
+        modifier = Modifier.size(320, 200),
+    )
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/DateTime.kt

@@ -53,9 +53,8 @@ fun DateTime(
 
 @Preview
 @Composable
-fun PreviewDateTime() =
-    preview {
-        DateTime(
-            modifier = Modifier.size(320, 200),
-        )
-    }
+fun PreviewDateTime() = preview {
+    DateTime(
+        modifier = Modifier.size(320, 200),
+    )
+}

+ 10 - 11
shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/MeasureUnconstrainedView.kt

@@ -38,14 +38,13 @@ fun MeasureUnconstrainedView(
 
 @Preview
 @Composable
-fun PreviewMeasureUnconstrainedView() =
-    preview {
-        MeasureUnconstrainedView({
-            TextAny("test")
-        }, { size ->
-            TextAny(
-                modifier = Modifier.background(Color.White),
-                text = "test size: $size",
-            )
-        })
-    }
+fun PreviewMeasureUnconstrainedView() = preview {
+    MeasureUnconstrainedView({
+        TextAny("test")
+    }, { size ->
+        TextAny(
+            modifier = Modifier.background(Color.White),
+            text = "test size: $size",
+        )
+    })
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/PowerBlock.kt

@@ -97,7 +97,6 @@ fun PowerBlock(
 
 @Preview
 @Composable
-fun PreviewPowerBlock() =
-    preview {
-        PowerBlock()
-    }
+fun PreviewPowerBlock() = preview {
+    PowerBlock()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/custom/VerticalScrollableBox.kt

@@ -36,7 +36,6 @@ fun VerticalScrollableBox(
 
 @Preview
 @Composable
-fun PreviewVerticalScrollableBox() =
-    preview {
-        VerticalScrollableBox()
-    }
+fun PreviewVerticalScrollableBox() = preview {
+    VerticalScrollableBox()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktop/Desktop.kt

@@ -120,7 +120,6 @@ fun Desktop(
 // todo
 @Preview
 @Composable
-fun PreviewDesktop() =
-    preview {
-        Desktop()
-    }
+fun PreviewDesktop() = preview {
+    Desktop()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktop/widgets/MemoryChart.kt

@@ -63,7 +63,6 @@ fun MemoryChart(
 // todo
 @Preview
 @Composable
-fun PreviewMemoryChart() =
-    preview {
-        MemoryChart()
-    }
+fun PreviewMemoryChart() = preview {
+    MemoryChart()
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/DesktopPanel.kt

@@ -240,9 +240,8 @@ fun DesktopPanel(
 
 @Preview
 @Composable
-fun PreviewDesktopPanel() =
-    preview {
-        DesktopPanel(
-            panelState = rememberVisibilityState(true),
-        )
-    }
+fun PreviewDesktopPanel() = preview {
+    DesktopPanel(
+        panelState = rememberVisibilityState(true),
+    )
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopMenuIcon.kt

@@ -45,7 +45,6 @@ fun DesktopMenuIcon(
 
 @Preview
 @Composable
-fun PreviewDesktopMenuIcon() =
-    preview {
-        DesktopMenuIcon()
-    }
+fun PreviewDesktopMenuIcon() = preview {
+    DesktopMenuIcon()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelDateTime.kt

@@ -67,7 +67,6 @@ fun DesktopPanelDateTime(
 
 @Preview
 @Composable
-fun PreviewDesktopPanelDateTime() =
-    preview {
-        DesktopPanelDateTime()
-    }
+fun PreviewDesktopPanelDateTime() = preview {
+    DesktopPanelDateTime()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelFavoriteApps.kt

@@ -78,7 +78,6 @@ fun DesktopPanelFavoriteApps(
 // todo
 @Preview
 @Composable
-fun PreviewDesktopPanelFavoriteApps() =
-    preview {
-        DesktopPanelFavoriteApps()
-    }
+fun PreviewDesktopPanelFavoriteApps() = preview {
+    DesktopPanelFavoriteApps()
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelIcon.kt

@@ -125,9 +125,8 @@ fun DesktopPanelIcon(
 
 @Preview
 @Composable
-fun PreviewDesktopPanelIcon() =
-    preview {
-        DesktopPanelIcon(
-            app = null, // App.Test
-        )
-    }
+fun PreviewDesktopPanelIcon() = preview {
+    DesktopPanelIcon(
+        app = null, // App.Test
+    )
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelLanguage.kt

@@ -23,7 +23,6 @@ fun DesktopPanelLanguage(
 
 @Preview
 @Composable
-fun vDesktopPanelLanguage() =
-    preview {
-        DesktopPanelLanguage()
-    }
+fun vDesktopPanelLanguage() = preview {
+    DesktopPanelLanguage()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelText.kt

@@ -61,7 +61,6 @@ fun DesktopPanelText(
 
 @Preview
 @Composable
-fun PreviewDesktopPanelText() =
-    preview {
-        DesktopPanelText()
-    }
+fun PreviewDesktopPanelText() = preview {
+    DesktopPanelText()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/desktoppanel/applets/DesktopPanelTray.kt

@@ -33,7 +33,6 @@ fun DesktopPanelTray(
 
 @Preview
 @Composable
-fun PreviewDesktopPanelTray() =
-    preview {
-        DesktopPanelTray()
-    }
+fun PreviewDesktopPanelTray() = preview {
+    DesktopPanelTray()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/draggable/DraggableView.kt

@@ -90,7 +90,6 @@ fun DraggableView(
 
 @Preview
 @Composable
-fun PreviewDraggableView() =
-    preview {
-        DraggableView()
-    }
+fun PreviewDraggableView() = preview {
+    DraggableView()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/file/FolderIcon.kt

@@ -102,7 +102,6 @@ fun FolderIcon(
 
 @Preview
 @Composable
-fun PreviewFolderIcon() =
-    preview {
-        FolderIcon()
-    }
+fun PreviewFolderIcon() = preview {
+    FolderIcon()
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/file/FolderView.kt

@@ -156,9 +156,8 @@ private fun rememberFiles(
 // todo
 @Preview
 @Composable
-fun PreviewFolderView() =
-    preview {
-        FolderView(
-            modifier = Modifier.fillMaxSize(),
-        )
-    }
+fun PreviewFolderView() = preview {
+    FolderView(
+        modifier = Modifier.fillMaxSize(),
+    )
+}

+ 14 - 15
shared/src/commonMain/kotlin/org/mjdev/desktop/components/fonticon/FontIcon.kt

@@ -101,21 +101,20 @@ fun FontIcon(
 
 @Preview
 @Composable
-fun PreviewFontIcon() =
-    preview {
+fun PreviewFontIcon() = preview {
+    Column {
         Column {
-            Column {
-                FontIcon(iconId = 0)
-                FontIcon(iconName = "")
-                FontIcon(iconName = "tv")
-                FontIcon(iconName = "browser")
-            }
-            Spacer(modifier = Modifier.height(32.dp).fillMaxWidth())
-            Row {
-                FontIcon(iconId = 0)
-                FontIcon(iconName = "")
-                FontIcon(iconName = "tv")
-                FontIcon(iconName = "browser")
-            }
+            FontIcon(iconId = 0)
+            FontIcon(iconName = "")
+            FontIcon(iconName = "tv")
+            FontIcon(iconName = "browser")
+        }
+        Spacer(modifier = Modifier.height(32.dp).fillMaxWidth())
+        Row {
+            FontIcon(iconId = 0)
+            FontIcon(iconName = "")
+            FontIcon(iconName = "tv")
+            FontIcon(iconName = "browser")
         }
     }
+}

+ 35 - 37
shared/src/commonMain/kotlin/org/mjdev/desktop/components/greeter/Greeter.kt

@@ -24,33 +24,32 @@ import org.mjdev.desktop.helpers.compose.Orientation
 import org.mjdev.desktop.interfaces.IUser
 
 @Composable
-fun Greeter(onLogin: (user: IUser, password: String) -> Unit = { _, _ -> }) =
-    withDesktopContext {
-        val user: IUser? by rememberState(context.currentUser)
-        var passwordVisible by rememberState(isDesign)
-        Box(
-            modifier =
-                Modifier
-                    .fillMaxSize()
-                    .background(backgroundColor.alpha(0.9f)),
-            contentAlignment = Alignment.Center,
+fun Greeter(onLogin: (user: IUser, password: String) -> Unit = { _, _ -> }) = withDesktopContext {
+    val user: IUser? by rememberState(context.currentUser)
+    var passwordVisible by rememberState(isDesign)
+    Box(
+        modifier =
+            Modifier
+                .fillMaxSize()
+                .background(backgroundColor.alpha(0.9f)),
+        contentAlignment = Alignment.Center,
+    ) {
+        Column(
+            modifier = Modifier.width(256.dp),
         ) {
-            Column(
-                modifier = Modifier.width(256.dp),
-            ) {
-                UserAvatar(
-                    modifier = Modifier,
-                    avatarSize = 128.dp,
-                    orientation = Orientation.Vertical,
-                    textAlign = TextAlign.Center,
-                    circleBorder = 4.dp,
-                    onUserAvatarClick = {
-                        passwordVisible = true
-                    },
-                )
-                if (passwordVisible) {
-                    PasswordTextView(
-                        modifier = Modifier.width(256.dp),
+            UserAvatar(
+                modifier = Modifier,
+                avatarSize = 128.dp,
+                orientation = Orientation.Vertical,
+                textAlign = TextAlign.Center,
+                circleBorder = 4.dp,
+                onUserAvatarClick = {
+                    passwordVisible = true
+                },
+            )
+            if (passwordVisible) {
+                PasswordTextView(
+                    modifier = Modifier.width(256.dp),
 //                        colors = TextFieldDefaults.outlinedTextFieldColors(
 //                            backgroundColor = iconsTintColor.copy(alpha = 0.1f),
 //                            textColor = iconsTintColor.copy(alpha = 0.9f),
@@ -58,20 +57,19 @@ fun Greeter(onLogin: (user: IUser, password: String) -> Unit = { _, _ -> }) =
 //                            focusedBorderColor = iconsTintColor,
 //                            unfocusedBorderColor = iconsTintColor
 //                        ),
-                        onDone = { password ->
-                            if (user != null) {
-                                onLogin(user!!, password)
-                            }
-                        },
-                    )
-                }
+                    onDone = { password ->
+                        if (user != null) {
+                            onLogin(user!!, password)
+                        }
+                    },
+                )
             }
         }
     }
+}
 
 @Preview
 @Composable
-fun PreviewGreeter() =
-    preview(320, 320) {
-        Greeter()
-    }
+fun PreviewGreeter() = preview(320, 320) {
+    Greeter()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/GridPlaced.kt

@@ -59,7 +59,6 @@ fun GridPlaced(
 
 @Preview
 @Composable
-fun PreviewGridPlaced() =
-    preview {
-        GridPlaced()
-    }
+fun PreviewGridPlaced() = preview {
+    GridPlaced()
+}

+ 2 - 1
shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedCellSize.kt

@@ -46,6 +46,7 @@ sealed class GridPlacedCellSize {
             size: Float = 1f,
         ): MutableList<GridPlacedCellSize> = mutableListOfElement(count, Weight(size = size))
 
-        fun weight(vararg sizes: Float): MutableList<GridPlacedCellSize> = sizes.map { Weight(size = it) }.toMutableList()
+        fun weight(vararg sizes: Float): MutableList<GridPlacedCellSize> =
+            sizes.map { Weight(size = it) }.toMutableList()
     }
 }

+ 12 - 16
shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedCells.kt

@@ -46,28 +46,24 @@ data class GridPlacedCells(
         fun rowSize(
             index: Int,
             size: GridPlacedCellSize,
-        ): Builder =
-            apply {
-                rowSizes[index] = size
-            }
+        ): Builder = apply {
+            rowSizes[index] = size
+        }
 
-        fun rowsSize(size: GridPlacedCellSize): Builder =
-            apply {
-                rowSizes.fill(size)
-            }
+        fun rowsSize(size: GridPlacedCellSize): Builder = apply {
+            rowSizes.fill(size)
+        }
 
         fun columnSize(
             index: Int,
             size: GridPlacedCellSize,
-        ): Builder =
-            apply {
-                columnSizes[index] = size
-            }
+        ): Builder = apply {
+            columnSizes[index] = size
+        }
 
-        fun columnsSize(size: GridPlacedCellSize): Builder =
-            apply {
-                columnSizes.fill(size)
-            }
+        fun columnsSize(size: GridPlacedCellSize): Builder = apply {
+            columnSizes.fill(size)
+        }
 
         fun build(): GridPlacedCells = GridPlacedCells(rowSizes = rowSizes, columnSizes = columnSizes)
     }

+ 14 - 16
shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedScopeImpl.kt

@@ -158,15 +158,14 @@ class GridPlacedScopeImpl(
         cells: GridPlacedCells,
         placementPolicy: GridPlacedPlacementPolicy,
         lastItem: GridPlacedContent?,
-    ): Int =
-        if (lastItem != null) {
-            when (placementPolicy.verticalDirection) {
-                GridPlacedPlacementPolicy.VerticalDirection.TOP_BOTTOM -> lastItem.top
-                GridPlacedPlacementPolicy.VerticalDirection.BOTTOM_TOP -> lastItem.bottom
-            }
-        } else {
-            cells.firstRow(placementPolicy)
+    ): Int = if (lastItem != null) {
+        when (placementPolicy.verticalDirection) {
+            GridPlacedPlacementPolicy.VerticalDirection.TOP_BOTTOM -> lastItem.top
+            GridPlacedPlacementPolicy.VerticalDirection.BOTTOM_TOP -> lastItem.bottom
         }
+    } else {
+        cells.firstRow(placementPolicy)
+    }
 
     private fun findNextRow(
         cells: GridPlacedCells,
@@ -185,15 +184,14 @@ class GridPlacedScopeImpl(
         cells: GridPlacedCells,
         placementPolicy: GridPlacedPlacementPolicy,
         lastItem: GridPlacedContent?,
-    ): Int =
-        if (lastItem != null) {
-            when (placementPolicy.horizontalDirection) {
-                GridPlacedPlacementPolicy.HorizontalDirection.START_END -> lastItem.left
-                GridPlacedPlacementPolicy.HorizontalDirection.END_START -> lastItem.right
-            }
-        } else {
-            cells.firstColumn(placementPolicy)
+    ): Int = if (lastItem != null) {
+        when (placementPolicy.horizontalDirection) {
+            GridPlacedPlacementPolicy.HorizontalDirection.START_END -> lastItem.left
+            GridPlacedPlacementPolicy.HorizontalDirection.END_START -> lastItem.right
         }
+    } else {
+        cells.firstColumn(placementPolicy)
+    }
 
     private fun findNextColumn(
         cells: GridPlacedCells,

+ 16 - 20
shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/GridPlacedSpanAnchor.kt

@@ -26,37 +26,33 @@ data class GridPlacedSpanAnchor(
         fun GridPlacedSpanAnchor.leftBound(
             column: Int,
             span: Int,
-        ): Int =
-            when (horizontal) {
-                Horizontal.START -> column
-                Horizontal.END -> column - span + 1
-            }
+        ): Int = when (horizontal) {
+            Horizontal.START -> column
+            Horizontal.END -> column - span + 1
+        }
 
         fun GridPlacedSpanAnchor.rightBound(
             column: Int,
             span: Int,
-        ): Int =
-            when (this.horizontal) {
-                Horizontal.START -> column + span - 1
-                Horizontal.END -> column
-            }
+        ): Int = when (this.horizontal) {
+            Horizontal.START -> column + span - 1
+            Horizontal.END -> column
+        }
 
         fun GridPlacedSpanAnchor.topBound(
             row: Int,
             span: Int,
-        ): Int =
-            when (this.vertical) {
-                Vertical.TOP -> row
-                Vertical.BOTTOM -> row - span + 1
-            }
+        ): Int = when (this.vertical) {
+            Vertical.TOP -> row
+            Vertical.BOTTOM -> row - span + 1
+        }
 
         fun GridPlacedSpanAnchor.bottomBound(
             row: Int,
             span: Int,
-        ): Int =
-            when (this.vertical) {
-                Vertical.TOP -> row + span - 1
-                Vertical.BOTTOM -> row
-            }
+        ): Int = when (this.vertical) {
+            Vertical.TOP -> row + span - 1
+            Vertical.BOTTOM -> row
+        }
     }
 }

+ 19 - 20
shared/src/commonMain/kotlin/org/mjdev/desktop/components/grid/base/Measure.kt

@@ -21,26 +21,25 @@ object Measure {
         content: List<GridPlacedContent>,
         cellPlaces: Array<Array<CellPlacedInfo>>,
         constraints: Constraints,
-    ): List<Placeable> =
-        mapIndexed { index, measurable ->
-            val contentMetaInfo = content[index]
-            val maxWidth =
-                (contentMetaInfo.left..contentMetaInfo.right).sumOf { column ->
-                    cellPlaces[contentMetaInfo.top][column].width
-                }
-            val maxHeight =
-                (contentMetaInfo.top..contentMetaInfo.bottom).sumOf { row ->
-                    cellPlaces[row][contentMetaInfo.left].height
-                }
-            measurable.measure(
-                constraints.copy(
-                    minWidth = min(constraints.minWidth, maxWidth),
-                    maxWidth = maxWidth,
-                    minHeight = min(constraints.minHeight, maxHeight),
-                    maxHeight = maxHeight,
-                ),
-            )
-        }
+    ): List<Placeable> = mapIndexed { index, measurable ->
+        val contentMetaInfo = content[index]
+        val maxWidth =
+            (contentMetaInfo.left..contentMetaInfo.right).sumOf { column ->
+                cellPlaces[contentMetaInfo.top][column].width
+            }
+        val maxHeight =
+            (contentMetaInfo.top..contentMetaInfo.bottom).sumOf { row ->
+                cellPlaces[row][contentMetaInfo.left].height
+            }
+        measurable.measure(
+            constraints.copy(
+                minWidth = min(constraints.minWidth, maxWidth),
+                maxWidth = maxWidth,
+                minHeight = min(constraints.minHeight, maxHeight),
+                maxHeight = maxHeight,
+            ),
+        )
+    }
 
     fun MeasureScope.calculateCellPlaces(
         cells: GridPlacedCells,

+ 7 - 8
shared/src/commonMain/kotlin/org/mjdev/desktop/components/guide/GuideView.kt

@@ -60,11 +60,10 @@ fun GuideLines(
 
 @Preview
 @Composable
-fun PreviewGuideLines() =
-    preview(320, 320) {
-        GuideLines(
-            modifier = Modifier.fillMaxSize(),
-            cellSize = DpSize(32.dp, 32.dp),
-            color = Color.White,
-        )
-    }
+fun PreviewGuideLines() = preview(320, 320) {
+    GuideLines(
+        modifier = Modifier.fillMaxSize(),
+        cellSize = DpSize(32.dp, 32.dp),
+        color = Color.White,
+    )
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/icon/ShapedIcon.kt

@@ -72,7 +72,6 @@ fun ShapedIcon(
 
 @Preview
 @Composable
-fun PreviewShapedIcon() =
-    preview {
-        ShapedIcon()
-    }
+fun PreviewShapedIcon() = preview {
+    ShapedIcon()
+}

+ 6 - 7
shared/src/commonMain/kotlin/org/mjdev/desktop/components/icon/WifiLevelIcon.kt

@@ -53,10 +53,9 @@ fun WifiLevelIcon(
 
 @Preview
 @Composable
-fun PreviewWifiLevelIcon() =
-    preview {
-        WifiLevelIcon(
-            level = 55,
-            color = Color.White,
-        )
-    }
+fun PreviewWifiLevelIcon() = preview {
+    WifiLevelIcon(
+        level = 55,
+        color = Color.White,
+    )
+}

+ 8 - 10
shared/src/commonMain/kotlin/org/mjdev/desktop/components/image/GifView.kt

@@ -147,21 +147,19 @@ class GifViewState {
             src: String,
             context: IDesktopContext = LocalDesktopContext.current,
             scope: CoroutineScope = context.scope,
-        ): GifViewState =
-            remember(src) {
-                GifViewState().apply {
-                    scope.launch {
-                        load(src)
-                    }
+        ): GifViewState = remember(src) {
+            GifViewState().apply {
+                scope.launch {
+                    load(src)
                 }
             }
+        }
     }
 }
 
 @Suppress("unused")
 @Preview
 @Composable
-fun PreviewGifView() =
-    preview {
-        GifView()
-    }
+fun PreviewGifView() = preview {
+    GifView()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/image/ImageAny.kt

@@ -167,7 +167,6 @@ fun ImageAny(
 
 @Preview
 @Composable
-fun PreviewImageAny() =
-    preview {
-        ImageAny()
-    }
+fun PreviewImageAny() = preview {
+    ImageAny()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/image/PhotoImage.kt

@@ -129,7 +129,6 @@ fun PhotoImage(
 
 @Preview
 @Composable
-fun PreviewPhotoImage() =
-    preview {
-        PhotoImage()
-    }
+fun PreviewPhotoImage() = preview {
+    PhotoImage()
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/immersivelist/ImmersiveList.kt

@@ -58,7 +58,6 @@ fun ImmersiveList(
 // todo
 @Preview
 @Composable
-fun PreviewImmersiveList() =
-    preview {
-        ImmersiveList()
-    }
+fun PreviewImmersiveList() = preview {
+    ImmersiveList()
+}

+ 4 - 5
shared/src/commonMain/kotlin/org/mjdev/desktop/components/immersivelist/base/ImmersiveListScope.kt

@@ -34,11 +34,10 @@ import org.mjdev.desktop.helpers.compose.Gravity
 class ImmersiveListScope internal constructor(
     private val onFocused: (Int) -> Unit,
 ) {
-    fun Modifier.immersiveListItem(index: Int): Modifier =
-        this then
-            onFocusChanged {
-                if (it.isFocused) onFocused(index)
-            }
+    fun Modifier.immersiveListItem(index: Int): Modifier = this then
+        onFocusChanged {
+            if (it.isFocused) onFocused(index)
+        }
 }
 
 @Composable

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/info/Info.kt

@@ -85,7 +85,6 @@ fun Info(
 
 @Preview
 @Composable
-fun PreviewInfo() =
-    preview(320, 320) {
-        Info()
-    }
+fun PreviewInfo() = preview(320, 320) {
+    Info()
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/input/PasswordTextView.kt

@@ -118,9 +118,8 @@ fun PasswordTextView(
 
 @Preview
 @Composable
-fun PreviewPasswordTextView() =
-    preview {
-        PasswordTextView(
-            password = mutableStateOf("test"),
-        )
-    }
+fun PreviewPasswordTextView() = preview {
+    PasswordTextView(
+        password = mutableStateOf("test"),
+    )
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/input/SearchFieldPassive.kt

@@ -76,9 +76,8 @@ fun SearchFieldPassive(
 
 @Preview
 @Composable
-fun PreviewSearchFieldPassive() =
-    preview {
-        SearchFieldPassive(
-            textState = mutableStateOf("test"),
-        )
-    }
+fun PreviewSearchFieldPassive() = preview {
+    SearchFieldPassive(
+        textState = mutableStateOf("test"),
+    )
+}

+ 5 - 6
shared/src/commonMain/kotlin/org/mjdev/desktop/components/input/SelectableOutlineEditText.kt

@@ -111,9 +111,8 @@ fun SelectableOutlineEditText(
 
 @Preview
 @Composable
-fun PreviewSelectableOutlineEditText() =
-    preview {
-        SelectableOutlineEditText(
-            value = "test",
-        )
-    }
+fun PreviewSelectableOutlineEditText() = preview {
+    SelectableOutlineEditText(
+        value = "test",
+    )
+}

+ 3 - 4
shared/src/commonMain/kotlin/org/mjdev/desktop/components/installer/Installer.kt

@@ -57,7 +57,6 @@ fun Installer(
 
 @Preview
 @Composable
-fun PreviewInstaller() =
-    preview(320, 320) {
-        Installer()
-    }
+fun PreviewInstaller() = preview(320, 320) {
+    Installer()
+}

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio