This PR contains the work done to implement the rendering of the (lack of) repositories in the `MenuBarView` view UI interface. For this purpose, some components have been created: `ListHeader`, `ListItemEmpty`, and `ListItem`. Furthermore, some preview-specific code have been implemented as well, specially to add dummy repositories to the previews. Reviewed-on: #4 Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
39 lines
659 B
Swift
39 lines
659 B
Swift
//
|
|
// Repository.swift
|
|
// Piper ~ App
|
|
//
|
|
// Created by Javier Cicchelli on 05/10/2024.
|
|
// Copyright © 2024 Röck+Cöde. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SwiftData
|
|
|
|
@Model
|
|
final class Repository {
|
|
|
|
// MARK: Properties
|
|
|
|
@Attribute(.unique) var path: URL
|
|
|
|
var addedAt: Date
|
|
var sortOrder: Int
|
|
|
|
// MARK: Initialisers
|
|
|
|
init(
|
|
_ path: URL,
|
|
sortOrder: Int,
|
|
addedAt: Date = .now
|
|
) {
|
|
self.path = path
|
|
self.addedAt = addedAt
|
|
self.sortOrder = sortOrder
|
|
}
|
|
|
|
// MARK: Computed
|
|
|
|
@Transient var name: String { path.lastPathComponent }
|
|
|
|
}
|