Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 HCPSDKFIORIUIKIT-2812 SwiftUI KPIProgressItem refactor #936

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zzchao-1999
Copy link
Collaborator

All Percentage Fraction
Screenshot 2024-12-11 at 01 06 44 Screenshot 2024-12-11 at 01 07 07 Screenshot 2024-12-11 at 01 07 42

@zzchao-1999 zzchao-1999 requested a review from a team as a code owner December 11, 2024 07:10
@zzchao-1999 zzchao-1999 requested review from billzhou0223 and removed request for a team December 11, 2024 07:10
public protocol _KPIProgressItemModel: KpiProgressComponent, SubtitleComponent, FootnoteComponent, KPIHeaderItemModel {}

@available(*, unavailable, renamed: "_KPIProgressItemModel", message: "Will be removed in the future release. Please create KPIProgressItem with other initializers instead.")
public protocol KPIProgressItemModel {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Docs Violation: public declarations should be documented. (missing_docs)

public protocol _KPIProgressItemModel: KpiProgressComponent, SubtitleComponent, FootnoteComponent, KPIHeaderItemModel {}

@available(*, unavailable, renamed: "_KPIProgressItemModel", message: "Will be removed in the future release. Please create KPIProgressItem with other initializers instead.")
public protocol KPIProgressItemModel {}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Docs Violation: public declarations should be documented. (missing_docs)

}

public extension KPIProgressItem {
init(data: Binding<KPIItemData>, chartSize: KPIProgressItemSize = .large) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Docs Violation: public declarations should be documented. (missing_docs)

}

public extension KPIProgressItem {
init(data: Binding<KPIItemData>, chartSize: KPIProgressItemSize = .large) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Docs Violation: public declarations should be documented. (missing_docs)

@zzchao-1999 zzchao-1999 requested a review from dyongxu December 11, 2024 08:03
@dyongxu dyongxu requested a review from KevinZK December 12, 2024 04:20
@dyongxu
Copy link
Contributor

dyongxu commented Dec 12, 2024

@KevinZK Can you review it from "NSS" support perspective, if this refactoring code is ready for the future NSS enhancement?

@KevinZK
Copy link
Collaborator

KevinZK commented Dec 12, 2024

Based on the NSS features I have designed so far, I make some suggestions:
For this component to fully support the NSS style, you need to split the KPIProgressItem component as much as possible.
For example, we can split KPIProgressItem into three components _TitleComponent, _SubtitleComponent, and _circleProgressComponent.
After designing like this, the configuration code for NSS will be generated in the ~style.fiori.swift file.

extension KPIProgressItemNSSStyle {
    struct ContentNSSStyle: KPIProgressItemStyle {
        let kpiProgressItemConfiguration: KPIProgressItemConfiguration
        let nssData: NSSStyleData
        func makeBody(_ configuration: KPIProgressItemConfiguration) -> some View {
            KPIProgressItem(configuration)
                .modifier(NSSStyleModifier<NSSBaseStyleType>(styles: self.nssData))
            // Add custom nss style for its content
            // .modifier(NSSStyleModifier<<#T: NSSCovert & RawRepresentable#>>(styles: <#T##NSSStyleData#>)
        }
    }

    struct TitleNSSStyle: TitleStyle {
         let kpiProgressItemConfiguration: KPIProgressItemConfiguration
        let nssData: NSSStyleData

        func makeBody(_ configuration: TitleConfiguration) -> some View {
            Title(configuration)
                .modifier(NSSStyleModifier<NSSBaseStyleType>(styles: self.nssData))
            // Add custom nss style for Title
            // .modifier(NSSStyleModifier<<#T: NSSCovert & RawRepresentable#>>(styles: <#T##NSSStyleData#>)
        }
    }

struct SubtitleNSSStyle: SubtitleStyle {
         let kpiProgressItemConfiguration: KPIProgressItemConfiguration
        let nssData: NSSStyleData

        func makeBody(_ configuration: SubtitleConfiguration) -> some View {
            Subtitle(configuration)
                .modifier(NSSStyleModifier<NSSBaseStyleType>(styles: self.nssData))
            // Add custom nss style for Subtitle
            // .modifier(NSSStyleModifier<<#T: NSSCovert & RawRepresentable#>>(styles: <#T##NSSStyleData#>)
        }
    }

    struct CircleProgressNSSStyle: ProgressStyle {
        let kpiProgressItemConfiguration: KPIProgressItemConfiguration
        let nssData: NSSStyleData

        func makeBody(_ configuration: CircleProgressConfiguration) -> some View {
            CircleProgress(configuration)
                .modifier(NSSStyleModifier<NSSBaseStyleType>(styles: self.nssData))
            // Add custom nss style for Circleprogress
            // .modifier(NSSStyleModifier<<#T: NSSCovert & RawRepresentable#>>(styles: <#T##NSSStyleData#>)
        }
    }
}

Since my current pull request is still under review, for reference only.

@dyongxu
Copy link
Contributor

dyongxu commented Dec 19, 2024

@zzchao-1999 Some merge conflict to be resolved

Copy link
Contributor

@dyongxu dyongxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolve merge conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants