Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Resources/Views/Team/_team.leaf
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@
</a>
#endif
#if(teamMember.twitter):
<a href="#(teamMember.twitter)" class="btn btn-icon btn-secondary btn-twitter btn-sm bg-white" aria-label="Twitter">
<a href="#(teamMember.twitter)" class="btn btn-icon btn-secondary btn-twitter btn-sm bg-white me-2" aria-label="Twitter">
<i class="bx bxl-twitter"></i>
</a>
#endif
#if(teamMember.slack):
<a href="#(teamMember.slack)" class="btn btn-icon btn-secondary btn-slack btn-sm bg-white" aria-label="Slack">
<i class="bx bxl-slack"></i>
</a>
#endif
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions Sources/App/Context/HomeContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ struct TeamContext: Content {
let role: String?
let twitter: String?
let linkedin: String?
let slack: String?
let imageURL: String?
}

Expand Down
20 changes: 17 additions & 3 deletions Sources/App/Features/Home/HomeRouteController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,24 @@ struct HomeRouteController: RouteCollection {

try await event.$days.load(on: req.db)

// We shuffle the team members array on each load request in order to remove any bias in the array.
// All volunteers are shown equally.
// Fetch team data from API to maintain consistency between web and mobile
let teamAPIController = TeamAPIController()
let teamResponse = try await teamAPIController.getTeam(req: req)

// Convert API response to context format for the web template
let teamMembers = teamResponse.teamMembers.map { member in
TeamContext.TeamMember(
name: member.name,
role: member.role,
twitter: member.twitter,
linkedin: member.linkedin,
slack: member.slack,
imageURL: member.imageURL
)
}

let context = TeamContext(
teamMembers: teamMembers.shuffled(),
teamMembers: teamMembers,
event: EventContext(event: event)
)

Expand Down
72 changes: 0 additions & 72 deletions Sources/App/Features/Home/TeamMembers.swift

This file was deleted.

95 changes: 95 additions & 0 deletions Sources/App/Features/Team/Controllers/TeamAPIController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import Vapor

struct TeamAPIController: RouteCollection {
func boot(routes: RoutesBuilder) throws {
routes.get(use: getTeam)
}

@Sendable func getTeam(req: Request) async throws -> TeamResponse {
let teamMembers = [
TeamMember(
name: "Adam Rush",
role: "Founder and Host",
twitter: "https://twitter.com/Adam9Rush",
linkedin: "https://www.linkedin.com/in/swiftlyrush/",
slack: "https://swiftleedsworkspace.slack.com/archives/D05RK6AAV29",
imageURL: "/img/team/rush.jpg"
),
TeamMember(
name: "James Sherlock",
role: "Production Team Lead",
twitter: "https://twitter.com/JamesSherlouk",
linkedin: "https://www.linkedin.com/in/jamessherlockdeveloper/",
slack: "https://swiftleedsworkspace.slack.com/archives/D05RK6AAV29",
imageURL: "/img/team/sherlock.jpg"
),
TeamMember(
name: "Matthew Gallagher",
role: "Registration and Mobile App",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably aught to revisit these roles since Oxley took over on Mobile App - but let's do that in a different PR.

twitter: "https://twitter.com/pdamonkey",
linkedin: "https://www.linkedin.com/in/pdamonkey/",
slack: "https://swiftleedsworkspace.slack.com/archives/D030PN528UA",
imageURL: "/img/team/matt.jpg"
),
TeamMember(
name: "Adam Oxley",
role: nil,
twitter: "https://twitter.com/admoxly",
linkedin: "https://www.linkedin.com/in/adam-oxley-41183a82/",
slack: "https://swiftleedsworkspace.slack.com/team/U02DRL7KUCS",
imageURL: "/img/team/oxley.jpg"
),
TeamMember(
name: "Noam Efergan",
role: "Camera Operator and Social Media",
twitter: "https://twitter.com/No_Wham",
linkedin: "https://www.linkedin.com/in/noamefergan/",
slack: "https://swiftleedsworkspace.slack.com/archives/D05RK6AAV29",
imageURL: "/img/team/noam.jpg"
),
TeamMember(
name: "Kannan Prasad",
role: nil,
twitter: nil,
linkedin: "https://www.linkedin.com/in/kannanprasad/",
slack: "https://swiftleedsworkspace.slack.com/archives/D0477TRS28G",
imageURL: "/img/team/kannan.jpg"
),
TeamMember(
name: "Muralidharan Kathiresan",
role: nil,
twitter: "https://twitter.com/Muralidharan_K",
linkedin: "https://www.linkedin.com/in/muralidharankathiresan/",
slack: "https://swiftleedsworkspace.slack.com/archives/D05RK6AAV29",
imageURL: "/img/team/mural.jpg"
),
TeamMember(
name: "Preeti Thombare",
role: nil,
twitter: nil,
linkedin: nil,
slack: "https://swiftleedsworkspace.slack.com/archives/D05RK6AAV29",
imageURL: "/img/team/preeti.jpg"
),
TeamMember(
name: "Paul Willis",
role: nil,
twitter: nil,
linkedin: "https://www.linkedin.com/in/paulrobertwillis/",
slack: "https://swiftleedsworkspace.slack.com/archives/D05RK6AAV29",
imageURL: "/img/team/paul.jpg"
),
TeamMember(
name: "Joe Williams",
role: "Camera Operator",
twitter: "https://twitter.com/joedub_dev",
linkedin: "https://www.linkedin.com/in/joe-williams-1676b871/",
slack: "https://swiftleedsworkspace.slack.com/archives/C05N7JZE2NP",
imageURL: "/img/team/joe.jpg"
),
]

// Shuffle the team members to avoid bias, just like the web page does
return TeamResponse(teamMembers: teamMembers.shuffled())
}
}
15 changes: 15 additions & 0 deletions Sources/App/Features/Team/Models/TeamResponse.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Foundation
import Vapor

struct TeamResponse: Content {
let teamMembers: [TeamMember]
}

struct TeamMember: Content {
let name: String
let role: String?
let twitter: String?
let linkedin: String?
let slack: String?
let imageURL: String
}
1 change: 1 addition & 0 deletions Sources/App/routes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func routes(_ app: Application) throws {

let apiV2Routes = app.grouped("api", "v2")
try apiV2Routes.grouped("schedule").register(collection: ScheduleAPIControllerV2())
try apiV2Routes.grouped("team").register(collection: TeamAPIController())

// MARK: - Admin Routes
let adminRoutes = app.grouped("admin").grouped(AdminMiddleware())
Expand Down
Loading