From 57e75ace7401fca31ee7b0ba4c875b384e1d60c2 Mon Sep 17 00:00:00 2001
From: Tianyi LIANG <tianyi@igem.org>
Date: Fri, 17 May 2024 16:27:35 +0800
Subject: [PATCH] refactor: new attribution form

---
 .env                                     | 2 ++
 src/components/AttributionForm/index.tsx | 6 +++---
 src/vite-env.d.ts                        | 1 +
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.env b/.env
index 9563167..5b162e1 100644
--- a/.env
+++ b/.env
@@ -1,3 +1,5 @@
+# Team ID
+VITE_TEAM_ID=TeamID
 # Team name
 VITE_TEAM_NAME=TeamName
 # Team year
diff --git a/src/components/AttributionForm/index.tsx b/src/components/AttributionForm/index.tsx
index 4f358aa..7d1f8c6 100644
--- a/src/components/AttributionForm/index.tsx
+++ b/src/components/AttributionForm/index.tsx
@@ -1,9 +1,9 @@
 function AttributionForm() {
-  const team_name = import.meta.env.VITE_TEAM_NAME;
+  const team_id = import.meta.env.VITE_TEAM_ID;
 
   // Listen to size change and update form height
   window.addEventListener("message", function (e) {
-    if (e.origin === "https://attributions.igem.org") {
+    if (e.origin === "https://teams.igem.org") {
       const { type, data } = JSON.parse(e.data);
       if (type === "igem-attribution-form") {
         const element = document.getElementById("igem-attribution-form");
@@ -19,7 +19,7 @@ function AttributionForm() {
       <iframe
         style={{ width: "100%" }}
         id="igem-attribution-form"
-        src={`https://attributions.igem.org?team=${team_name}&year=2024`}
+        src={`https://teams.igem.org/${team_id}/attributions`}
       />
     </>
   );
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts
index 95c2059..ac92440 100644
--- a/src/vite-env.d.ts
+++ b/src/vite-env.d.ts
@@ -1,6 +1,7 @@
 /// <reference types="vite/client" />
 
 interface ImportMetaEnv {
+  readonly VITE_TEAM_ID: string;
   readonly VITE_TEAM_NAME: string;
   readonly VITE_TEAM_YEAR: string;
 }
-- 
GitLab