From ff027bdb9ef73f94ddd40c03915d4a9fd0b11686 Mon Sep 17 00:00:00 2001 From: a2-imeri <Alfret2.imeri@live.uwe.ac.uk> Date: Fri, 5 Jul 2024 20:22:22 +0100 Subject: [PATCH] Configure Testing Structure --- .gitignore | 13 ++ .../__pycache__/settings.cpython-310.pyc | Bin 4219 -> 4219 bytes .../__pycache__/settings.cpython-39.pyc | Bin 3708 -> 4298 bytes .../__pycache__/urls.cpython-310.pyc | Bin 941 -> 941 bytes MisplaceAI/MisplaceAI/test_settings.py | 58 ++++++ .../__pycache__/urls.cpython-310.pyc | Bin 656 -> 656 bytes .../__pycache__/views.cpython-310.pyc | Bin 2576 -> 2744 bytes MisplaceAI/pytest.ini | 6 + MisplaceAI/requirements.txt | 2 + .../rules/__pycache__/models.cpython-310.pyc | Bin 1176 -> 1536 bytes .../rules/__pycache__/urls.cpython-310.pyc | Bin 813 -> 813 bytes .../rules/__pycache__/views.cpython-310.pyc | Bin 4677 -> 5003 bytes MisplaceAI/rules/tests/test_views.py | 28 +++ README.md | 189 ++++++++++++++++++ frontend/package-lock.json | 10 + frontend/package.json | 1 + .../detection/image/ImageUploadForm.js | 4 +- 17 files changed, 309 insertions(+), 2 deletions(-) create mode 100644 MisplaceAI/MisplaceAI/test_settings.py create mode 100644 MisplaceAI/pytest.ini create mode 100644 MisplaceAI/rules/tests/test_views.py create mode 100644 README.md diff --git a/.gitignore b/.gitignore index a13fbeb..c2160ee 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,16 @@ uploads/ MisplaceAI/rules/migrations/0001_initial.py MisplaceAI/rules/migrations/__pycache__/0001_initial.cpython-310.pyc MisplaceAI/models +MisplaceAI/rules/__pycache__/views.cpython-310.pyc +MisplaceAI/rules/__pycache__/urls.cpython-310.pyc +MisplaceAI/rules/__pycache__/urls.cpython-310.pyc +MisplaceAI/authentication/__pycache__/views.cpython-310.pyc +MisplaceAI/authentication/__pycache__/urls.cpython-310.pyc +MisplaceAI/models +MisplaceAI/rules/__pycache__/views.cpython-310.pyc +MisplaceAI/rules/__pycache__/urls.cpython-310.pyc +MisplaceAI/rules/__pycache__/models.cpython-310.pyc +MisplaceAI/MisplaceAI/__pycache__/urls.cpython-310.pyc +MisplaceAI/MisplaceAI/__pycache__/settings.cpython-310.pyc +MisplaceAI/authentication/__pycache__/views.cpython-310.pyc +MisplaceAI/authentication/__pycache__/urls.cpython-310.pyc diff --git a/MisplaceAI/MisplaceAI/__pycache__/settings.cpython-310.pyc b/MisplaceAI/MisplaceAI/__pycache__/settings.cpython-310.pyc index 02813be6beff5c02754f819d73ecadb2a17f005a..80a8377dba5af81f9aa86d64f023c5041bce6b2d 100644 GIT binary patch delta 173 zcmeyZ@LPc|pO=@5fq{WRS*Igyip)m7ON?B;nZ*S;iOH#so|D(|i!*X<W@5U*8_LJQ z$ipbW%)-XP!pFqI!p6eE!XeGX$MT<vjpaWJD+@CVGYb<7GYcaaGBdF-F)}f7FfsjS z`NQ&`MSzWkiH+$$+b<4Y4n~j++aDGVCbr4?0_v(_V7<&NY-}uSj4c0HI9QlLYNVJX Qm;{&v7}*$^{<C}s00KuF$p8QV delta 172 zcmeyZ@LPc|pO=@5fq{YHU~^mAT=9*3ml(Mfd^3v+auSnM9Wy7d<rm+~#B_r<l$V2% zhf#o;g^h)YkCBC$jfI1SL!60+<v$ZE%YPPD7A6)(7Dg6kFv-Zm%*4vX$i&FO#Ppx# z56gcR0XAkPHm3h<zc_d}7(p^@e^}U<SSRZXsH=*yFo7Wp8xtEN%Rd$l7ABAyDMkrK O0Y(8vHb$oZEWZGt&K%hQ diff --git a/MisplaceAI/MisplaceAI/__pycache__/settings.cpython-39.pyc b/MisplaceAI/MisplaceAI/__pycache__/settings.cpython-39.pyc index 31df9d414c9434dccb4753594eba6ed710b7b5d4..e354b3535587e6b0a382605f7a21074c67abab3a 100644 GIT binary patch delta 1188 zcmew(b4rmfk(ZZ?fq{WRS*Igyip)el8OBu;wWaG*7*kksSaMmTSQ!~onNr!B85giG zWXR&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zCKeVZMkYokCXWA1e^~yr2(U1-u`&H;`o+dSxk*4>QIv%V3|Uy1*cjRVv2cKB4n`(M MDMkrKK1Lx%09SdOD*ylh diff --git a/MisplaceAI/MisplaceAI/__pycache__/urls.cpython-310.pyc b/MisplaceAI/MisplaceAI/__pycache__/urls.cpython-310.pyc index 3269e3e4f24d50ce020e28131d18a731824bf4cb..cdc9cd3891b702d444c3b2e49a6e851499e9b4e3 100644 GIT binary patch delta 59 zcmZ3>zLuRYpO=@5fq{XcUArUg59>z08fIly9!4HU0Y)BH9%dd!9%c{}U={$=EKk|w JB^X)$0{}Io2?PKD delta 59 zcmZ3>zLuRYpO=@5fq{WRys9c~IrB!o8fIli9!4HU0Y)BX5DmcsAU-1xBg;27J_$ya F{{S5q2xtHR diff --git a/MisplaceAI/MisplaceAI/test_settings.py b/MisplaceAI/MisplaceAI/test_settings.py new file mode 100644 index 0000000..f1f30e9 --- /dev/null +++ b/MisplaceAI/MisplaceAI/test_settings.py @@ -0,0 +1,58 @@ +from .settings import * + +# Database configuration for testing +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'misplaceai_test', + 'USER': 'user', + 'PASSWORD': 'password', + 'HOST': 'db', + 'PORT': '3306', + } +} + +# Use a faster password hasher for tests +PASSWORD_HASHERS = [ + 'django.contrib.auth.hashers.MD5PasswordHasher', +] + +# Use in-memory file storage for faster tests +DEFAULT_FILE_STORAGE = 'inmemorystorage.InMemoryStorage' + +# Test runner configuration +TEST_RUNNER = 'django.test.runner.DiscoverRunner' + +# Disable migrations during tests +class DisableMigrations: + def __contains__(self, item): + return True + + def __getitem__(self, item): + return 'notmigrations' + +MIGRATION_MODULES = DisableMigrations() + +# Static files configuration for testing +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' + +# Media files configuration for testing +MEDIA_ROOT = os.path.join(BASE_DIR, 'test_media') + +# Additional settings for testing +DEBUG = True +TEMPLATE_DEBUG = True + +# Ensure the tests use a different cache +CACHES = { + 'default': { + 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', + } +} + +# Celery configuration for testing +CELERY_TASK_ALWAYS_EAGER = True +CELERY_TASK_EAGER_PROPAGATES = True + +# Disable Django's email backend during tests +EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend' diff --git a/MisplaceAI/authentication/__pycache__/urls.cpython-310.pyc b/MisplaceAI/authentication/__pycache__/urls.cpython-310.pyc index b79f85e6c3da732f08f20763d8d9dd4f9f58c0c9..3c67b4d1950bff467011ba05fb7a431662f62329 100644 GIT binary patch delta 43 scmbQhI)RlhpO=@5fq{YHfLuqK9Lq+&d?sO50Y(W%0agKK802^l0HodqmjD0& delta 43 scmbQhI)RlhpO=@5fq{Wx{i4>iUZ#zF`Aou$0*n%j0?Y!8Fv#%>0K4-CZvX%Q diff --git a/MisplaceAI/authentication/__pycache__/views.cpython-310.pyc b/MisplaceAI/authentication/__pycache__/views.cpython-310.pyc index 0f3a5bf6b0e6ff587ef4c85fae26f30fe63f9f50..a09863931515576a4e71ad91083391430a224427 100644 GIT binary patch delta 976 zcmbOrvO|<FpO=@5fq{Wxxm-uu6yA+|NsKXa3=9mZ3{i|J3{gxej8V*~ELp4z*cLKG zv8QrGai%Z@GiWm3;t5Jk&nzxUEegv_Ew57LQczG(05KKP@{1Hoi&Kjfiognr5=%1k z^Yp;-ewtj97c#1_-(ruCPsvZ7e3;RaO_YIwp-6Nx6O)=SKLZ0pF$V(!0|x^OBNsCV zV-e3}0ah8W&k|@3N?}T2ZefUGNnr_Q&}6;E>64$HnFq4GN)Bufh>37V4oDW_fXUTN zx7cJsHp)$oW{zQ$n!JPgXuT3h0OAf1ON@bm;TB6lesPHu$Uz`k9wr_pCMFI>4o0?r zEG%qHLX2EYOpI)d9E>dgSeV)V3b9o2!5yIo((1R8wTKsF8Xt%N`K(9)#4-U92)jTm z=^~JgMIcXt7@ygoA;802Br#clRn|tFfdS-AKF5^Y%sjX?RVt`{O$5n8LLS-2&aAVP zBp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E*#02%?3U1Xu)wM1%l@>45qG diff --git a/MisplaceAI/pytest.ini b/MisplaceAI/pytest.ini new file mode 100644 index 0000000..981b79b --- /dev/null +++ b/MisplaceAI/pytest.ini @@ -0,0 +1,6 @@ +[pytest] +DJANGO_SETTINGS_MODULE = MisplaceAI.settings +addopts = -v --ignore=MisplaceAI/models +testpaths = + rules/tests + diff --git a/MisplaceAI/requirements.txt b/MisplaceAI/requirements.txt index 1d8de2a..cf34eaa 100644 --- a/MisplaceAI/requirements.txt +++ b/MisplaceAI/requirements.txt @@ -8,3 +8,5 @@ django-cors-headers==3.10.0 djangorestframework-simplejwt==4.6.0 channels==3.0.3 moviepy==1.0.3 +pytest==6.2.5 +pytest-django==4.4.0 \ No newline at end of file diff --git a/MisplaceAI/rules/__pycache__/models.cpython-310.pyc b/MisplaceAI/rules/__pycache__/models.cpython-310.pyc index 8566a281c578922a81b247f6b54ad2de86c68f7e..0fd537f915b71b779657e8588365fccf7c0ec8d7 100644 GIT binary patch literal 1536 zcmd1j<>g{vU|`VK?nnz~V_<j;;vi!d1_lNP1_p-WAO;486owSW9EM!RC`LvQn<<AW zmpO`=k-?oIg*k<#g&~C{l`)H@nK_Epogsxag{_4lg$*jg=FX79p2E?>kir2KVNc-< zX3*q%39?O-@fKTdeoAUiu_og!meAtVqGXUTGKM+ivl;^fLn=cQV+unQQwn1gb1F*~ zYYG#{0liF7Y!GXs*i+bp88kU=aropXCzfR9=T&KNDJUo?_<}4^D9KkSN-Zc#El$lV zQAkwCfvV91D|z{!fq@}pCDSdg+{B9boYcJZl8jqyrFof!rK!n`NKOK=LD-prf#EY7 z0|P@1Ll#3YgC=8@9oQg{eZeI~nR)35+rVy7$WK!!$w*azxlIA=b%^aCO)D91vE(J@ zrh@3=)SR@H3`P753=F?S^b-pT^ovS!Qj7J$T8i}wDsQpJ#}}6r#m5VRoWaDvz`({* zB>*#84=U-mlH(Rfd_2h1`1o5~@$tF&DWy57@$t8K;^PZT6LX+4?D6p_`N{F|MIe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!REta6toYcvhEY@CrRjdjijwaJB zmdujWT!{B^Ib589fuR@_V0?^KJRogwr)%;}e#era2l8DJ*x3jI>;Y*81_qF1F(}$O k7z7vv7`YfH*Rci(AQXaGf|DPxigPmYFbXjVv5Bz(02ASD2mk;8 diff --git a/MisplaceAI/rules/__pycache__/urls.cpython-310.pyc b/MisplaceAI/rules/__pycache__/urls.cpython-310.pyc index d1e3166ef871a541d7c32752c4f3046c7b5a0f10..574d44ef42f2b32d9988a259e80738126f1e99fc 100644 GIT binary patch delta 45 scmZ3>ww8@ApO=@5fq{WRL%SpGKkG(5E@n|y2}TxH0agKK1mt)F0JuX2&;S4c delta 45 scmZ3>ww8@ApO=@5fq{XcHO4<Jhj}9(7qcjX1S1QJ0FwYC0&@HW0I}c(hyVZp diff --git a/MisplaceAI/rules/__pycache__/views.cpython-310.pyc b/MisplaceAI/rules/__pycache__/views.cpython-310.pyc index 91e3d6df835d284d3701c831bf2741222f17167a..640e602c37df9e18fdb78e344c73f3e2edbd9abe 100644 GIT binary patch delta 1844 zcmX@A(yh*y&&$ijz`(%pLaQUqUUehiTE==g1_p*yhA74qhA5^K#wg}gmUPA_))b}` z<`#x1wiK3N22IvmJfX#@MLwCuC1IJV<yD?s3JMAeAf`e|zCuoBafw1=PL4upacWVq zo`Qc~PNhO(a&l^Mab{9ZszOqwLSku2MrvM3W^!UlY6?^x*o<VR$sgFnCo?e}QxRie zU?^r|U|`^4;$aeCsuDo9QZGHV#7~ob@*5@<_FL@n@hSPqllhn}#RNc_I2afhI2c$M z*_e5liUb)L7$z@dl(heBM!;h!tSt;t>?v$1>@5sY94Q<roGlDdoGDzv44T}xgePxg z7xu1l2fGsH)7-?o#Pn2!%#zexa{MVV`400sK@|oDhR+~>3PAiRK6xX%$mI1bpG0*) zGN9<;Vd7xoU=jd@f&^Ih6l)oy!DL4^d3i$y28JRd5Wx&0SV4q1h%f;WrjzU09K|g_ z=I}5uFz_((AxwhU^P0_-(R#8WyN8)ANP`rJkOmQUAOe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ules/tests/test_views.py b/MisplaceAI/rules/tests/test_views.py new file mode 100644 index 0000000..441e11b --- /dev/null +++ b/MisplaceAI/rules/tests/test_views.py @@ -0,0 +1,28 @@ +# misplaceAI/rules/tests/test_views.py + +from rest_framework.test import APITestCase +from rest_framework import status +from django.urls import reverse +from django.contrib.auth.models import User +from rules.models import Item + +class AdminManageItemViewTest(APITestCase): + + def setUp(self): + # Create a user + self.user = User.objects.create_user(username='testuser', password='testpassword') + self.client.force_authenticate(user=self.user) + + def test_create_item(self): + """ + Ensure we can create a new item. + """ + url = reverse('rules:admin_manage_item') + data = {'name': 'New Item'} + response = self.client.post(url, data, format='json') + + # Check if the response status is 201 Created + self.assertEqual(response.status_code, status.HTTP_201_CREATED) + # Check if the item was actually created + self.assertEqual(Item.objects.count(), 1) + self.assertEqual(Item.objects.get().name, 'New Item') diff --git a/README.md b/README.md new file mode 100644 index 0000000..8d26de6 --- /dev/null +++ b/README.md @@ -0,0 +1,189 @@ +# Identification of Misplaced Items + + + + + + +testing command :docker exec -it identification-of-misplaced-items-web-1 pytest + + + + +ngrok http 8080 + + + + +docker-compose down +docker-compose up -d + +docker-compose up --build +## DATABASE + +### Connect though terminal + +```bash +docker exec -it identification-of-misplaced-items-db-1 mysql -u root -p +``` +<br> +Then enter password + +```bash +Enter password: rootpassword +``` + +<br> +Select Database: +```bash +mysql> USE misplaceai; +``` + +### Drop all tables + +Disable foreign key checks: + +``bash +SET FOREIGN_KEY_CHECKS = 0; +``` + +Generate and execute the drop script: + +```bash +SET @tables = NULL; +SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables +FROM information_schema.tables +WHERE table_schema = (SELECT DATABASE()); + +SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables); +PREPARE stmt FROM @tables; +EXECUTE stmt; +DEALLOCATE PREPARE stmt; + +``` + +Enable foreign key checks: + +```bash +SET FOREIGN_KEY_CHECKS = 1; + +``` + +Verify that all tables are dropped: + +```sql +SHOW TABLES; +``` + +exir + +```bash +mysql> EXIT; +Bye +``` + + +## +migrations +```bash +docker-compose exec web python manage.py makemigrations +docker-compose exec web python manage.py migrate +``` + +create superuser: + +``` bashhttps://wrb.uwe.ac.uk/Scientia/Portal/Login.aspx?ReturnUrl=%2fScientia%2fPortal%2fMain.aspx + +docker-compose exec web python manage.py createsuperuser +``` + + +## Getting started + +To make it easy for you to get started with GitLab, here's a list of recommended next steps. + +Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! + +## Add your files + +- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: + +``` +cd existing_repo +git remote add origin https://gitlab.uwe.ac.uk/a2-imeri/identification-of-misplaced-items.git +git branch -M main +git push -uf origin main +``` + +## Integrate with your tools + +- [ ] [Set up project integrations](https://gitlab.uwe.ac.uk/a2-imeri/identification-of-misplaced-items/-/settings/integrations) + +## Collaborate with your team + +- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) +- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) +- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) +- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) +- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) + +## Test and Deploy + +Use the built-in continuous integration in GitLab. + +- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) +- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) +- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) +- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) +- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) + +*** + +# Editing this README + +When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. + +## Suggestions for a good README + +Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. + +## Name +Choose a self-explaining name for your project. + +## Description +Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. + +## Badges +On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. + +## Visuals +Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. + +## Installation +Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. + +## Usage +Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. + +## Support +Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. + +## Roadmap +If you have ideas for releases in the future, it is a good idea to list them in the README. + +## Contributing +State if you are open to contributions and what your requirements are for accepting them. + +For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. + +You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. + +## Authors and acknowledgment +Show your appreciation to those who have contributed to the project. + +## License +For open source projects, say how it is licensed. + +## Project status +If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/frontend/package-lock.json b/frontend/package-lock.json index d244df8..37d0c11 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -17,6 +17,7 @@ "react": "^18.0.0", "react-bootstrap": "^2.10.2", "react-dom": "^18.0.0", + "react-icons": "^5.2.1", "react-router-dom": "^6.23.1", "react-scripts": "5.0.0", "web-vitals": "^1.0.1" @@ -16209,6 +16210,15 @@ "integrity": "sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==", "license": "MIT" }, + "node_modules/react-icons": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-5.2.1.tgz", + "integrity": "sha512-zdbW5GstTzXaVKvGSyTaBalt7HSfuK5ovrzlpyiWHAFXndXTdd/1hdDHI4xBM1Mn7YriT6aqESucFl9kEXzrdw==", + "license": "MIT", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", diff --git a/frontend/package.json b/frontend/package.json index 16a7394..675632a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ "react": "^18.0.0", "react-bootstrap": "^2.10.2", "react-dom": "^18.0.0", + "react-icons": "^5.2.1", "react-router-dom": "^6.23.1", "react-scripts": "5.0.0", "web-vitals": "^1.0.1" diff --git a/frontend/src/components/detection/image/ImageUploadForm.js b/frontend/src/components/detection/image/ImageUploadForm.js index 268b51f..46b7fe3 100644 --- a/frontend/src/components/detection/image/ImageUploadForm.js +++ b/frontend/src/components/detection/image/ImageUploadForm.js @@ -3,8 +3,8 @@ import React from 'react'; import 'bootstrap/dist/css/bootstrap.min.css'; import '../../../styles/main.css'; import '../../../styles/buttons/uploadButton.css'; -import UploadButton from '../../common/buttons/UploadButton'; -import TakePhotoButton from '../../common/buttons/TakePhotoButton'; +import UploadButton from '../../Common/buttons/UploadButton'; +import TakePhotoButton from '../../Common/buttons/TakePhotoButton'; const ImageUploadForm = ({ handleFileChange, handleSubmit, handleCameraClick, handleGalleryClick, isLoading }) => { -- GitLab