Skip to content

Commit

Permalink
refactor: move ui models to feature ui models modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Jan 3, 2025
1 parent 467629a commit d49239b
Show file tree
Hide file tree
Showing 233 changed files with 774 additions and 563 deletions.
4 changes: 4 additions & 0 deletions build-logic/plugins/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ gradlePlugin {
id = "confily.ui"
implementationClass = "conventions.UiLibraryPlugin"
}
register("uiModelsLibrary") {
id = "confily.ui.models"
implementationClass = "conventions.UiModelsLibraryPlugin"
}
register("panesLibrary") {
id = "confily.panes"
implementationClass = "conventions.PanesLibraryPlugin"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package conventions

import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.getByType
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

class UiModelsLibraryPlugin : Plugin<Project> {
@OptIn(ExperimentalWasmDsl::class)
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
apply("confily.multiplatform.library")
apply("confily.quality")
}
val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")
extensions.configure<KotlinMultiplatformExtension> {
androidTarget()
wasmJs {
useCommonJs()
browser()
}
listOf(
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = target.name
isStatic = false
}
}
sourceSets.commonMain.dependencies {
implementation(libs.findLibrary("jetbrains-kotlinx-collections").get())
}
}
}
}
}
2 changes: 1 addition & 1 deletion features/event-list/event-list-panes/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.shared.uiModels)
implementation(projects.shared.resources)
implementation(projects.features.eventList.eventListUiModels)
implementation(projects.features.eventList.eventListUi)
implementation(projects.features.navigation)
implementation(projects.style.theme)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.paligot.confily.events.panes

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.EventItemListUi
import com.paligot.confily.events.ui.models.EventItemListUi
import com.paligot.confily.style.theme.ConfilyTheme

@Preview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.paligot.confily.events.panes

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
Expand All @@ -13,7 +12,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.paligot.confily.events.ui.EventItem
import com.paligot.confily.models.ui.EventItemListUi
import com.paligot.confily.events.ui.models.EventItemListUi
import com.paligot.confily.navigation.TabActions
import com.paligot.confily.resources.Resource
import com.paligot.confily.resources.screen_events
Expand All @@ -22,7 +21,6 @@ import com.paligot.confily.style.theme.actions.TabActionsUi
import kotlinx.collections.immutable.persistentListOf
import org.jetbrains.compose.resources.stringResource

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun EventList(
events: EventItemListUi,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.mapToEventItemListUi
import com.paligot.confily.models.ui.EventItemListUi
import com.paligot.confily.events.ui.models.EventItemListUi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.catch
Expand Down
7 changes: 7 additions & 0 deletions features/event-list/event-list-ui-models/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id("confily.ui.models")
}

android {
namespace = "com.paligot.confily.events.ui.models"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paligot.confily.models.ui
package com.paligot.confily.events.ui.models

import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paligot.confily.models.ui
package com.paligot.confily.events.ui.models

data class EventItemUi(
val id: String,
Expand Down
2 changes: 1 addition & 1 deletion features/event-list/event-list-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.shared.uiModels)
implementation(projects.features.eventList.eventListUiModels)
implementation(projects.style.components.placeholder)
implementation(projects.style.theme)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.paligot.confily.events.ui

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.EventItemUi
import com.paligot.confily.events.ui.models.EventItemUi
import com.paligot.confily.style.theme.ConfilyTheme

@Preview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import androidx.compose.material3.ListItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.paligot.confily.events.ui.models.EventItemUi
import com.paligot.confily.style.components.placeholder.placeholder

@Composable
fun EventItem(
item: com.paligot.confily.models.ui.EventItemUi,
item: EventItemUi,
modifier: Modifier = Modifier,
isLoading: Boolean = false,
onClick: (String) -> Unit
Expand Down
3 changes: 2 additions & 1 deletion features/infos/infos-panes/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(projects.shared.uiModels)
implementation(projects.shared.resources)
implementation(projects.features.infos.infosUiModels)
implementation(projects.features.infos.infosUi)
implementation(projects.features.socials.socialsUi)
implementation(projects.features.navigation)
implementation(projects.style.components.markdown)
implementation(projects.style.components.placeholder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.paligot.confily.infos.panes

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.CoCUi
import com.paligot.confily.infos.ui.models.CoCUi
import com.paligot.confily.style.theme.ConfilyTheme

@Preview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.EventUi
import com.paligot.confily.infos.ui.models.EventUi
import com.paligot.confily.style.theme.ConfilyTheme

@ExperimentalFoundationApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package com.paligot.confily.infos.panes
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.MenuItemUi
import com.paligot.confily.infos.ui.models.MenuItemUi
import com.paligot.confily.style.theme.ConfilyTheme
import kotlinx.collections.immutable.persistentListOf

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.paligot.confily.infos.panes

import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.Preview
import com.paligot.confily.models.ui.QuestionAndResponseUi
import com.paligot.confily.infos.ui.models.QuestionAndResponseUi
import com.paligot.confily.style.theme.ConfilyTheme
import kotlinx.collections.immutable.persistentListOf

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.unit.dp
import com.paligot.confily.models.ui.CoCUi
import com.paligot.confily.infos.ui.models.CoCUi
import com.paligot.confily.resources.Resource
import com.paligot.confily.resources.action_contact_organizers_mail
import com.paligot.confily.resources.action_contact_organizers_phone
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,14 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.semantics.heading
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import com.paligot.confily.infos.ui.models.EventUi
import com.paligot.confily.infos.ui.tickets.TicketDetailed
import com.paligot.confily.infos.ui.tickets.TicketQrCode
import com.paligot.confily.models.ui.EventUi
import com.paligot.confily.models.ui.findBluesky
import com.paligot.confily.models.ui.findEmail
import com.paligot.confily.models.ui.findFacebook
import com.paligot.confily.models.ui.findGitHub
import com.paligot.confily.models.ui.findInstagram
import com.paligot.confily.models.ui.findLinkedIn
import com.paligot.confily.models.ui.findMastodon
import com.paligot.confily.models.ui.findWebsite
import com.paligot.confily.models.ui.findX
import com.paligot.confily.models.ui.findYouTube
import com.paligot.confily.resources.Resource
import com.paligot.confily.resources.title_plan
import com.paligot.confily.resources.title_ticket
import com.paligot.confily.socials.ui.SocialsSection
import com.paligot.confily.style.events.cards.AddressCard
import com.paligot.confily.style.events.socials.SocialsSection
import org.jetbrains.compose.resources.stringResource

@Composable
Expand All @@ -55,16 +45,7 @@ fun Event(
onLinkClicked = onLinkClicked,
modifier = Modifier.padding(horizontal = 16.dp),
isLoading = isLoading,
xUrl = event.eventInfo.socials.findX()?.url,
mastodonUrl = event.eventInfo.socials.findMastodon()?.url,
blueskyUrl = event.eventInfo.socials.findBluesky()?.url,
facebookUrl = event.eventInfo.socials.findFacebook()?.url,
instagramUrl = event.eventInfo.socials.findInstagram()?.url,
youtubeUrl = event.eventInfo.socials.findYouTube()?.url,
githubUrl = event.eventInfo.socials.findGitHub()?.url,
linkedinUrl = event.eventInfo.socials.findLinkedIn()?.url,
websiteUrl = event.eventInfo.socials.findWebsite()?.url,
emailUrl = event.eventInfo.socials.findEmail()?.url
socials = event.eventInfo.socials
)
}
event.ticket?.let {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.paligot.confily.infos.ui.menus.MenuItem
import com.paligot.confily.models.ui.MenuItemUi
import com.paligot.confily.infos.ui.models.MenuItemUi
import kotlinx.collections.immutable.ImmutableList

@ExperimentalMaterial3Api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.paligot.confily.infos.ui.models.QuestionAndResponseUi
import com.paligot.confily.infos.ui.qanda.QAndAItem
import com.paligot.confily.models.ui.QuestionAndResponseUi
import kotlinx.collections.immutable.ImmutableList

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import androidx.compose.foundation.lazy.grid.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.paligot.confily.models.ui.TeamMemberItemUi
import com.paligot.confily.infos.ui.models.TeamMemberItemUi
import com.paligot.confily.style.components.placeholder.placeholder
import com.paligot.confily.style.speakers.items.LargeSpeakerItem
import com.paligot.confily.style.theme.SpacingTokens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.paligot.confily.infos.ui.models.TeamMemberUi
import com.paligot.confily.infos.ui.team.TeamDetailSection
import com.paligot.confily.models.ui.TeamMemberUi
import com.paligot.confily.resources.Resource
import com.paligot.confily.resources.screen_team
import com.paligot.confily.style.theme.Scaffold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.CodeOfConduct
import com.paligot.confily.models.ui.CoCUi
import com.paligot.confily.infos.ui.models.CoCUi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.lifecycle.viewModelScope
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.mapToEventInfoUi
import com.paligot.confily.core.networking.entities.mapToTicketUi
import com.paligot.confily.models.ui.EventUi
import com.paligot.confily.infos.ui.models.EventUi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.mapToMenuItemUi
import com.paligot.confily.models.ui.MenuItemUi
import com.paligot.confily.infos.ui.models.MenuItemUi
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.mapToQuestionAndResponseUi
import com.paligot.confily.models.ui.QuestionAndResponseUi
import com.paligot.confily.infos.ui.models.QuestionAndResponseUi
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.mapToTeamMemberItemUi
import com.paligot.confily.models.ui.TeamMemberItemUi
import com.paligot.confily.infos.ui.models.TeamMemberItemUi
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.navigation.toRoute
import com.paligot.confily.core.events.EventRepository
import com.paligot.confily.core.events.entities.mapToTeamMemberUi
import com.paligot.confily.infos.routes.TeamMember
import com.paligot.confily.models.ui.TeamMemberUi
import com.paligot.confily.infos.ui.models.TeamMemberUi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.catch
Expand Down
13 changes: 13 additions & 0 deletions features/infos/infos-ui-models/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id("confily.ui.models")
}

android {
namespace = "com.paligot.confily.infos.ui.models"
}

kotlin {
sourceSets.commonMain.dependencies {
api(projects.features.socials.socialsUiModels)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paligot.confily.models.ui
package com.paligot.confily.infos.ui.models

data class CoCUi(
val text: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.paligot.confily.models.ui
package com.paligot.confily.infos.ui.models

import com.paligot.confily.socials.ui.models.SocialUi
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf

Expand Down Expand Up @@ -27,13 +28,7 @@ data class EventInfoUi(
latitude = 50.6526513,
longitude = 2.9826465,
date = "June 9th 2022",
socials = persistentListOf(
SocialUi(type = SocialTypeUi.X, url = "https://twitter.com/DevfestLille"),
SocialUi(
type = SocialTypeUi.LinkedIn,
url = "https://www.linkedin.com/company/gdg-lille/"
)
),
socials = persistentListOf(SocialUi.x, SocialUi.linkedIn),
faqLink = "https://devfest.gdglille.org/faq/",
codeOfConductLink = "https://devfest.gdglille.org/code-conduite/"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.paligot.confily.models.ui
package com.paligot.confily.infos.ui.models

data class EventUi(
val eventInfo: EventInfoUi,
Expand Down
Loading

0 comments on commit d49239b

Please sign in to comment.