-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #319 from aapis/feature/1.15/more-inspectors
Inspector improvements
- Loading branch information
Showing
10 changed files
with
319 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
KWCore/Sources/UI/WidgetLibrary/WidgetLibrary.UI.Links.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// WidgetLibrary.UI.Links.swift | ||
// KlockWork | ||
// | ||
// Created by Ryan Priebe on 2024-10-28. | ||
// Copyright © 2024 YegCollective. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
import KWCore | ||
|
||
extension WidgetLibrary.UI { | ||
public struct Links { | ||
struct ToProject: View { | ||
@EnvironmentObject private var state: Navigation | ||
public var entity: Project? | ||
@State private var isHighlighted: Bool = false | ||
|
||
var body: some View { | ||
Button { | ||
self.state.session.project = self.entity | ||
self.state.to(.projectDetail) | ||
} label: { | ||
HStack(alignment: .top, spacing: 10) { | ||
Image(systemName: self.isHighlighted ? "folder.fill" : "folder") | ||
.symbolRenderingMode(.hierarchical) | ||
.foregroundStyle(self.entity?.backgroundColor ?? Theme.lightWhite) | ||
|
||
Text(self.entity?.name ?? "Error: Invalid project name") | ||
Spacer() | ||
} | ||
.help("Go to \(self.entity?.name ?? "Error: Invalid project name")") | ||
} | ||
.buttonStyle(.plain) | ||
.useDefaultHover({ hover in self.isHighlighted = hover}) | ||
.padding(.leading) | ||
} | ||
} | ||
|
||
struct ToJob: View { | ||
@EnvironmentObject private var state: Navigation | ||
public var entity: Job? | ||
@State private var isHighlighted: Bool = false | ||
|
||
var body: some View { | ||
Button { | ||
self.state.session.job = self.entity | ||
self.state.to(.jobs) | ||
} label: { | ||
HStack(alignment: .top, spacing: 10) { | ||
Image(systemName: self.isHighlighted ? "folder.fill" : "folder") | ||
.symbolRenderingMode(.hierarchical) | ||
.foregroundStyle(self.entity?.backgroundColor ?? Theme.lightWhite) | ||
|
||
Text(self.entity?.title ?? self.entity?.jid.string ?? "Error: Invalid job title and ID") | ||
Spacer() | ||
} | ||
.help("Go to \(self.entity?.title ?? self.entity?.jid.string ?? "Error: Invalid job title and ID")") | ||
} | ||
.buttonStyle(.plain) | ||
.useDefaultHover({ hover in self.isHighlighted = hover}) | ||
.padding(.leading) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.