diff --git a/src/shared/components/instances.tsx b/src/shared/components/instances.tsx
index ad6ce7f..84dde12 100644
--- a/src/shared/components/instances.tsx
+++ b/src/shared/components/instances.tsx
@@ -93,78 +93,101 @@ const InstanceCardGrid = ({ instances }: InstanceCardGridProps) => (
);
-interface InstanceCardProps {
- instance: any;
-}
-
function buildUrl(domain: string): string {
return `https://${domain}`;
}
-const InstanceCard = ({ instance }: InstanceCardProps) => {
- const domain = instance.domain;
- const description = instance.site_info.site_view.site.description;
- const sidebar = instance.site_info.site_view.site.sidebar || description;
- const icon =
- instance.site_info.site_view.site.icon || "/static/assets/images/lemmy.svg";
- const banner = instance.site_info.site_view.site.banner;
- const users = instance.site_info.site_view.counts.users;
- const comments = instance.site_info.site_view.counts.comments;
- const monthlyUsers = instance.site_info.site_view.counts.users_active_month;
- const registrationMode =
- instance.site_info.site_view.local_site.registration_mode;
+interface InstanceCardProps {
+ instance: any;
+}
- const modalId = `modal_${domain}`;
+interface InstanceCardState {
+ showModal: boolean;
+}
- return (
-
-
-
-
-
-
-
-
- {domain}
-
-
{description}
-
+class InstanceCard extends Component
{
+ state: InstanceCardState = {
+ showModal: false,
+ };
+
+ constructor(props: any, context: any) {
+ super(props, context);
+ }
+
+ render() {
+ const instance = this.props.instance;
+
+ const domain = instance.domain;
+ const description = instance.site_info.site_view.site.description;
+ const sidebar = instance.site_info.site_view.site.sidebar || description;
+ const icon =
+ instance.site_info.site_view.site.icon ||
+ "/static/assets/images/lemmy.svg";
+ const banner = instance.site_info.site_view.site.banner;
+ const users = instance.site_info.site_view.counts.users;
+ const comments = instance.site_info.site_view.counts.comments;
+ const monthlyUsers = instance.site_info.site_view.counts.users_active_month;
+ const registrationMode =
+ instance.site_info.site_view.local_site.registration_mode;
+
+ const modalId = `modal_${domain}`;
+
+ return (
+
+
+
+ {this.state.showModal && (
+
+ )}
+
+
+
- {i18n.t("sign_up")}
+ {domain}
-
+
{description}
+
-
- );
-};
+ );
+ }
+}
+
+function handleModalClick(i: InstanceCard) {
+ const modalId = `modal_${i.props.instance.domain}`;
+ i.setState({ showModal: !i.state.showModal });
+ (document.getElementById(modalId) as any).showModal();
+}
const imgError =
"this.onError=null;this.src='/static/assets/images/lemmy.svg';" as unknown as InfernoEventHandler
;