diff --git a/app/(home-pages)/notifications/ContributorNotification.tsx b/app/(home-pages)/notifications/ContributorNotification.tsx new file mode 100644 index 00000000..6ef38039 --- /dev/null +++ b/app/(home-pages)/notifications/ContributorNotification.tsx @@ -0,0 +1,98 @@ +import { Notification } from "./Notification"; +import { HydratedSubscribeNotification } from "src/notifications"; +import { blobRefToSrc } from "src/utils/blobRefToSrc"; +import { AppBskyActorProfile, PubLeafletPublication } from "lexicons/api"; +import { PubIcon } from "components/ActionBar/Publications"; +import { InvitedContent } from "app/lish/[did]/[publication]/invite-contributor/content"; +import { ButtonPrimary } from "components/Buttons"; +import { usePubTheme } from "components/ThemeManager/PublicationThemeProvider"; +import { AtUri } from "@atproto/api"; +import { BaseThemeProvider } from "components/ThemeManager/ThemeProvider"; + +export const ContributorNotification = ( + props: HydratedSubscribeNotification, +) => { + const profileRecord = props.subscriptionData?.identities?.bsky_profiles + ?.record as AppBskyActorProfile.Record; + const displayName = + profileRecord?.displayName || + props.subscriptionData?.identities?.bsky_profiles?.handle || + "Someone"; + const pubRecord = props.subscriptionData?.publications + ?.record as PubLeafletPublication.Record; + + return ( + // TODO: GET CORRECT TIMESTAMP + + } + actionText={ + <> + {displayName} invited you to contribute to {pubRecord?.name}! + + } + content={ + + } + /> + ); +}; + +const PubListing = (props: { + record: PubLeafletPublication.Record; + uri: string; +}) => { + let record = props.record; + let theme = usePubTheme(record); + let backgroundImage = record?.theme?.backgroundImage?.image?.ref + ? blobRefToSrc( + record?.theme?.backgroundImage?.image?.ref, + new AtUri(props.uri).host, + ) + : null; + + let backgroundImageRepeat = record?.theme?.backgroundImage?.repeat; + let backgroundImageSize = record?.theme?.backgroundImage?.width || 500; + if (!record) return null; + return ( + +
+
+ +

{record.name}

+
+ {record.description} +
+ + Accept Invite + +
+
+
+ ); +}; diff --git a/app/(home-pages)/notifications/FollowNotification.tsx b/app/(home-pages)/notifications/FollowNotification.tsx index dd8b2b74..ba3932f8 100644 --- a/app/(home-pages)/notifications/FollowNotification.tsx +++ b/app/(home-pages)/notifications/FollowNotification.tsx @@ -24,7 +24,7 @@ export const FollowNotification = (props: HydratedSubscribeNotification) => { } + icon={} actionText={ <> {displayName} subscribed to {pubRecord?.name}! diff --git a/app/(home-pages)/notifications/MentionNotification.tsx b/app/(home-pages)/notifications/MentionNotification.tsx index a50304d8..28d1249d 100644 --- a/app/(home-pages)/notifications/MentionNotification.tsx +++ b/app/(home-pages)/notifications/MentionNotification.tsx @@ -24,13 +24,10 @@ export const QuoteNotification = (props: HydratedQuoteNotification) => { content={
- +
               {postText}
             
diff --git a/app/(home-pages)/notifications/Notification.tsx b/app/(home-pages)/notifications/Notification.tsx index 2d5c2710..359ae9fb 100644 --- a/app/(home-pages)/notifications/Notification.tsx +++ b/app/(home-pages)/notifications/Notification.tsx @@ -102,7 +102,7 @@ export const CommentInNotification = (props: {
         
     );
   return (
-    
+
{notifications.map((n) => { if (n.type === "comment") { diff --git a/app/lish/[did]/[publication]/invite-contributor/content.tsx b/app/lish/[did]/[publication]/invite-contributor/content.tsx new file mode 100644 index 00000000..23a76ed5 --- /dev/null +++ b/app/lish/[did]/[publication]/invite-contributor/content.tsx @@ -0,0 +1,80 @@ +import { PubLeafletPublication } from "lexicons/api"; +import { ButtonPrimary } from "components/Buttons"; +import { PubIcon } from "components/ActionBar/Publications"; +import { SpeedyLink } from "components/SpeedyLink"; +import { BlueskyLogin } from "app/login/LoginForm"; + +export const InvitedContent = (props: { + pubRecord: PubLeafletPublication.Record; + uri: string | undefined; + href: string; +}) => { + return ( + <> +

Become a Contributor!

+ +
+ You've been invited to write for
+ {props.pubRecord.name}!{" "} +
+ Accept Invite + + ); +}; + +export const NotInvitedContent = (props: { + pubRecord: PubLeafletPublication.Record; + uri: string | undefined; + href: string; +}) => { + return ( + <> +

You haven't been invited to contribute yet...

+ + +
+ If you are expecting an invite, please check that the owner of this + publication added you to the invited contributors list. +
+ + ); +}; + +export const LoggedOutContent = (props: { + pubRecord: PubLeafletPublication.Record; + uri: string | undefined; + href: string; +}) => { + return ( + <> +

Log in to Contribute

+ +
+ Log in with an AT Proto handle to contribute this publication +
+ + + ); +}; + +const PubLink = (props: { + pubRecord: PubLeafletPublication.Record; + uri: string | undefined; + href: string; +}) => { + return ( + + +

{props.pubRecord.name}

+
{props.pubRecord.description}
+
+ ); +}; diff --git a/app/lish/[did]/[publication]/invite-contributor/page.tsx b/app/lish/[did]/[publication]/invite-contributor/page.tsx index 04557915..9904ad26 100644 --- a/app/lish/[did]/[publication]/invite-contributor/page.tsx +++ b/app/lish/[did]/[publication]/invite-contributor/page.tsx @@ -5,13 +5,10 @@ import { } from "components/ThemeManager/PublicationThemeProvider"; import { PubLeafletPublication } from "lexicons/api"; import { supabaseServerClient } from "supabase/serverClient"; -import { ButtonPrimary } from "components/Buttons"; import { PubNotFound } from "../PubNotFound"; -import { PubIcon } from "components/ActionBar/Publications"; -import { SpeedyLink } from "components/SpeedyLink"; -import { BlueskyLogin } from "app/login/LoginForm"; import { getIdentityData } from "actions/getIdentityData"; import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; +import { InvitedContent, NotInvitedContent, LoggedOutContent } from "./content"; export default async function Publication(props: { params: Promise<{ publication: string; did: string }>; @@ -71,19 +68,19 @@ export default async function Publication(props: { ) : invited ? ( ) : ( )}
@@ -92,78 +89,3 @@ export default async function Publication(props: { ); } - -const InvitedContent = (props: { - pubRecord: PubLeafletPublication.Record; - uri: string; - pubUrl: string; -}) => { - return ( - <> -

Become a Contributor!

- -
- You've been invited to write for
- {props.pubRecord.name}!{" "} -
- Accept Invite - - ); -}; - -const NotInvitedContent = (props: { - pubRecord: PubLeafletPublication.Record; - uri: string; - pubUrl: string; -}) => { - return ( - <> -

You haven't been invited to contribute yet...

- - -
- If you are expecting an invite, please check that the owner of this - publication added you to the invited contributors list. -
- - ); -}; - -const LoggedOutContent = (props: { - pubRecord: PubLeafletPublication.Record; - uri: string; - pubUrl: string; -}) => { - return ( - <> -

Log in to Contribute

- -
- Log in with an AT Proto handle to contribute this publication -
- - - ); -}; - -const PubLink = (props: { - pubRecord: PubLeafletPublication.Record; - uri: string; - pubUrl: string; -}) => { - return ( - - -

{props.pubRecord.name}

-
{props.pubRecord.description}
-
- ); -}; diff --git a/components/ActionBar/Publications.tsx b/components/ActionBar/Publications.tsx index a16f8aee..8f2a87a8 100644 --- a/components/ActionBar/Publications.tsx +++ b/components/ActionBar/Publications.tsx @@ -157,7 +157,7 @@ const PublishPopoverContent = () => { export const PubIcon = (props: { record: PubLeafletPublication.Record; - uri: string; + uri: string | undefined; small?: boolean; large?: boolean; className?: string; @@ -166,7 +166,7 @@ export const PubIcon = (props: { let iconSizeClassName = `${props.small ? "w-4 h-4" : props.large ? "w-12 h-12" : "w-6 h-6"} rounded-full`; - return props.record.icon ? ( + return props.record.icon && props.uri ? (
diff --git a/components/Avatar.tsx b/components/Avatar.tsx index bc9bb6a3..7e68ecbd 100644 --- a/components/Avatar.tsx +++ b/components/Avatar.tsx @@ -3,12 +3,12 @@ import { AccountTiny } from "./Icons/AccountTiny"; export const Avatar = (props: { src: string | undefined; displayName: string | undefined; - tiny?: boolean; + small?: boolean; }) => { if (props.src) return ( { - +
); };