Skip to content

Commit

Permalink
Merge pull request #415 from bounswe/feature/FE-32
Browse files Browse the repository at this point in the history
Feature/FE-32
  • Loading branch information
kostanya authored Dec 27, 2022
2 parents c04720f + 2391aa9 commit f935f8e
Show file tree
Hide file tree
Showing 21 changed files with 631 additions and 165 deletions.
6 changes: 4 additions & 2 deletions App/backend/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .views.follow import follow_user, unfollow_user, get_my_followers, get_my_followings, get_followers, get_followings
from .views.comments import CommentView, CommentsView
from .views.tags import TagView, TagsView
from .views.search import LexSearchView, LexSearchUserView
from .views.search import LexSearchView, LexSearchUserView, search_offline_exhibitions_lexical, search_virtual_exhibitions_lexical
from .views.user import users_api
from .views.exhibition import get_exhibitions, get_my_exhibitions, create_offline_exhibition, create_online_exhibition, get_online_exhibitions_by_id, get_offline_exhibitions_by_id, get_offline_exhibitions_by_userid, get_online_exhibitions_by_userid
from .views.like import like_artitem, unlike_artitem, get_liked_artitems_of_user, get_users_who_liked_artitem, like_comment, unlike_comment, get_users_who_liked_comment
Expand Down Expand Up @@ -110,7 +110,9 @@
path('artitems/bids/<int:id>/', BidView, name="BidView"),
path('artitems/tags/', artitems_by_tags, name="get_artitems_by_tags"),
path('search/lexical/', LexSearchView.as_view(), name='LexicalSearch'),
path('search/lexical/users/', LexSearchUserView.as_view(), name='LexicalSearchUser')
path('search/lexical/users/', LexSearchUserView.as_view(), name='LexicalSearchUser'),
path('search/lexical/exhibitions/offline/', search_offline_exhibitions_lexical.as_view(), name="search_offline_exhibitions"),
path('search/lexical/exhibitions/online/', search_virtual_exhibitions_lexical.as_view(), name="search_virtual_exhibitions")
]

# added to give us the option to choose between default Response template and regular json
Expand Down
1 change: 1 addition & 0 deletions App/backend/api/views/recommendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def RecommendArtItemView(request):

artitems = []

# exclude(virtualExhibition__isnull = False)
firstcategory = ArtItem.objects.filter(category = category1).exclude(virtualExhibition__isnull = False)
for item in firstcategory:
histories = History.objects.filter(user=user, is_art=True, art_id=item.id)
Expand Down
140 changes: 138 additions & 2 deletions App/backend/api/views/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

from ..models.artitem import ArtItem
from ..models.user import User
from ..models.exhibition import OfflineExhibition
from ..models.exhibition import VirtualExhibition
from ..serializers.serializers import ArtItemSerializer, SimpleUserSerializer
from ..serializers.exhibition import OfflineExhibitionSerializer, VirtualExhibitionSerializer

from drf_yasg.utils import swagger_auto_schema
from django.contrib.auth.models import AnonymousUser
Expand Down Expand Up @@ -51,7 +54,7 @@
)
class LexSearchView(ListAPIView):
queryset = ArtItem.objects.all()
queryset = ArtItem.objects.all().exclude(virtualExhibition__isnull = False)
serializer_class = ArtItemSerializer
filter_backends = (SearchFilter, OrderingFilter)
search_fields = ('title', 'description', 'owner__name', 'owner__surname', 'tags__tagname')
Expand Down Expand Up @@ -87,4 +90,137 @@ class LexSearchUserView(ListAPIView):
queryset = User.objects.all()
serializer_class = SimpleUserSerializer
filter_backends = (SearchFilter, OrderingFilter)
search_fields = ('username', 'name', 'surname')
search_fields = ('username', 'name', 'surname')


@swagger_auto_schema(
# method='get',
operation_description= "Searchs for offline exhibitions by their titles and descriptions.",
operation_summary="Get all the offline exhibitions according to their titles and descriptions.",
tags=['search'],
responses={
status.HTTP_200_OK: openapi.Response(
description="Successfully retrieved all the offline exhibitions according to the search params.",
examples={
"application/json": [
{
"owner":
[
{
"id": 1,
"owner": {
"id": 1,
"username": "denemes",
"name": "",
"surname": "",
"profile_path": "avatar/default.png"
},
"title": "My Offline Exhibition",
"description": "Art exhibition at street 123.",
"poster": {
"id": 1,
"owner": 1,
"title": "My Offline Exhibition",
"description": "Art exhibition at street 123.",
"category": "PT",
"tags": [],
"artitem_path": "artitem/artitem-1.png",
"created_at": "08-12-2022 23:31:44"
},
"collaborators": [],
"start_date": "08-12-2022 16:00:00",
"end_date": "10-12-2020 16:00:00",
"created_at": "08-12-2022 23:31:44",
"updated_at": "08-12-2022 23:31:44",
"city": "İstanbul",
"country": "Türkiye",
"address": "Beyoglu",
"latitude": 41.40338,
"longitude": 28.97835,
"status": "Ongoing"
}
],
"collaborator": []
}
]
}
)
}
)

class search_offline_exhibitions_lexical(ListAPIView):
queryset = OfflineExhibition.objects.all()
serializer_class = OfflineExhibitionSerializer
filter_backends = (SearchFilter, OrderingFilter)
search_fields = ('title', 'description')


@swagger_auto_schema(
# method='get',
operation_description= "Searchs for virtual exhibitions by their titles and descriptions.",
operation_summary="Get all the virtual exhibitions according to their titles and descriptions.",
tags=['search'],
responses={
status.HTTP_200_OK: openapi.Response(
description="Successfully retrieved all the virtual exhibitions according to the search params.",
examples={
"application/json": [
{
"owner":
[
{
"id": 1,
"owner": {
"id": 1,
"username": "denemes",
"name": "",
"surname": "",
"profile_path": "avatar/default.png"
},
"title": "My Offline Exhibition",
"description": "Art exhibition at street 123.",
"poster": {
"id": 4,
"owner": 1,
"title": "My Offline Exhibition",
"description": "Art exhibition at street 123.",
"category": "PT",
"tags": [],
"artitem_path": "artitem/artitem-4.png",
"created_at": "08-12-2022 23:32:34"
},
"collaborators": [],
"artitems_gallery": [
{
"id": 3,
"owner": 1,
"title": "Portrait of Joel Miller",
"description": "Joel Miller from TLOU universe.",
"category": "OT",
"tags": [],
"artitem_path": "artitem/artitem-3.png",
"created_at": "08-12-2022 23:32:18"
}
],
"start_date": "08-12-2022 16:00:00",
"end_date": "10-12-2020 16:00:00",
"created_at": "08-12-2022 23:32:34",
"updated_at": "08-12-2022 23:32:34",
"status": "Ongoing"
}
],
"collaborator": []
}
]
}
)
}
)

class search_virtual_exhibitions_lexical(ListAPIView):
queryset = VirtualExhibition.objects.all()
serializer_class = VirtualExhibitionSerializer
filter_backends = (SearchFilter, OrderingFilter)
search_fields = ('title', 'description')
4 changes: 3 additions & 1 deletion App/frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import RecommendedUsers from "./pages/RecommendedPages/RecommendedUsers";
import ArtItem from "./pages/ArtItem";
import Settings from "./pages/Settings";
import SearchResults from "./pages/SearchResults";
import SearchResultsTag from "./pages/SearchResultsTag";
import Exhibition from "./pages/Exhibition";

function App() {
Expand Down Expand Up @@ -85,7 +86,8 @@ function App() {
element={<Exhibition />}
></Route>

<Route path="/artitems/tag/:tag_id" element={<SearchResults />} />
<Route path="/search/:input" element={<SearchResults />} />
<Route path="/artitems/tag/:tag_id" element={<SearchResultsTag />} />
</Routes>
</AuthProvider>
);
Expand Down
75 changes: 61 additions & 14 deletions App/frontend/src/components/HomeGalleryCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,70 +25,117 @@ function HomeGalleryCard(props) {
return (
<>
<div className="gallery-container">
<div className="gallery-header">Discover Exhibitions</div>
<div style= {{color: "white", cursor: "pointer"}} onClick={() => navigate(`/users/${1}`)}>TEST PROFILE</div>
<div className="gallery-header">Featured Art Items</div>
<div className="gallery-row">
<HomeImageCard
onClick={() => goToArtItem(1)}
onClick={
{
/*() => goToArtItem(1)*/
}
}
source={lost}
name="Lost Highway"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={buddhists}
name="Four Noble Truths"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={haybales}
name="Agriculture in the Netherlands"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={wheat}
name="Fauvism"
/>
</div>
<div className="gallery-row">
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={greenFace}
name="To Pimp a Butterfly"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={greenFood}
name="Green Life"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={greenCadillac}
name="1957 Cadillac Eldorado Biarritz "
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={angel}
name="Forgotten Statues"
/>
</div>
<div className="gallery-row">
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={cyber}
name="One Night in Shangai"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={bluebuilding}
name="Architecture in Movies"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={rome}
name="Rome: A History of the Eternal City"
/>
<HomeImageCard
onClick={{/*() => goToArtItem(13)*/}}
onClick={
{
/*() => goToArtItem(13)*/
}
}
source={beach}
name="West Coast"
/>
Expand Down
9 changes: 7 additions & 2 deletions App/frontend/src/components/LoginModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,15 @@ function Login(props) {
</button>
</div>
<p className="forgot-password text-center mt-3">
<Link onClick={props.onClickResPass}>Forgot password?</Link>
<Link onClick={props.onClickResPass} className="access-link">
Forgot password?
</Link>
</p>
<p className="text-center mt-2">
Not on Artopia yet? <Link onClick={props.onClickSignUp}>Sign up</Link>
Not on Artopia yet?{" "}
<Link onClick={props.onClickSignUp} className="access-link">
Sign up
</Link>
</p>
</div>
</form>
Expand Down
Loading

0 comments on commit f935f8e

Please sign in to comment.