From 10c33ef3446cc8cc46a0495e3b0d169992d59b74 Mon Sep 17 00:00:00 2001
From: Piotr Gawron <p.gawron@atcomp.pl>
Date: Thu, 26 Sep 2024 09:50:16 +0200
Subject: [PATCH] project source link was invalid

---
 CHANGELOG                                                   | 1 +
 .../ProjectInfoDrawer/ProjectInfoDrawer.component.test.tsx  | 2 +-
 .../ProjectInfoDrawer/ProjectInfoDrawer.component.tsx       | 6 +++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 68490d8a..700455fa 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,5 @@
 minerva-front (18.0.0~beta.3) stable; urgency=medium
+  * Bugfix: link to download project source was invalid
   * Bugfix: change background to empty after overlay is loaded so there is no
     blank background (#285)
   * Bugfix: license info styling (#280)
diff --git a/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.test.tsx b/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.test.tsx
index ef21f2dc..1c24ab14 100644
--- a/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.test.tsx
+++ b/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.test.tsx
@@ -98,7 +98,7 @@ describe('ProjectInfoDrawer', () => {
     expect(downloadButton).toBeInTheDocument();
     expect(downloadButton).toHaveAttribute(
       'href',
-      'localhost/projects/pdmap_appu_test:downloadSource',
+      'https://lux1.atcomp.pl/minerva/api/projects/pdmap_appu_test:downloadSource',
     );
     expect(downloadButton).toHaveAttribute('download', 'sourceFile.txt');
   });
diff --git a/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.tsx b/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.tsx
index b19e5bdf..80c6cd35 100644
--- a/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.tsx
+++ b/src/components/Map/Drawer/ProjectInfoDrawer/ProjectInfoDrawer.component.tsx
@@ -16,6 +16,7 @@ import { DrawerHeading } from '@/shared/DrawerHeading';
 import { LinkButton } from '@/shared/LinkButton';
 import { useEffect } from 'react';
 import './ProjectInfoDrawer.styles.css';
+import { BASE_API_URL } from '@/constants';
 
 export const ProjectInfoDrawer = (): JSX.Element => {
   const dispatch = useAppDispatch();
@@ -28,7 +29,10 @@ export const ProjectInfoDrawer = (): JSX.Element => {
   const version = useAppSelector(versionSelector);
   const description = useAppSelector(mainMapModelDescriptionSelector);
 
-  const sourceDownloadLink = window.location.hostname + apiPath.getSourceFile();
+  const sourceDownloadLink = BASE_API_URL + apiPath.getSourceFile();
+
+  // eslint-disable-next-line no-console
+  console.log(sourceDownloadLink);
 
   let licenseName: string = '';
   if (project) {
-- 
GitLab