<?php
	declare(strict_types = 1);
	namespace Kimendisch\Sbgg_Jetzt;
	use Flake\Lang;
	use Flake\Lang_Dict;
	use Flake\Page;
	use Flake\Hidden;
	use Flake\File;
	use Flake\Project;
	
	// HACK: CONVERT GET PARAM TO PATH PARAM //
	if(isset($_GET["lang"])){
		$new_lang = $_GET["lang"];
		if($new_lang === "de") $new_lang = "";
		header("HTTP/1.1 303 See Other");
		header("Location: /" . $new_lang);
	}
	
	
	// HACK: REMOVE `DE` PATH PARAM //
	if(!in_array(Project::param("lang"), [null, "en"])){
		header("HTTP/1.1 303 See Other");
		header("Location: /");
	}
	
	
	// LANGUAGE MANAGER //
	// hack: fake get param from url path
	$param_lang = Project::param("lang") ?? "de";
	$_GET["lang"] = $param_lang;
	
	// initialize
	$lang = new Lang(list: ["de", "en"], default: "de");
	
	// load dict
	$dict = new Lang_Dict($lang);
	require("./page/strings.php");
	
	// make available to `eval`-ed scripts
	global $kimendisch_sbgg_jetzt_dict;
	$kimendisch_sbgg_jetzt_dict = $dict;
	
	
	// PAGE INIT //
	Page::start();
	
	Page::title($dict->get("title"));
	Page::icon("./asset/logo-256.png");
	Page::description($dict->get("description"));
	
	Page::lang($lang->get());
	Page::viewport(scale: 1, zoom: true);
	Page::$head["alternate_de"] = '<link rel="alternate" hreflang="de" href="/" />';
	Page::$head["alternate_en"] = '<link rel="alternate" hreflang="en" href="/en" />';
	
	Page::robots(index: true, follow: true);
	Page::author("Kim Endisch");
	Page::keywords("selbstbestimmungsgesetz-jetzt", "sbgg-jetzt", "selbstbestimmungsgesetz", "selbstbestimmung", "sbgg", "SBGG", "tsg", "transsexuellengesetz", "trans", "nicht-binär", "non-binary", "deutschland", "gender", "geschlecht", "identität", "roadmap", "timeline", "stand", "aktuell", "aktueller stand", "wann", "wann kommt", "inkrafttreten", "referentenentwurf");
	
	Page::$head["analytics"] = '<script defer data-domain="sbgg.jetzt" src="https://analytics.tjdev.de/js/script.js"></script>';
	Page::$head["mastodon_verify"] = '<link rel="me" href="https://lsbt.me/@sbggjetzt" />';
	
	Page::css(__DIR__ . "/style.css");
	Page::js(__DIR__ . "/copylink_dict.js.php", eval: true);
	Page::js(__DIR__ . "/copylink.js");
	Page::js(__DIR__ . "/newsletter.js");
	
	Page::font("ubuntu");
	Page::font("tabler");
?>





<div class="page-container">
	<div class="page">
		<div class="title">
			<h1><?= $dict->get("page_title_h1") ?></h1>
			<h2><?= $dict->get("page_title_h2") ?></h2>
		</div>
		
		<div class="section">
			<div id="why" class="content">
				<div class="box">
					<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("why_title") ?></span>
					
					<?php
						$why_text = $dict->get("why_text");
						foreach($why_text as $one_why_text_line){
							echo("<span>" . $one_why_text_line . "</span>");
						}
					?>
				</div>
			</div>
		</div>
		
		<div id="timeline" class="section">
			<div class="header">
				<span class="icon ti ti-clock"></span>
				<span class="text"><?= $dict->get("timeline_title") ?></span>
				<button class="copylink ti ti-link"></button>
			</div>
			<div class="content">
				<div class="timeline">
					<div id="koalitionsvertrag" class="item done">
						<div class="connector">
							<span class="waypoint ti ti-heart-handshake"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_koalitionsvertrag_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_koalitionsvertrag_title") ?></span>
							
							<?php
								$timeline_koalitionsvertrag_text = $dict->get("timeline_koalitionsvertrag_text");
								foreach($timeline_koalitionsvertrag_text as $one_timeline_koalitionsvertrag_text_line){
									echo("<span>" . $one_timeline_koalitionsvertrag_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://web.archive.org/web/20230630200056/https://www.spd.de/fileadmin/Dokumente/Koalitionsvertrag/Koalitionsvertrag_2021-2025.pdf" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_koalitionsvertrag_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="eckpunktepapier" class="item done">
						<div class="connector">
							<span class="waypoint ti ti-border-corners"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_eckpunktepapier_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_eckpunktepapier_title") ?></span>
							
							<?php
								$timeline_eckpunktepapier_text = $dict->get("timeline_eckpunktepapier_text");
								foreach($timeline_eckpunktepapier_text as $one_timeline_eckpunktepapier_text_line){
									echo("<span>" . $one_timeline_eckpunktepapier_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://web.archive.org/web/20230418072943/https://www.bmfsfj.de/resource/blob/199382/1e751a6b7f366eec396d146b3813eed2/20220630-selbstbestimmungsgesetz-eckpunkte-data.pdf" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_eckpunktepapier_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="referentenentwurf" class="item done">
						<div class="connector">
							<span class="waypoint ti ti-pencil"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_referentenentwurf_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_referentenentwurf_title") ?></span>
							
							<?php
								$timeline_referentenentwurf_text = $dict->get("timeline_referentenentwurf_text");
								foreach($timeline_referentenentwurf_text as $one_timeline_referentenentwurf_text_line){
									echo("<span>" . $one_timeline_referentenentwurf_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://web.archive.org/web/20230610171918/https://www.bmfsfj.de/resource/blob/224548/4d24ff0698216058eb758ada5c84bd90/entwurf-selbstbestimmungsgesetz-data.pdf" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_referentenentwurf_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
								<a href="https://web.archive.org/web/20230714124925/https://www.bmj.de/SharedDocs/Downloads/DE/Themen/FamilieUndPartnerschaft/Fragen_und_Antworten_SBGG.pdf?__blob=publicationFile" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_referentenentwurf_button2") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="regierungsentwurf" class="item done">
						<div class="connector">
							<span class="waypoint ti ti-notes"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_regierungsentwurf_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_regierungsentwurf_title") ?></span>
							
							<?php
								$timeline_regierungsentwurf_text = $dict->get("timeline_regierungsentwurf_text");
								foreach($timeline_regierungsentwurf_text as $one_timeline_regierungsentwurf_text_line){
									echo("<span>" . $one_timeline_regierungsentwurf_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://web.archive.org/web/20230823122446/https://www.bmj.de/SharedDocs/Downloads/DE/Gesetzgebung/RegE/RegE_Selbstbestimmung.pdf?__blob=publicationFile&v=2" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_regierungsentwurf_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="bundesrat" class="item done">
						<div class="connector">
							<span class="waypoint ti ti-zoom-check"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_bundesrat_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_bundesrat_title") ?></span>
							
							<?php
								$timeline_bundesrat_text = $dict->get("timeline_bundesrat_text");
								foreach($timeline_bundesrat_text as $one_timeline_bundesrat_text_line){
									echo("<span>" . $one_timeline_bundesrat_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://yt.artemislena.eu/watch?v=n0chw7-cAsQ" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_bundesrat_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
								<a href="https://web.archive.org/web/20231020142352/https://www.bundesrat.de/SharedDocs/drucksachen/2023/0401-0500/432-1-23.pdf?__blob=publicationFile&v=1" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_bundesrat_button2") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="lesung-1" class="item done">
						<div class="connector">
							<span class="waypoint ti ti-podium"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_lesung_1_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_lesung_1_title") ?></span>
							
							<?php
								$timeline_lesung_1_text = $dict->get("timeline_lesung_1_text");
								foreach($timeline_lesung_1_text as $one_timeline_lesung_1_text_line){
									echo("<span>" . $one_timeline_lesung_1_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://www.bundestag.de/dokumente/textarchiv/2023/kw46-de-geschlechtseintrag-976420" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_lesung_1_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="ausschuss-anhoerung" class="item done done-stop">
						<div class="connector">
							<span class="waypoint ti ti-messages"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_ausschuss_anhoerung_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_ausschuss_anhoerung_title") ?></span>
							
							<?php
								$timeline_ausschuss_anhoerung_text = $dict->get("timeline_ausschuss_anhoerung_text");
								foreach($timeline_ausschuss_anhoerung_text as $one_timeline_ausschuss_anhoerung_text_line){
									echo("<span>" . $one_timeline_ausschuss_anhoerung_text_line . "</span>");
								}
							?>
							
							<div class="button-list">
								<a href="https://www.bundestag.de/dokumente/textarchiv/2023/kw48-pa-familie-selbstbestimmungsgesetz-978748" target="_blank" class="button">
									<span class="text"><?= $dict->get("timeline_ausschuss_anhoerung_button") ?></span>
									<span class="icon ti ti-external-link"></span>
								</a>
							</div>
						</div>
					</div>
					
					<div id="lesung-2" class="item next">
						<div class="connector">
							<span class="waypoint ti ti-podium"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_lesung_2_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_lesung_2_title") ?></span>
							
							<?php
								$timeline_lesung_2_text = $dict->get("timeline_lesung_2_text");
								foreach($timeline_lesung_2_text as $one_timeline_lesung_2_text_line){
									echo("<span>" . $one_timeline_lesung_2_text_line . "</span>");
								}
							?>
						</div>
					</div>
					
					<div id="lesung-3" class="item">
						<div class="connector">
							<span class="waypoint ti ti-hand-stop"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_lesung_3_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_lesung_3_title") ?></span>
							
							<?php
								$timeline_lesung_3_text = $dict->get("timeline_lesung_3_text");
								foreach($timeline_lesung_3_text as $one_timeline_lesung_3_text_line){
									echo("<span>" . $one_timeline_lesung_3_text_line . "</span>");
								}
							?>
						</div>
					</div>
					
					<div id="inkrafttreten" class="item">
						<div class="connector">
							<span class="waypoint ti ti-gavel"></span>
						</div>
						<div class="box">
							<?php
								$timeline_date = $dict->get("timeline_inkrafttreten_date");
								if($timeline_date !== null){
							?>
									<span class="extra"><i class="ti ti-calendar"></i><?= $timeline_date ?></span>
							<?php } ?>
							
							<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("timeline_inkrafttreten_title") ?></span>
							
							<?php
								$timeline_inkrafttreten_text = $dict->get("timeline_inkrafttreten_text");
								foreach($timeline_inkrafttreten_text as $one_timeline_inkrafttreten_text_line){
									echo("<span>" . $one_timeline_inkrafttreten_text_line . "</span>");
								}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<div id="news" class="section">
			<div class="header">
				<span class="icon ti ti-bell"></span>
				<span class="text"><?= $dict->get("news_title") ?></span>
				<button class="copylink ti ti-link"></button>
			</div>
			<div class="content rows">
				<div id="newsletter" class="box">
					<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("news_newsletter_title") ?></span>
					
					<div id="newsletter-signup-form-container" class="form-container">
						<div id="newsletter-signup-form" class="form">
							<div class="key-value-pair">
								<div class="key">
									<span class="ti ti-at"></span>
								</div>
								<div class="value-list">
									<div class="inputwrapper">
										<input id="newsletter-signup-form-mail-address" class="value" type="text" placeholder="<?= $dict->get("news_newsletter_mail_address") ?>" autocomplete="off" />
									</div>
								</div>
							</div>
							
							<div class="key-value-pair">
								<div class="key">
									<span class="ti ti-world"></span>
								</div>
								<div class="value-list">
									<div id="newsletter-signup-form-language" class="value switch" data-selected="<?= $lang->get() ?>">
										<?php foreach(["de", "en"] as $one_lang){ ?>
											<button class="option" data-value="<?= $one_lang ?>">
												<span class="text"><?= strtoupper($one_lang) ?></span>
											</button>
										<?php } ?>
									</div>
								</div>
							</div>
							
							<button id="newsletter-signup-form-submit" class="button primary">
								<span class="text"><?= $dict->get("news_newsletter_subscribe") ?></span>
								<span class="icon ti ti-chevron-right"></span>
							</button>
						</div>
						
						<div id="newsletter-signup-form-feedback" class="form-feedback gone">
							<div id="newsletter-signup-form-feedback-wait" class="form-feedback-wait centertext gone">
								<span class="icon spinning ti ti-loader-2"></span>
								<span class="text"><?= $dict->get("news_newsletter_feedback_wait") ?></span>
							</div>
							<div id="newsletter-signup-form-feedback-success" class="form-feedback-success centertext gone">
								<span class="icon ti ti-check"></span>
								<span class="text"><?= $dict->get("news_newsletter_feedback_success") ?></span>
							</div>
							<div id="newsletter-signup-form-feedback-failure" class="form-feedback-failure centertext gone">
								<span class="icon ti ti-x"></span>
								<span class="text"><?= $dict->get("news_newsletter_feedback_failure") ?></span>
							</div>
						</div>
					</div>
					
					<span class="inline"><?= $dict->get("news_newsletter_process_description") ?></span>
					
					<span class="inline gray"><?= $dict->get("news_newsletter_note") ?></span>
				</div>
				
				<div id="social-media" class="box">
					<span class="title"><button class="copylink ti ti-link"></button><?= $dict->get("news_social_media_title") ?></span>
					
					<div class="button-list">
						<a href="https://www.instagram.com/sbgg.jetzt" target="_blank" class="button">
							<span class="icon big ti ti-brand-instagram"></span>
							<div class="text">
								<span>Instagram</span>
								<span class="gray">@sbgg.jetzt</span>
							</div>
							<span class="icon ti ti-external-link"></span>
						</a>
						
						<a href="https://lsbt.me/@sbggjetzt" target="_blank" class="button">
							<span class="icon big ti ti-brand-mastodon"></span>
							<div class="text">
								<span>Mastodon</span>
								<span class="gray">@sbggjetzt@lsbt.me</span>
							</div>
							<span class="icon ti ti-external-link"></span>
						</a>
					</div>
				</div>
			</div>
		</div>
		
		<div id="about" class="section">
			<div class="header">
				<span class="icon ti ti-heart"></span>
				<span class="text"><?= $dict->get("about_title") ?></span>
				<button class="copylink ti ti-link"></button>
			</div>
			<div class="content">
				<div class="box">
					<?php
						$about_text = $dict->get("about_text");
						foreach($about_text as $one_about_text_line){
							echo("<span>" . $one_about_text_line . "</span>");
						}
					?>
					
					<div class="button-list">
						<a <?= Hidden::href("mailto:mail@sb"."gg.jetzt") ?> class="button primary">
							<span class="icon ti ti-mail"></span>
							<span class="text"><?= $dict->get("about_button_mail") ?></span>
						</a>
						<a href="https://kimendisch.de" class="button">
							<span class="icon ti ti-home"></span>
							<span class="text"><?= $dict->get("about_button_website") ?></span>
						</a>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>



<div class="footer">
	<div class="brand">
		<img src="<?= File::file("./asset/logo-256.png") ?>" alt="logo" />
		<span>SBGG.jetzt</span>
		<a href="https://git.tjdev.de/kimendisch/sbgg.jetzt" target="_blank"><?= $dict->get("text_sourcecode") ?> <i class="ti ti-external-link"></i></a>
		<span class="version">v<?= Project::version() ?></span>
	</div>
	
	<div class="lang">
		<span><i class="ti ti-world"></i></span>
		<a <?= ($lang->get() === "de" ? "class=\"selected\"" : "") ?> href="/">DE</a>
		<span class="delimiter">|</span>
		<a <?= ($lang->get() === "en" ? "class=\"selected\"" : "") ?> href="/en">EN</a>
	</div>
	
	<div class="legal">
		<span>&copy; 2024 Kim Endisch</span>
		<span class="delimiter">|</span>
		<a href="<?= $dict->get("link_imprint") ?>" target="_blank"><?= $dict->get("text_imprint") ?> <i class="ti ti-external-link"></i></a>
		<span class="delimiter">|</span>
		<a href="<?= $dict->get("link_privacy_policy") ?>" target="_blank"><?= $dict->get("text_privacy_policy") ?> <i class="ti ti-external-link"></i></a>
	</div>
</div>
