-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oleksandr Holub
committed
Dec 1, 2023
1 parent
34ad0c4
commit 9bd0960
Showing
22 changed files
with
260 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ts/ActionButtons/LikeLinkActionButton.tsx → ...em/ActionButtons/LikeLinkActionButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...ts/ActionButtons/SaveLinkActionButton.tsx → ...em/ActionButtons/SaveLinkActionButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...reens/AddLink/components/AddTagButton.tsx → .../components/LinkListItem/AddTagButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mponents/Contents/YoutubeVideoContent.tsx → ...ListItem/Contents/YoutubeVideoContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
client/src/components/LinkListItem/LinkListItemActionPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import LikeLinkActionButton from './ActionButtons/LikeLinkActionButton.tsx'; | ||
import SaveLinkActionButton from './ActionButtons/SaveLinkActionButton.tsx'; | ||
import DeleteLinkActionButton from './ActionButtons/DeleteLinkActionButton.tsx'; | ||
import Link from '../../models/Link.ts'; | ||
import Button from '../Button.tsx'; | ||
|
||
type LinkListItemActionPanelProps = { | ||
disabled?: boolean; | ||
onEditClick: () => void; | ||
onCancelClick: () => void; | ||
onApplyClick: () => void; | ||
link: Link; | ||
updating: boolean; | ||
}; | ||
|
||
const LinkListItemActionPanel = ({ link, disabled, updating, onApplyClick, onCancelClick, onEditClick}: LinkListItemActionPanelProps) => { | ||
return ( | ||
<div className="flex flex-row justify-between secondary-text-color"> | ||
<div className="flex flex-row gap-4"> | ||
<LikeLinkActionButton {...link} /> | ||
<SaveLinkActionButton {...link} /> | ||
</div> | ||
{ !updating && link.editable && ( | ||
<div className="flex flex-row gap-4"> | ||
<Button type="button" onClick={onEditClick} className="bg-transparent"> | ||
<svg className="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 18"> | ||
<path d="M12.687 14.408a3.01 3.01 0 0 1-1.533.821l-3.566.713a3 3 0 0 1-3.53-3.53l.713-3.566a3.01 3.01 0 0 1 .821-1.533L10.905 2H2.167A2.169 2.169 0 0 0 0 4.167v11.666A2.169 2.169 0 0 0 2.167 18h11.666A2.169 2.169 0 0 0 16 15.833V11.1l-3.313 3.308Zm5.53-9.065.546-.546a2.518 2.518 0 0 0 0-3.56 2.576 2.576 0 0 0-3.559 0l-.547.547 3.56 3.56Z"/> | ||
<path d="M13.243 3.2 7.359 9.081a.5.5 0 0 0-.136.256L6.51 12.9a.5.5 0 0 0 .59.59l3.566-.713a.5.5 0 0 0 .255-.136L16.8 6.757 13.243 3.2Z"/> | ||
</svg> | ||
</Button> | ||
<DeleteLinkActionButton {...link} /> | ||
</div> | ||
)} | ||
{ updating && ( | ||
<div className="flex flex-row gap-4"> | ||
<Button disabled={disabled} type="button" onClick={onCancelClick} className="bg-transparent"> | ||
<svg className="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"> | ||
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 11.793a1 1 0 1 1-1.414 1.414L10 11.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L8.586 10 6.293 7.707a1 1 0 0 1 1.414-1.414L10 8.586l2.293-2.293a1 1 0 0 1 1.414 1.414L11.414 10l2.293 2.293Z"/> | ||
</svg> | ||
</Button> | ||
<Button disabled={disabled} type="button" onClick={onApplyClick} className="bg-transparent"> | ||
<svg className="w-4 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"> | ||
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z"/> | ||
</svg> | ||
</Button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default LinkListItemActionPanel; |
2 changes: 1 addition & 1 deletion
2
...istItem/components/LinkListItemAuthor.tsx → ...nents/LinkListItem/LinkListItemAuthor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...stItem/components/LinkListItemContent.tsx → ...ents/LinkListItem/LinkListItemContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {useStore} from '../../contexts/AppContext.tsx'; | ||
import LinkStore from '../../stores/LinkStore.ts'; | ||
import {observer} from 'mobx-react-lite'; | ||
import TagBadge from '../TagBadge.tsx'; | ||
import {MaxTags} from '../../constants/preferences.ts'; | ||
import AddTagButton from './AddTagButton.tsx'; | ||
|
||
type LinkListItemTagsProps = { | ||
tags: string[]; | ||
editable?: boolean; | ||
error?: string; | ||
onAdd?: (tag: string) => void; | ||
onRemove?: (tag: string) => void; | ||
}; | ||
|
||
const LinkListItemTags = observer(({ tags, editable, error, onAdd, onRemove }: LinkListItemTagsProps) => { | ||
const { toggleTagFilter } = useStore<LinkStore>(LinkStore); | ||
const handleOnClick = (tag: string) => { | ||
if (!editable) { | ||
toggleTagFilter(tag); | ||
} else if (onRemove) { | ||
onRemove(tag); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<div className="flex flex-wrap gap-2 items-center"> | ||
{tags.map((tag) => ( | ||
<TagBadge key={tag} onClick={() => handleOnClick(tag)} name={tag} removable={editable} active /> | ||
))} | ||
{ editable && tags.length < MaxTags && <AddTagButton onAdd={(tag) => onAdd && onAdd(tag)} />} | ||
</div> | ||
{ editable && error && (<span className="text-red-500 text-sm">{error}</span>) } | ||
</> | ||
); | ||
}); | ||
|
||
export default LinkListItemTags; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { ChangeEvent, useState } from 'react'; | ||
import {MaxTitleLength} from '../../constants/preferences.ts'; | ||
|
||
type LinkListItemTitleProps = { | ||
editable?: boolean; | ||
title: string; | ||
onUpdate?: (title: string) => void; | ||
error?: string; | ||
}; | ||
|
||
const LinkListItemTitle = ({ title, onUpdate, editable, error }: LinkListItemTitleProps) => { | ||
const [value, setValue] = useState(title); | ||
|
||
const handleInputChange = (event: ChangeEvent<HTMLInputElement>) => { | ||
setValue(event.target.value); | ||
}; | ||
|
||
const handleEditEnd = () => { | ||
if (value !== title && onUpdate) { | ||
onUpdate(value); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
{ editable && ( | ||
<input type="text" | ||
value={value} | ||
onChange={handleInputChange} | ||
onBlur={handleEditEnd} | ||
placeholder="Set title" | ||
className="p-2 group secondary-text-color dark-border w-full bg-zinc-900 focus:outline-none font-medium rounded-lg text-sm" | ||
/> | ||
)} | ||
{ !editable && ( | ||
<h5 | ||
className="text-lg font-semibold secondary-text-color" | ||
> | ||
{ value.length > MaxTitleLength ? `${value.slice(0, MaxTitleLength)}` : value } | ||
</h5> | ||
)} | ||
{ error && (<span className="text-red-500 text-sm">{error}</span>) } | ||
</> | ||
); | ||
} | ||
|
||
export default LinkListItemTitle; |
10 changes: 5 additions & 5 deletions
10
client/src/components/TagSearchInput.tsx → ...omponents/LinkListItem/TagSearchInput.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
client/src/components/LinkListItem/components/LinkListItemActionButtons.tsx
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
client/src/components/LinkListItem/components/LinkListItemTags.tsx
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
client/src/components/LinkListItem/components/LinkListItemTitle.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
client/src/components/LinkListToolbar/components/TagSearch.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.