updated ui for macos and ios
This commit is contained in:
1 parent
df7ab24677
commit
e3fcee3351
10 files changed
+619
-576
No files matched your search
@@ -13,65 +13,87 @@ struct NewGroupView: View {
|
||||
@State private var isJoining = false
|
||||
|
||||
var body: some View {
|
||||
NavigationStack {
|
||||
Form {
|
||||
GroupBox {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
TextField("room@conference.example.org", text: $roomJID)
|
||||
.disableAutocorrection(true)
|
||||
#if os(iOS)
|
||||
.keyboardType(.emailAddress)
|
||||
#endif
|
||||
TextField("Название (необязательно)", text: $name)
|
||||
TextField("Ваш псевдоним", text: $nickname)
|
||||
}
|
||||
} label: {
|
||||
Text("Комната")
|
||||
.font(.headline)
|
||||
#if os(iOS)
|
||||
NavigationStack {
|
||||
Form {
|
||||
formcontent()
|
||||
}
|
||||
|
||||
GroupBox {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
TextField("alice@example.org, bob@example.org", text: $invitees, axis: .vertical)
|
||||
.lineLimit(2...5)
|
||||
#if os(iOS)
|
||||
.keyboardType(.emailAddress)
|
||||
#endif
|
||||
Text("Укажите JID через запятую или с новой строки. Если комнаты ещё нет, Prosody создаст её с настройками по умолчанию.")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
.navigationTitle("Новая группа")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button("Отмена") { dismiss() }
|
||||
.disabled(isJoining)
|
||||
}
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
Button("Создать / войти") { join() }
|
||||
.fontWeight(.semibold)
|
||||
.disabled(!canJoin || isJoining)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
if nickname.isEmpty {
|
||||
nickname = model.suggestedGroupNickname
|
||||
}
|
||||
} label: {
|
||||
Text("Пригласить")
|
||||
.font(.headline)
|
||||
}
|
||||
|
||||
Label(
|
||||
"Новая комната настраивается как неанонимная и доступная участникам, чтобы поддерживать групповое OMEMO. Режим шифрования можно изменить в меню замка внутри чата.",
|
||||
systemImage: "lock.shield.fill"
|
||||
)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.navigationTitle("Новая группа")
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
#else
|
||||
List {
|
||||
formcontent()
|
||||
HStack {
|
||||
Button("Отмена") { dismiss() }
|
||||
.disabled(isJoining)
|
||||
}
|
||||
ToolbarItem(placement: .confirmationAction) {
|
||||
.buttonStyle(.glass)
|
||||
.tint(.secondary)
|
||||
.controlSize(.large)
|
||||
Spacer()
|
||||
Button("Создать / войти") { join() }
|
||||
.fontWeight(.semibold)
|
||||
.disabled(!canJoin || isJoining)
|
||||
.buttonStyle(.glassProminent)
|
||||
.controlSize(.large)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Новая группа")
|
||||
.onAppear {
|
||||
if nickname.isEmpty { nickname = model.suggestedGroupNickname }
|
||||
}
|
||||
.frame(minWidth: 480, minHeight: 330)
|
||||
#endif
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func formcontent() -> some View {
|
||||
Section("Комната") {
|
||||
TextField("room@conference.example.org", text: $roomJID)
|
||||
.disableAutocorrection(true)
|
||||
#if os(iOS)
|
||||
.keyboardType(.emailAddress)
|
||||
#endif
|
||||
TextField("Название (необязательно)", text: $name)
|
||||
TextField("Ваш псевдоним", text: $nickname)
|
||||
}
|
||||
#if os(macOS)
|
||||
.frame(minWidth: 480, minHeight: 470)
|
||||
#endif
|
||||
Section("Пригласить") {
|
||||
TextField(
|
||||
"alice@example.org, bob@example.org",
|
||||
text: $invitees,
|
||||
axis: .vertical
|
||||
)
|
||||
.lineLimit(2...5)
|
||||
#if os(iOS)
|
||||
.keyboardType(.emailAddress)
|
||||
#endif
|
||||
Text(
|
||||
"Укажите JID через запятую или с новой строки. Если комнаты ещё нет, Prosody создаст её с настройками по умолчанию."
|
||||
)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
Label(
|
||||
"Новая комната настраивается как неанонимная и доступная участникам, чтобы поддерживать групповое OMEMO. Режим шифрования можно изменить в меню замка внутри чата.",
|
||||
systemImage: "lock.shield.fill"
|
||||
)
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
private var canJoin: Bool {
|
||||
|
||||
Reference in new issue
Block a user