Skip to content

Commit

Permalink
fix: Role edit fixes, link parsing fixes, role title in feed added
Browse files Browse the repository at this point in the history
  • Loading branch information
faisalamin9696 committed May 9, 2024
1 parent 8180269 commit 17938c8
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/app/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function Providers(props: Props) {
serialize: data => compress(JSON.stringify(data)),
deserialize: data => JSON.parse(decompress(data)),
}),
maxAge: Infinity,
maxAge: 1000 * 60 * 60 * 24 * 1 // 1 day,
});


Expand Down
8 changes: 6 additions & 2 deletions src/components/EditRoleModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ export default function EditRoleModal(props: Props) {

}

const handleRoleSelectionChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
setRole(e.target.value as any);
};

const isPending = roleMutation.isPending || titleMutation.isPending || roleTitleMutation.isPending;
return (
<Modal isOpen={props.isOpen ?? isOpen}
Expand Down Expand Up @@ -174,10 +178,10 @@ export default function EditRoleModal(props: Props) {
className="max-w-xs"
defaultSelectedKeys={[role]}
disabledKeys={[comment.author_role]}
onSelectionChange={(key) => setRole(key as any)}
onChange={handleRoleSelectionChange}
classNames={{ base: 'items-center' }}
>
{(item) => <SelectItem key={item?.value}>{item.item}</SelectItem>}
{(item) => <SelectItem key={item.value} value={item.value}>{item.item}</SelectItem>}
</Select>}
</div>

Expand Down
6 changes: 3 additions & 3 deletions src/components/NotificationsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,7 @@ export default function NotificationsModal(props: Props) {

if (hasSearchFilter) {
filteredNotifications = filteredNotifications.filter((notification) =>
notification.account.toLowerCase().includes(filterValue.toLowerCase()) ||
notification.author.toLowerCase().includes(filterValue.toLowerCase()),
notification.account.toLowerCase().includes(filterValue.toLowerCase())
);
}
if (statusFilter !== "all" && Array.from(statusFilter).length !== typeOptions.length) {
Expand Down Expand Up @@ -298,7 +297,7 @@ export default function NotificationsModal(props: Props) {
/>
<div className="flex gap-3">
<Dropdown >
<DropdownTrigger className="hidden sm:flex">
<DropdownTrigger className="">
<Button size="sm" variant="flat" isIconOnly>
<IoMdSettings className='text-lg' />
</Button>
Expand Down Expand Up @@ -462,6 +461,7 @@ export default function NotificationsModal(props: Props) {

return (
<TableRow

onClick={() => {
router.push(getTargetUrl(item));
router.refresh();
Expand Down
2 changes: 1 addition & 1 deletion src/components/YoutubePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function YoutubePreview(props: Props): React.ReactElement {
width = 640,
height = 360,
startTime = 0,
dataParams = 'enablejsapi=0&rel=0&origin=https://steemit.com',
dataParams = 'enablejsapi=0&rel=0&origin=https://steempro.com',
} = props;
const [play, setPlay] = useState(true);

Expand Down
3 changes: 2 additions & 1 deletion src/components/body/ParsedBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export function ParsedBody({ body, isNsfw }: { body: string, isNsfw?: boolean })
<Link
className=''
{...domNode?.attribs}
href={domNode.attribs.href?.replace('steemit.com', 'steempro.com')}
>
{domToReact(domNode.children)}
</Link>
Expand All @@ -58,7 +59,7 @@ export function ParsedBody({ body, isNsfw }: { body: string, isNsfw?: boolean })
</table>;
}



}

Expand Down
2 changes: 1 addition & 1 deletion src/components/body/SanitizeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export default ({
href = href.trim();
const attys: any = { href };
// If it's not a (relative or absolute) steemit URL...
if (!href.match(/^(\/(?!\/)|https:\/\/steemit.com)/)) {
if (!href.match(/^(\/(?!\/)|https:\/\/steempro.com)/)) {
// attys.target = '_blank' // pending iframe impl https://mathiasbynens.github.io/rel-noopener/
attys.rel = highQualityPost ? 'noopener' : 'nofollow noopener';
attys.title = getExternalLinkWarningMessage();
Expand Down
2 changes: 1 addition & 1 deletion src/components/comment/components/CommentHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export default memo(function CommentHeader(props: Props) {
</div>}
description={<div className='flex flex-col'>

{isDetail && <RoleTitleCard comment={comment} />}
<RoleTitleCard comment={comment} />

<div className={clsx(`flex items-center gap-1`,)}>
<TimeAgoWrapper lang={settings.lang.code} created={comment.created * 1000} lastUpdate={comment.last_update * 1000} />
Expand Down
3 changes: 3 additions & 0 deletions src/components/comment/layouts/CommentGridLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import Link from 'next/link';
import { hasNsfwTag } from '@/libs/utils/StateFunctions';
import NsfwOverlay from '@/components/NsfwOverlay';
import { getSettings } from '@/libs/utils/user';
import RoleTitleCard from '@/components/RoleTitleCard';


export default function CommentGridLayout(props: CommentProps) {
Expand Down Expand Up @@ -108,6 +109,8 @@ export default function CommentGridLayout(props: CommentProps) {

</div>}
description={<div className='flex flex-col'>
<RoleTitleCard comment={comment} />

<TimeAgoWrapper lang={'en'} created={commentInfo.created * 1000} lastUpdate={commentInfo.last_update * 1000} />

</div>}
Expand Down
1 change: 0 additions & 1 deletion src/libs/utils/Links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export default {

export const OLD_DOMAINS_LIST = [
'busy.org',
'steemit.com',
'esteem.app',
'steempeak.com',
'partiko.app',
Expand Down
5 changes: 5 additions & 0 deletions src/libs/utils/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ export function saveCredentials(username: string,
const existAuth = getUserAuth() as User;
if (!existAuth || current || (existAuth?.username === username)) {
addToCurrent(username, encryptedKey, keyType);

if (username !== existAuth.username) {
removeSessionToken(existAuth.username);
}
}

addToAccounts(username, encryptedKey, keyType);
return {
username: username,
Expand Down

0 comments on commit 17938c8

Please sign in to comment.