-
-
Notifications
You must be signed in to change notification settings - Fork 1
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 #37 from krystxf/feat/ios-app
feat: ios app
- Loading branch information
Showing
29 changed files
with
1,024 additions
and
192 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
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
56 changes: 56 additions & 0 deletions
56
apps/mobile/metro-now/common/components/route-name.view.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,56 @@ | ||
// metro-now | ||
// https://github.com/krystxf/metro-now | ||
|
||
import SwiftUI | ||
|
||
struct RouteNameIconView: View { | ||
let label: String | ||
let background: Color | ||
|
||
var body: some View { | ||
Text(label.uppercased()) | ||
.font(.system(size: 12, weight: .bold)) | ||
.foregroundStyle(.white) | ||
.fixedSize(horizontal: true, vertical: true) | ||
.frame(width: 26, height: 26) | ||
.background(Rectangle().fill(background)) | ||
.clipShape(.rect(cornerRadius: 6)) | ||
} | ||
} | ||
|
||
#Preview { | ||
RouteNameIconView( | ||
label: "a", | ||
background: .green | ||
) | ||
|
||
RouteNameIconView( | ||
label: "b", | ||
background: .yellow | ||
) | ||
|
||
RouteNameIconView( | ||
label: "c", | ||
background: .red | ||
) | ||
|
||
RouteNameIconView( | ||
label: "28", | ||
background: .purple | ||
) | ||
|
||
RouteNameIconView( | ||
label: "99", | ||
background: .black | ||
) | ||
|
||
RouteNameIconView( | ||
label: "149", | ||
background: .blue | ||
) | ||
|
||
RouteNameIconView( | ||
label: "912", | ||
background: .black | ||
) | ||
} |
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
64 changes: 64 additions & 0 deletions
64
apps/mobile/metro-now/common/utils/get-color-by-route-name.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,64 @@ | ||
// metro-now | ||
// https://github.com/krystxf/metro-now | ||
|
||
import SwiftUI | ||
|
||
private let FALLBACK_COLOR: Color = .black | ||
|
||
func getColorByRouteName(_ metroLine: MetroLine?) -> Color { | ||
switch metroLine { | ||
case .A: | ||
.green | ||
case .B: | ||
.yellow | ||
case .C: | ||
.red | ||
default: FALLBACK_COLOR | ||
} | ||
} | ||
|
||
func getColorByRouteName(_ routeNumber: Int?) -> Color { | ||
guard let routeNumber else { | ||
return FALLBACK_COLOR | ||
} | ||
|
||
// tram | ||
if routeNumber < 100 { | ||
if routeNumber >= 90 { | ||
return .black | ||
} | ||
|
||
return .purple | ||
} | ||
|
||
// bus | ||
if routeNumber >= 900 { | ||
return .black | ||
} | ||
|
||
return .blue | ||
} | ||
|
||
func getColorByRouteName(_ routeName: String?) -> Color { | ||
guard let routeName else { | ||
return FALLBACK_COLOR | ||
} | ||
|
||
if let routeNumber = Int(routeName) { | ||
return getColorByRouteName(routeNumber) | ||
} else if let metroLine = MetroLine(rawValue: routeName) { | ||
return getColorByRouteName(metroLine) | ||
} | ||
|
||
// ferry | ||
if routeName.hasPrefix("P") { | ||
return Color.blue | ||
} | ||
|
||
// funicular | ||
if routeName.hasPrefix("LD") { | ||
return Color.blue | ||
} | ||
|
||
return FALLBACK_COLOR | ||
} |
This file was deleted.
Oops, something went wrong.
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
33 changes: 0 additions & 33 deletions
33
apps/mobile/metro-now/metro-now Watch App/pages/departure-placeholder.swift
This file was deleted.
Oops, something went wrong.
78 changes: 0 additions & 78 deletions
78
apps/mobile/metro-now/metro-now Watch App/pages/main-page.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
b272ece
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
metro-now – ./
metro-now-git-main-krystofs-projects-e2322253.vercel.app
metro-now-krystofs-projects-e2322253.vercel.app
metronow.vercel.app