pib-viewer 0.9.2

A viewer for public governmental data served over OParl
// SPDX-FileCopyrightText: Politik im Blick developers
// SPDX-FileCopyrightText: Wolfgang Silbermayr <wolfgang@silbermayr.at>
//
// SPDX-License-Identifier: AGPL-3.0-or-later OR EUPL-1.2

use dioxus::prelude::{Props, component, dioxus_elements, rsx};
use dioxus_core::Element;
use dioxus_i18n::t;
use dioxus_router::Link;
use oparl_types::Organization;

use crate::route::{Route, UrlEncoded};

#[derive(Debug, Clone, PartialEq, Props)]
pub struct OrganizationProps {
    organization: Organization,
}

#[component]
pub fn Organization(props: OrganizationProps) -> Element {
    rsx! {
            Link {
                to: Route::Organization { organization_url: UrlEncoded::from(props.organization.id) },
                span {
                    class: "infobox",
                    span {
                        class: "label",
                        if let Some(name) = props.organization.name {
                            "{name}"
                        } else {
                            i { { t!("unknown-name") } }
                        }
                    }
                }
            }
    }
}