Add legal consent and reliable external redirects
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
extends Control
|
||||
|
||||
const Brand := preload("res://scripts/ui/medmind_style.gd")
|
||||
const Builder := preload("res://scripts/ui/legal_document_builder.gd")
|
||||
|
||||
var content: VBoxContainer
|
||||
var current_kind := "terms"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
visible = false
|
||||
top_level = true
|
||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
var shade := ColorRect.new()
|
||||
shade.color = Color(0, 0, 0, 0.72)
|
||||
shade.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
add_child(shade)
|
||||
var center := CenterContainer.new()
|
||||
center.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
add_child(center)
|
||||
var panel := PanelContainer.new()
|
||||
panel.custom_minimum_size = Vector2(720, 620)
|
||||
panel.add_theme_stylebox_override("panel", Brand.panel_box(UIThemeService.is_dark_mode()))
|
||||
center.add_child(panel)
|
||||
var layout := VBoxContainer.new()
|
||||
layout.add_theme_constant_override("separation", 14)
|
||||
panel.add_child(layout)
|
||||
var scroll := ScrollContainer.new()
|
||||
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||
layout.add_child(scroll)
|
||||
content = VBoxContainer.new()
|
||||
content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
content.add_theme_constant_override("separation", 14)
|
||||
scroll.add_child(content)
|
||||
var actions := HBoxContainer.new()
|
||||
actions.alignment = BoxContainer.ALIGNMENT_END
|
||||
layout.add_child(actions)
|
||||
var browser := Button.new()
|
||||
browser.text = "Open in browser"
|
||||
browser.pressed.connect(func(): OS.shell_open(LegalService.public_url(current_kind)))
|
||||
actions.add_child(browser)
|
||||
var close := Button.new()
|
||||
close.text = "Close"
|
||||
close.pressed.connect(hide)
|
||||
actions.add_child(close)
|
||||
|
||||
|
||||
func show_document(kind: String) -> void:
|
||||
current_kind = kind
|
||||
Builder.populate(content, LegalService.get_document(kind))
|
||||
visible = true
|
||||
Reference in New Issue
Block a user