feat(Component): 增加 InstanceInfo 组件

增加 InstanceInfo 组件

Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
Ching 2023-05-03 21:47:38 +08:00
parent f07fcf9d9b
commit 241aca5f23
3 changed files with 55 additions and 17 deletions

View File

@ -12,6 +12,7 @@
24A07CD42A026DDB00F4ECA8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 24A07CD32A026DDB00F4ECA8 /* Assets.xcassets */; };
24A07CD82A026DDB00F4ECA8 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 24A07CD72A026DDB00F4ECA8 /* Preview Assets.xcassets */; };
24A07CE92A02730700F4ECA8 /* AddAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24A07CE82A02730700F4ECA8 /* AddAccountView.swift */; };
24A07CEB2A029C6A00F4ECA8 /* InstanceInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24A07CEA2A029C6A00F4ECA8 /* InstanceInfo.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -22,6 +23,7 @@
24A07CD52A026DDB00F4ECA8 /* duduji.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = duduji.entitlements; sourceTree = "<group>"; };
24A07CD72A026DDB00F4ECA8 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
24A07CE82A02730700F4ECA8 /* AddAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountView.swift; sourceTree = "<group>"; };
24A07CEA2A029C6A00F4ECA8 /* InstanceInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstanceInfo.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -108,6 +110,7 @@
24A07CE32A02709900F4ECA8 /* Components */ = {
isa = PBXGroup;
children = (
24A07CEA2A029C6A00F4ECA8 /* InstanceInfo.swift */,
);
path = Components;
sourceTree = "<group>";
@ -208,6 +211,7 @@
files = (
24A07CD22A026DDA00F4ECA8 /* ContentView.swift in Sources */,
24A07CD02A026DDA00F4ECA8 /* dudujiApp.swift in Sources */,
24A07CEB2A029C6A00F4ECA8 /* InstanceInfo.swift in Sources */,
24A07CE92A02730700F4ECA8 /* AddAccountView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -11,10 +11,14 @@ struct AddAccountView: View {
@State private var instanceAddress = "nofan.xyz"
var body: some View {
VStack {
NavigationStack {
Form {
Section {
TextField("", text: $instanceAddress)
.keyboardType(.URL)
.textContentType(.URL)
.textInputAutocapitalization(.never)
.autocorrectionDisabled()
}
Section {
Button("登录") {
@ -25,24 +29,11 @@ struct AddAccountView: View {
}
.listRowBackground(Color.green)
Section("服务器信息") {
LabeledContent("名称", value: "nofan | Fanyou in Mastodon")
Text("给饭友的自留地")
LabeledContent("邮件", value: "^^")
LabeledContent("版本") {
Text("3.5.3").monospaced()
}
LabeledContent("用户", value: "1206")
LabeledContent("嘟文", value: "489974")
LabeledContent("域名", value: "11648")
}
Section("服务器规则") {
Text("保持友善,善用折叠屏蔽功能")
Text("不鼓励发布色情暴力内容,如发布,务必主动标记为敏感内容")
Text("请尽量避免将用户消息截图转发至其他平台")
}
InstanceInfoSection()
}
}
.navigationTitle("添加账户")
.navigationBarTitleDisplayMode(.inline)
}
}

View File

@ -0,0 +1,43 @@
//
// InstanceInfo.swift
// duduji
//
// Created by ching on 2023/5/3.
//
import SwiftUI
struct InstanceInfo: View {
var body: some View {
Form {
InstanceInfoSection()
}
}
}
struct InstanceInfoSection: View {
var body: some View {
Section("服务器信息") {
LabeledContent("名称", value: "nofan | Fanyou in Mastodon")
Text("给饭友的自留地")
LabeledContent("邮件", value: "^^")
LabeledContent("版本") {
Text("3.5.3").monospaced()
}
LabeledContent("用户", value: "1206")
LabeledContent("嘟文", value: "489974")
LabeledContent("域名", value: "11648")
}
Section("服务器规则") {
Text("保持友善,善用折叠屏蔽功能")
Text("不鼓励发布色情暴力内容,如发布,务必主动标记为敏感内容")
Text("请尽量避免将用户消息截图转发至其他平台")
}
}
}
struct InstanceInfo_Previews: PreviewProvider {
static var previews: some View {
InstanceInfo()
}
}