Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redirect to domain on click #425

Merged
merged 3 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 7 additions & 29 deletions src/components/general/Icon/ArrowRightTopIcon.tsx
enesozturk marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,13 @@ import React from 'react'

const ArrowRightTopIcon: React.FC<React.SVGProps<SVGSVGElement>> = props => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="17"
viewBox="0 0 16 17"
fill="none"
{...props}
>
<g clipPath="url(#clip0_4498_48131)">
<path
d="M11.3012 5.19971L4.70117 11.7997"
stroke="currentColor"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M6 5.19922L11.2993 5.19932V10.5"
stroke="currentColor"
strokeWidth="1.25"
strokeLinecap="round"
strokeLinejoin="round"
/>
</g>
<defs>
<clipPath id="clip0_4498_48131">
<rect width="16" height="16" fill="white" transform="translate(0 0.5)" />
</clipPath>
</defs>
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M2.67029 2.14284C2.67029 1.74835 2.99009 1.42856 3.38457 1.42856H7.85648C8.25097 1.42856 8.57077 1.74835 8.57077 2.14284V6.61475C8.57077 7.00924 8.25097 7.32904 7.85648 7.32904C7.462 7.32904 7.1422 7.00924 7.1422 6.61475V3.86796L2.64795 8.36221C2.36901 8.64115 1.91674 8.64115 1.6378 8.36221C1.35885 8.08326 1.35885 7.631 1.6378 7.35205L6.13272 2.85713H3.38457C2.99009 2.85713 2.67029 2.53733 2.67029 2.14284Z"
fill="currentColor"
/>
</svg>
)
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/notifications/AppExplorer/AppCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const AppCard: React.FC<AppCardProps> = ({
const { activeSubscriptions } = useContext(W3iContext)

const host = new URL(url).host
const projectURL = new URL(url)

useEffect(() => {
// If the account changes, the subscribing flow has broken.
Expand All @@ -49,8 +50,6 @@ const AppCard: React.FC<AppCardProps> = ({
const subscribed =
userPubkey &&
activeSubscriptions.some(element => {
const projectURL = new URL(url)

return projectURL.hostname === element.metadata.appDomain
})
const logoURL = logo || '/fallback.svg'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
color: var(--accent-color-1);
display: none;
align-items: center;
gap: 0.125rem;

span {
color: var(--accent-color-1);
Expand All @@ -214,7 +215,7 @@
color: var(--fg-color-1);
display: flex;
align-items: center;
gap: 2px;
gap: 0.125rem;

&__external-link-icon {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,22 @@
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
&__description {
&__link {
color: var(--fg-color-2);

text-decoration: none;
display: flex;
align-items: center;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
gap: 0.125rem;

svg {
display: inline-block;
}

&:hover {
color: var(--fg-color-2);
filter: brightness(0.9);
}
}
}
&__actions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useContext, useState } from 'react'

import { Link } from 'react-router-dom'

import BackButton from '@/components/general/BackButton'
import Button from '@/components/general/Button'
import ArrowRightTopIcon from '@/components/general/Icon/ArrowRightTopIcon'
import Text from '@/components/general/Text'
import W3iContext from '@/contexts/W3iContext/context'
import { noop } from '@/utils/general'
Expand All @@ -17,6 +20,7 @@ interface IAppNotificationsHeaderProps {
name: string
domain: string
}

const AppNotificationsHeader: React.FC<IAppNotificationsHeaderProps> = ({
domain,
logo,
Expand All @@ -25,7 +29,7 @@ const AppNotificationsHeader: React.FC<IAppNotificationsHeaderProps> = ({
}) => {
const isMobile = useIsMobile()
const { dappOrigin } = useContext(W3iContext)
const [dropdownToShow, setDropdownToShow] = useState<string | undefined>()
const url = new URL('https://' + domain)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not happy with this. We don't have full URL of the dApp in the metadata from Notify Client.

@devceline Do you think we could do this better? Maybe like matching, the dApp with projects and finding the project object, and getting the URL? Both looking overengineering but we cannot update the Notify Client for this too.

Copy link
Contributor Author

@enesozturk enesozturk Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move the projects to a Context. We can get the project list in the AppCard and find the project and use the URL from the project object. That would be a better approach. I wouldn't want to ship this. I'll take a look later

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we huddle, don't fully understand this here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay let's go with this way since we are already sure that the domain wouldn't be empty as we check. I'd still like to have url from the backend instead of creating it on the UI


return (
<div className="AppNotificationsHeader">
Expand Down Expand Up @@ -53,14 +57,21 @@ const AppNotificationsHeader: React.FC<IAppNotificationsHeaderProps> = ({
/>
<div className="AppNotificationsHeader__app__name_container">
<h2 className="AppNotificationsHeader__app__name">{name}</h2>
<Text variant="link-500" className="AppNotificationsHeader__app__description">
{domain}
</Text>
<Link
to={url.href}
className="AppNotificationsHeader__app__link"
target="_blank"
rel="noopener noreferrer"
>
<Text variant="link-500">{domain}</Text>
<div>
<ArrowRightTopIcon />
</div>
</Link>
</div>
</div>
<div className="AppNotificationsHeader__wrapper">
<AppNotificationDropdown
closeDropdown={() => setDropdownToShow(undefined)}
h="2.5em"
w="2.5em"
notificationId={id}
Expand Down
Loading