Skip to content

Commit 85aad49

Browse files
brrkrmnNdibe Raymond Olisaemeka
and
Ndibe Raymond Olisaemeka
authored
improve search for non-logged-in users (#1087)
* style page and add login card * fix misaligned login form in search results * change styles for creator search * implement no results found design * make results one row * made some major refactors Issue: #802 Signed-off-by: Ndibe Raymond Olisaemeka <[email protected]> Co-authored-by: Ndibe Raymond Olisaemeka <[email protected]>
1 parent ac3f8cd commit 85aad49

File tree

18 files changed

+1320
-1118
lines changed

18 files changed

+1320
-1118
lines changed

zubhub_backend/zubhub/creators/utils.py

+218-137
Large diffs are not rendered by default.

zubhub_backend/zubhub/projects/utils.py

+3
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@ def perform_project_search(
478478
if can_view(user, project):
479479
result.append(project)
480480

481+
if not user.is_authenticated:
482+
result = result[:4]
483+
481484
return result
482485

483486

zubhub_backend/zubhub/projects/views.py

+2
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ def get_queryset(self):
218218
.filter(search_vector=query)
219219
.order_by("-rank")
220220
)
221+
if not self.request.user.is_authenticated:
222+
tags = tags[:4]
221223
return tags
222224

223225

zubhub_frontend/zubhub/public/locales/en/translation.json

+21-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030
"createActivity": "CREATE ACTIVITY",
3131
"createActivityMenu": "Create Activity",
3232
"unpublishedActivities": "Unpublished Activities",
33-
"myActivities": "My Activities"
33+
"myActivities": "My Activities",
34+
"searchType": {
35+
"projects": "Projects",
36+
"creators": "Creators",
37+
"tags": "Tags"
38+
}
3439
},
3540
"sidebar":{
3641
"logout": "Logout",
@@ -258,7 +263,7 @@
258263
},
259264

260265
"projects": {
261-
"1":"Explore, ",
266+
"1":"Explore,",
262267
"2": "Create, Share!",
263268
"shareProject": "Share your work",
264269
"exploreIdeas": "Explore Ideas",
@@ -480,7 +485,16 @@
480485
},
481486
"errors": {
482487
"unexpected": "Uh oh! Seems like we hit a snag :( Maybe try again later?",
483-
"noResult": "We could not find anything for your search term! Maybe try to search something else?"
488+
"noResult": "We could not find anything for your search term! Maybe try to search something else?",
489+
"noResult2": "Sorry, but we couldn't find any results for",
490+
"noResultDescription": "Try searching for something else or browse our suggestions!"
491+
},
492+
"loginCard": {
493+
"title": {
494+
"projects": "Log in or sign up to search for projects",
495+
"creators": "Log in or sign up to search for users",
496+
"tags": "Log in or sign up to search for projects with specific tags"
497+
}
484498
}
485499
},
486500

@@ -567,7 +581,7 @@
567581
},
568582
"deleteProjectToastSuccess": "Your project was deleted successfully!",
569583
"socialShare": {
570-
"fbwa": "Check out this project on ZubHub! ",
584+
"fbwa": "Check out this project on ZubHub!",
571585
"copySuccess": "Link successfully copied to clipboard!",
572586
"copyFail": "Hmmm... something went wrong trying to copy that link :("
573587
},
@@ -649,7 +663,7 @@
649663
},
650664
"activityLog": {
651665
"activity": "Activity Log",
652-
"addActivityLog": "Seems like there isn't any activity on your account yet! Get involved to see activity logs!"
666+
"addActivityLog": "Seems like there isn't any activity on your account yet! Get involved to see activity logs!"
653667
},
654668
"team": "Team",
655669
"createteam": "Create Team",
@@ -1021,7 +1035,7 @@
10211035
},
10221036
"errors": {
10231037
"max": "your creation step shouldn't be more than 1000 characters",
1024-
"required": "describe creation process in at least one step ",
1038+
"required": "describe creation process in at least one step",
10251039
"emptyStep": "step can't be empty provide either a description or an image"
10261040
}
10271041
},
@@ -1191,4 +1205,4 @@
11911205
"buttonLabel": "Get Started"
11921206
}
11931207
}
1194-
}
1208+
}

zubhub_frontend/zubhub/public/locales/hi/translation.json

+21-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@
3030
"createActivity": "गतिविधि बनाएं",
3131
"createActivityMenu": "गतिविधि बनाएं",
3232
"unpublishedActivities": "अप्रकाशित गतिविधियाँ",
33-
"myActivities": "मेरी गतिविधियां"
33+
"myActivities": "मेरी गतिविधियां",
34+
"searchType": {
35+
"projects": "परियोजनाओं",
36+
"creators": "रचनाकारों",
37+
"tags": "टैग"
38+
}
3439
},
3540

3641
"footer": {
@@ -244,7 +249,7 @@
244249
},
245250

246251
"projects": {
247-
"1":"खोजें, ",
252+
"1":"खोजें,",
248253
"2":"बनाएं, शेयर करें!",
249254
"shareProject": "एक परियोजना साझा करें",
250255
"exploreIdeas": "विचारों का अन्वेषण करें",
@@ -427,7 +432,16 @@
427432
},
428433
"errors": {
429434
"unexpected": "यह क्रिया करते समय एक त्रुटि हुई। बाद में पुन: प्रयास करें",
430-
"noResult": "आपके खोज शब्द के लिए कोई परिणाम नहीं मिला"
435+
"noResult": "आपके खोज शब्द के लिए कोई परिणाम नहीं मिला",
436+
"noResult2": "क्षम्यतां, परन्तु वयं तस्य किमपि परिणामं न प्राप्नुमः",
437+
"noResultDescription": "अन्यत् किमपि अन्वेष्टुं प्रयतध्वम् अथवा अस्माकं सुझावः ब्राउज् कुर्वन्तु!"
438+
},
439+
"loginCard": {
440+
"title": {
441+
"projects": "परियोजनानि अन्वेष्टुं प्रवेशं कुर्वन्तु अथवा पञ्जीकरणं कुर्वन्तु",
442+
"creators": "उपयोक्तृणां अन्वेषणार्थं प्रवेशं कुर्वन्तु अथवा पञ्जीकरणं कुर्वन्तु",
443+
"tags": "विशिष्टटैग्युक्तानि परियोजनानि अन्वेष्टुं प्रवेशं कुर्वन्तु अथवा पञ्जीकरणं कुर्वन्तु"
444+
}
431445
}
432446
},
433447

@@ -513,7 +527,7 @@
513527
},
514528
"deleteProjectToastSuccess": "आपका प्रोजेक्ट सफलतापूर्वक हटा दिया गया था !!",
515529
"socialShare": {
516-
"fbwa": "ZubHub पर इस प्रोजेक्ट को देखें! ",
530+
"fbwa": "ZubHub पर इस प्रोजेक्ट को देखें!",
517531
"copySuccess": "लिंक सफलतापूर्वक कॉपी किया गया!",
518532
"copyFail": "उस लिंक को कॉपी करने का प्रयास करते समय कुछ गलत हुआ... :("
519533
},
@@ -559,7 +573,7 @@
559573
"label": "यूज़रनेम",
560574
"errors": {
561575
"required": "ऐसा लगता है कि आप यह भूल गये"
562-
}
576+
}
563577
},
564578
"password": {
565579
"label": "पासवर्ड",
@@ -595,7 +609,7 @@
595609
},
596610
"activityLog": {
597611
"activity": "गतिविधि लॉग",
598-
"addActivityLog": "ऐसा लगता है कि आपके खाते पर अभी तक कोई गतिविधि नहीं है! गतिविधि लॉग देखने के लिए शामिल हों!"
612+
"addActivityLog": "ऐसा लगता है कि आपके खाते पर अभी तक कोई गतिविधि नहीं है! गतिविधि लॉग देखने के लिए शामिल हों!"
599613
},
600614
"badge": {
601615
"badges": "बैज",
@@ -825,7 +839,7 @@
825839
}
826840
},
827841
"actions": {
828-
"submit": "परिवर्तनों को सुरक्षित करें",
842+
"submit": "परिवर्तनों को सुरक्षित करें"
829843
},
830844
"delete": {
831845
"label": "टीम हटाएं",

zubhub_frontend/zubhub/src/assets/js/styles/views/search_results/searchResultsStyles.js

+135-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const styles = theme => ({
1+
export const styles = theme => ({
22
root: {
33
marginTop: '2em',
44
marginBottom: '2em',
@@ -21,11 +21,41 @@ const styles = theme => ({
2121
maxWidth: '1190px',
2222
width: '100%',
2323
},
24-
24+
mainContainerLoggedOutStyle: {
25+
background: 'white',
26+
padding: '0 3em',
27+
marginTop: '3em',
28+
borderRadius: '15px',
29+
[theme.breakpoints.down('1080')]: {
30+
padding: '0 1em',
31+
},
32+
[theme.breakpoints.down('500')]: {
33+
padding: 0,
34+
},
35+
},
2536
pageHeaderStyle: {
37+
margin: '1em 0',
2638
fontWeight: 'bold',
2739
textAlign: 'center',
2840
},
41+
creatorsContainerStyle: {
42+
width: '100%',
43+
display: 'flex',
44+
gap: '1em',
45+
},
46+
creatorsContainerLoggedOutStyle: {
47+
justifyContent: 'center',
48+
},
49+
projectsContainerStyle: {
50+
margin: 0,
51+
},
52+
loggedOutResultsContainer: {
53+
width: '100%',
54+
display: 'flex',
55+
justifyContent: 'center',
56+
maxHeight: '400px',
57+
overflow: 'hidden',
58+
},
2959
cardStyle: {
3060
display: 'flex',
3161
flexDirection: 'column',
@@ -39,6 +69,10 @@ const styles = theme => ({
3969
textAlign: 'left',
4070
backgroundColor: '#ffffff',
4171
},
72+
cardLoggedOutStyle: {
73+
marginBottom: '9em',
74+
boxShadow: 'none',
75+
},
4276
avatarStyle: {
4377
width: '100%',
4478
height: '100%',
@@ -65,6 +99,10 @@ const styles = theme => ({
6599
maxWidth: '2000px',
66100
width: '100%',
67101
},
102+
buttonGroupLoggedOut: {
103+
// background: 'white'
104+
display: 'none',
105+
},
68106
floatRight: {
69107
float: 'right',
70108
},
@@ -93,6 +131,100 @@ const styles = theme => ({
93131
fontWeight: '900',
94132
fontSize: '1.5rem',
95133
},
134+
transitionStyle: {
135+
height: '20em',
136+
marginTop: '-20em',
137+
background: 'linear-gradient(0deg, rgba(255,255,255,80%) 34%, rgba(255,255,255,0) 100%)',
138+
position: 'relative',
139+
zIndex: 1060,
140+
},
141+
loginCardStyle: {
142+
background: 'white',
143+
marginTop: '-2em',
144+
},
145+
notFoundRobotStyle: {
146+
width: '20em',
147+
marginTop: '3em',
148+
[theme.breakpoints.down('600')]: {
149+
width: '15em',
150+
},
151+
[theme.breakpoints.down('400')]: {
152+
width: '12em',
153+
},
154+
},
155+
noResultContainerStyle: {
156+
display: 'flex',
157+
flexDirection: 'column',
158+
justifyContent: 'center',
159+
alignItems: 'center',
160+
},
161+
noResultTitleStyle: {
162+
width: '70%',
163+
padding: '0 1em',
164+
[theme.breakpoints.down('600')]: {
165+
width: '100%',
166+
fontSize: '1.5rem',
167+
},
168+
},
169+
noResultDescStyle: {
170+
padding: '0 1em',
171+
fontSize: '1.2rem',
172+
textAlign: 'center',
173+
marginBottom: '3em',
174+
[theme.breakpoints.down('600')]: {
175+
fontSize: '1rem',
176+
},
177+
},
178+
marginBottom: {
179+
marginBottom: '4em',
180+
zIndex: 10,
181+
},
96182
});
97183

98-
export default styles;
184+
export const loginStyleOverrides = theme => ({
185+
rootStyle: {
186+
paddingTop: 0,
187+
},
188+
containerStyle: {
189+
[theme.breakpoints.down('400')]: {
190+
padding: 0,
191+
},
192+
},
193+
cardStyle: {
194+
boxShadow: 'none',
195+
[theme.breakpoints.down('500')]: {
196+
padding: 0,
197+
},
198+
},
199+
titleStyle: {
200+
textAlign: 'center',
201+
margin: 0,
202+
},
203+
descriptionStyle: {
204+
display: 'none',
205+
},
206+
gridStyle: {
207+
margin: 0,
208+
},
209+
});
210+
211+
export const staffPickStyleOverrides = theme => ({
212+
rootStyle: {
213+
margin: 0,
214+
width: '80%',
215+
[theme.breakpoints.down('400')]: {
216+
width: '100%',
217+
},
218+
},
219+
mainContainerStyle: {
220+
margin: 0,
221+
},
222+
messagePrimaryStyle: {
223+
margin: 0,
224+
fontSize: '1.8rem',
225+
fontWeight: 700,
226+
[theme.breakpoints.down('600')]: {
227+
fontSize: '1.5rem',
228+
},
229+
},
230+
});

0 commit comments

Comments
 (0)