Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

Commit 9eddec5

Browse files
flaviomoceriMiguelMedeiros
authored andcommitted
fix: show tags to the search input header (#262)
* fix: show tags to inputSearch * fix: login using enter * fix: change body color * fix: change ml to post line
1 parent 3cb9297 commit 9eddec5

File tree

10 files changed

+70
-48
lines changed

10 files changed

+70
-48
lines changed

apps/web/app/global.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@
55
@tailwind utilities;
66

77
body {
8-
background-color: #0a0a10;
9-
background-image: linear-gradient(to right, #0a0a10, #0e0e18);
8+
background-color: #020203;
109
}

apps/web/app/hot-tags/page.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,8 @@ import Skeletons from '../../components/Skeletons';
2020

2121
export default function Index() {
2222
const router = useRouter();
23-
const {
24-
pubky,
25-
getHotTags,
26-
setSearchTags,
27-
searchTags,
28-
listFollowers,
29-
listFollowing,
30-
} = useClientContext();
23+
const { pubky, getHotTags, listFollowers, listFollowing } =
24+
useClientContext();
3125
const { hotTagsReach } = useFilterContext();
3226
const [hotTags, setHotTags] = useState<ITaggedPost[]>([]);
3327
const [loadingReachTags, setLoadingReachTags] = useState(false);
@@ -119,7 +113,8 @@ export default function Index() {
119113
// eslint-disable-next-line react-hooks/exhaustive-deps
120114
}, [hotTagsReach]);
121115

122-
const handleTagSearch = (tag: string) => {
116+
{
117+
/** const handleTagSearch = (tag: string) => {
123118
if (searchTags.includes(tag)) return;
124119
125120
if (searchTags.length < 3) {
@@ -130,6 +125,8 @@ export default function Index() {
130125
}
131126
router.push('/search');
132127
};
128+
*/
129+
}
133130

134131
return (
135132
<Content.Main>
@@ -138,7 +135,7 @@ export default function Index() {
138135
<div className="w-full flex-col inline-flex gap-3">
139136
<div className="flex gap-6 mb-6">
140137
<DropDown.HotTagsReach type="text" subtitle="Reach" />
141-
<DropDown.TagsTimeframe disabled type="text" subtitle="Timeframe" />
138+
{/**<DropDown.TagsTimeframe disabled type="text" subtitle="Timeframe" />*/}
142139
</div>
143140
{loading ? (
144141
<div className="w-full">
@@ -153,9 +150,11 @@ export default function Index() {
153150
<HotTags.Rank
154151
rank={index + 1}
155152
tag={tag.tag}
156-
onClick={() => handleTagSearch(tag.tag)}
153+
onClick={() => router.push(`/search?tags=${tag.tag}`)}
157154
color="fuchsia"
158-
counter={`${tag.count}`}
155+
counter={`${tag.count} ${
156+
tag.count > 1 ? ' users' : ' user'
157+
}`}
159158
/>
160159
{tag?.from.slice(0, 5).map((fromItem, fromIndex: number) => (
161160
<Image

apps/web/app/onboarding/sign-up/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ export default function Index() {
302302
</Button.Transparent>
303303
</div>
304304
</Card.Primary>
305-
<Card.Primary className="justify-start" title="Picture">
305+
<Card.Primary className="justify-start z-10" title="Picture">
306306
{image && (
307307
<div className="relative">
308308
<Image

apps/web/app/settings/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ export default function Index() {
403403
</Button.Transparent>
404404
</div>
405405
</Card.Primary>
406-
<Card.Primary className="justify-start" title="Picture">
406+
<Card.Primary className="justify-start z-10" title="Picture">
407407
{image && (
408408
<div className="relative">
409409
<Image

apps/web/app/sign-in/page.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ export default function Index() {
108108
}
109109
};
110110

111+
const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {
112+
if (event.key === 'Enter') {
113+
handleSubmit();
114+
}
115+
};
116+
111117
useEffect(() => {
112118
async function fetchData() {
113119
const loggedIn = await isLoggedIn();
@@ -169,6 +175,7 @@ export default function Index() {
169175
error={errors.password}
170176
placeholder="••••••••••••"
171177
id="onboarding-password-input"
178+
onKeyDown={handleKeyDown}
172179
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
173180
setPassword(e.target.value)
174181
}

apps/web/components/Modal/_SearchInputCard.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useRouter } from 'next/navigation';
2-
import { Card, Icon, PostUtil, Typography } from '@social/ui-shared';
2+
import { Card, PostUtil, Typography } from '@social/ui-shared';
33
import { useEffect, useState } from 'react';
44
import { twMerge } from 'tailwind-merge';
55
import { useClientContext } from '../../contexts/client';
@@ -14,7 +14,7 @@ export default function SearchInputCard({
1414
...rest
1515
}: SearchInputCardProps) {
1616
const router = useRouter();
17-
const { hotTags, searchTags, setSearchTags } = useClientContext();
17+
const { hotTags } = useClientContext();
1818
const [loading, setLoading] = useState(true);
1919

2020
useEffect(() => {
@@ -23,7 +23,8 @@ export default function SearchInputCard({
2323
}
2424
}, [hotTags]);
2525

26-
const handleTagSearch = (tag: string) => {
26+
{
27+
/** const handleTagSearch = (tag: string) => {
2728
if (searchTags.includes(tag)) return;
2829
2930
if (searchTags.length < 3) {
@@ -33,13 +34,16 @@ export default function SearchInputCard({
3334
setSearchTags(newSearchTags);
3435
}
3536
router.push('/search');
36-
};
37+
};*/
38+
}
3739

38-
const handleRemoveTag = (indexToRemove: number) => {
40+
{
41+
/** const handleRemoveTag = (indexToRemove: number) => {
3942
const newTags = [...searchTags];
4043
newTags.splice(indexToRemove, 1);
4144
setSearchTags(newTags);
42-
};
45+
};*/
46+
}
4347

4448
return (
4549
<Card.Primary
@@ -49,7 +53,7 @@ export default function SearchInputCard({
4953
background="bg-gradient-to-t from-[#07040a] to-[#1b1820]"
5054
>
5155
<div className="flex-col gap-6 inline-flex">
52-
{searchTags.length > 0 && (
56+
{/**{searchTags.length > 0 && (
5357
<div>
5458
<Typography.Label className="text-opacity-30">
5559
Searched tags
@@ -73,7 +77,7 @@ export default function SearchInputCard({
7377
))}
7478
</div>
7579
</div>
76-
)}
80+
)}*/}
7781
<div>
7882
<Typography.Label className="text-opacity-30">
7983
Hot tags
@@ -88,7 +92,7 @@ export default function SearchInputCard({
8892
<PostUtil.Tag
8993
key={index}
9094
clicked={false}
91-
onClick={() => handleTagSearch(tag.tag)}
95+
onClick={() => router.push(`/search?tags=${tag.tag}`)}
9296
color="fuchsia"
9397
className="mr-2 my-1"
9498
>

apps/web/components/Post/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export default function Post({
4545
const { setContent, setShow } = useAlertContext();
4646
const [showTooltipProfile, setShowTooltipProfile] = useState('');
4747
const router = useRouter();
48-
const lineBaseCSS = 'absolute ml-[16px] border-l-2 h-full border-neutral-800';
48+
const lineBaseCSS =
49+
'absolute ml-[15.5px] border-l-2 h-full border-neutral-800';
4950

5051
const handleDeletePost = async () => {
5152
const result = await deletePost(post?.id);

apps/web/components/_Header.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ export default function Header({ title, className }: HeaderProps) {
111111
// }
112112
};
113113

114+
const handleRemoveTag = (indexToRemove: number) => {
115+
const newTags = [...searchTags];
116+
newTags.splice(indexToRemove, 1);
117+
setSearchTags(newTags);
118+
};
119+
114120
return (
115121
<HeaderUI.Root>
116122
<HeaderUI.Logo link={logoLink} />
@@ -122,31 +128,38 @@ export default function Header({ title, className }: HeaderProps) {
122128
}
123129
onKeyDown={handleKeyDown}
124130
>
125-
{/**{searchTags && (
131+
{searchTags && (
126132
<Input.SearchTags className="hidden sm:block">
127133
{searchTags.map((searchTag, index) => (
128134
<Input.SearchTag
129-
color="bg-amber-500 bg-opacity-30"
130135
key={index}
131136
onClick={() => handleRemoveTag(index)}
132-
actions={[<Icon.X key={index} />]}
137+
action={
138+
<div className="mt-[3px]">
139+
<Icon.X key={index} />
140+
</div>
141+
}
133142
value={`${searchTag}`}
134143
className="mr-2"
135144
/>
136145
))}
137146
</Input.SearchTags>
138-
)}*/}
147+
)}
139148
<Input.SearchInput
140149
placeholder="Search"
141150
className="hidden sm:block"
142151
onClick={() => setSearchInputCard(true)}
152+
disabled={!!searchTags.length}
143153
/>
144154
<Modal.SearchInputCard
145155
className={searchInputCard ? 'hidden xl:block' : 'hidden'}
146156
refCard={refSearchInputCard}
147157
/>
148158
<Input.SearchActions className="hidden sm:flex">
149-
<div className="cursor-pointer" onClick={handleSearchTag}>
159+
<div
160+
className={inputValue && 'cursor-pointer'}
161+
onClick={inputValue ? handleSearchTag : undefined}
162+
>
150163
<Icon.MagnifyingGlass />
151164
</div>
152165
</Input.SearchActions>

apps/web/components/_HotTags.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Skeletons from './Skeletons';
1111

1212
export default function HotTags() {
1313
const router = useRouter();
14-
const { getHotTags, setSearchTags, searchTags } = useClientContext();
14+
const { getHotTags } = useClientContext();
1515
const [hotTags, setHotTags] = useState<ITaggedPost[] | null>(null);
1616
const [loading, setLoading] = useState(true);
1717

@@ -33,7 +33,8 @@ export default function HotTags() {
3333
// eslint-disable-next-line react-hooks/exhaustive-deps
3434
}, []);
3535

36-
const handleTagSearch = (tag: string) => {
36+
{
37+
/** const handleTagSearch = (tag: string) => {
3738
if (searchTags.includes(tag)) return;
3839
3940
if (searchTags.length < 3) {
@@ -44,6 +45,8 @@ export default function HotTags() {
4445
}
4546
router.push('/search');
4647
};
48+
*/
49+
}
4750

4851
return (
4952
<div className="self-start sticky top-[120px] col-span-1">
@@ -59,7 +62,7 @@ export default function HotTags() {
5962
{hotTags.slice(0, 8).map((tag, index) => (
6063
<SideCard.Rank
6164
key={index}
62-
onClick={() => handleTagSearch(tag.tag)}
65+
onClick={() => router.push(`/search?tags=${tag.tag}`)}
6366
rank={index + 1}
6467
tag={Utils.minifyText(tag.tag, 15)}
6568
color="fuchsia"

libs/ui-shared/src/lib/Input/Input.Search/_SearchTag.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,20 @@ import React from 'react';
44

55
interface SearchTagProps extends React.HTMLAttributes<HTMLDivElement> {
66
value: string;
7-
color: string;
8-
actions: React.ReactNode[];
7+
action?: React.ReactNode;
98
}
109

11-
export const SearchTag = ({
12-
value,
13-
color = 'bg-black',
14-
actions,
15-
...rest
16-
}: SearchTagProps) => {
17-
const baseCSS = `cursor-pointer items-center px-2 py-1 backdrop-blur-lg justify-start gap-1 inline-flex rounded-lg`;
10+
export const SearchTag = ({ value, action, ...rest }: SearchTagProps) => {
11+
const baseCSS = `inline-flex border h-8 px-3 py-1 rounded-full cursor-pointer text-center bg-[#391941] border-fuchsia-500 border-opacity-60 rounded-full`;
1812

1913
return (
20-
<div {...rest} className={twMerge(baseCSS, color, rest.className)}>
21-
<Typography.Body variant="small-bold">{value}</Typography.Body>
22-
{actions.map((action, index) => (
23-
<div key={index}>{action}</div>
24-
))}
14+
<div {...rest} className={twMerge(baseCSS, rest.className)}>
15+
<div className="flex gap-2">
16+
<Typography.Body className="text-fuchsia-200" variant="small-bold">
17+
{value}
18+
</Typography.Body>
19+
{action}
20+
</div>
2521
</div>
2622
);
2723
};

0 commit comments

Comments
 (0)