mirror of
https://github.com/BillyOutlast/posthog.com.git
synced 2026-02-04 03:11:21 +01:00
* remove org providers * merge questions components * merge authentication components * merge question form components * move main login * move Squeak.tsx * merge question * update exports * split out replies component * begin rewriting question component * add the ability to fetch by permalink * move gatsby-source-squeak to ts * working questions table * working question permalink pages! * add images to questions table * basic login working * working topics pages * move topiGroup fetching * working topic groups * working login state * remove unused apiHost and organizationId params * fix useUser hook * small tweaks * rename Question.permalink to SqueakQuestion.permalink * remove reply resolver * remove useOrg hook * add back old CommunityQuestions components * update roadmap queries * fetch roadmaps * remove console.log * small tweaks * remove key * add squeak migration script * only fetch questions that match the current slug * unify useQuestions hook * fix build * change markdown component * search: removing padding * working reply! * expand question by default * replace username with email * working sign up * working question sidebar + remove pre-rendered question pages * add back pre-rendered question component pages * uncomment Changelog query * display multiple teams * remove updatedAt field * don't access avatar if it's null * fix question profile links * only add replies with profiles * fail when no question * fixes * remove ErrorBoundary from QuestionForm * remove old changelog page * delete ErrorBoundary component * working question posting * gravatar urls * working profiles * use questions component * reset password * display profile info in dropdown * post question to specific page * remove excess padding on replies * remove changelog from dropdown * make registering and signing in work * avatar fixes * login / registration error messages * more avatar fixes * update slugs in queries * fail on non-ok request to `/me` * add edit profiles * set all user roles to authenticated * upload avatars * use getAvatarURL * only show edit profile button on active user * fix question pages * working subscribe and unsubscribe endpoints * refactor useUser logic separate out logic to fetch and save the current user * working subscriptions * chore: remove misc console logs * use fetchUser in EditProfile * ensure all questions have profiles * add more misc to migration sql * use useRoadmap hook in Roadmap * working team roadmaps * show login when trying to subscribe as anon * fix profile TODO * add sortBy newest, popular, and activity * add back homepage roadmap * remove unused Changelog component * bring back reply actions * fix collapsed avatars * fix badge text * small ui improvements * mobile edit profile * add teams to profile sidebar * also show questions that user has replied to * hide discussions if no questions exist * reduce required reply count to show collapsed view * fix: return correct user from login and signUp methods * remove unused lib/api * add body to form preview * button labels on questionform * question page modal initial view * fix blur bug * try not passing slug on questions page * dark mode colors * dark mode fix * error messages * correct type of slugs object * more onBlur fixes * add logged in user email and add edit profile button back * remove log --------- Co-authored-by: Eli Kinsey <eli@ekinsey.dev> Co-authored-by: Cory Watilo <cww@watilo.com>
75 lines
3.4 KiB
TypeScript
75 lines
3.4 KiB
TypeScript
import SidebarSection from 'components/PostLayout/SidebarSection'
|
|
import React from 'react'
|
|
import Link from 'components/Link'
|
|
import { QuestionData, StrapiRecord } from 'lib/strapi'
|
|
import { useUser } from 'hooks/useUser'
|
|
|
|
type QuestionSidebarProps = {
|
|
question: StrapiRecord<QuestionData> | undefined
|
|
}
|
|
|
|
export const QuestionSidebar = (props: QuestionSidebarProps) => {
|
|
const { user } = useUser()
|
|
|
|
const { id, attributes: question } = props.question || {}
|
|
|
|
return question ? (
|
|
<div>
|
|
<SidebarSection title="Posted by">
|
|
<div className="flex items-center space-x-2">
|
|
{question.profile?.data?.attributes?.avatar?.data?.attributes?.url ? (
|
|
<img
|
|
className="w-8 h-8 rounded-full"
|
|
src={question.profile.data.attributes.avatar.data.attributes.url}
|
|
/>
|
|
) : (
|
|
<svg
|
|
className="w-8 h-8 rounded-full bg-gray-accent-light"
|
|
fill="none"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 40 40"
|
|
>
|
|
<path d="M0 0h40v40H0z"></path>
|
|
<path
|
|
fillRule="evenodd"
|
|
clipRule="evenodd"
|
|
d="M21.19 6.57c-5.384-.696-9.938 3.89-9.93 10.343.013.1.026.229.042.378.045.443.11 1.067.262 1.67.883 3.445 2.781 6.077 6.305 7.132 3.117.938 5.86.04 8.14-2.242 3.008-3.016 3.805-8.039 1.891-12.047-1.36-2.844-3.484-4.82-6.71-5.234ZM2.5 40c-.64-1.852 1.119-6.454 2.947-7.61 2.48-1.563 5.076-2.942 7.671-4.32.48-.255.96-.51 1.438-.766.313-.164.899.008 1.29.188 2.827 1.242 5.624 1.25 8.468.03.492-.21 1.242-.241 1.695-.015 2.688 1.367 5.352 2.774 7.961 4.281 2.352 1.36 4.35 6.056 3.53 8.212h-35Z"
|
|
fill="#fff"
|
|
></path>
|
|
</svg>
|
|
)}
|
|
<Link to={`/community/profiles/${question.profile?.data?.id}`}>
|
|
{question.profile?.data?.attributes?.firstName
|
|
? `${question.profile?.data?.attributes?.firstName} ${question.profile?.data?.attributes?.lastName}`
|
|
: 'Anonymous'}
|
|
</Link>
|
|
</div>
|
|
</SidebarSection>
|
|
|
|
{question?.topics?.data && question.topics.data.length > 0 && (
|
|
<SidebarSection title="Topics">
|
|
<div className="flex items-center space-x-2">
|
|
{question.topics.data.map((topic) => (
|
|
<Link key={topic.id} to={`/questions/topics/${topic.attributes.slug}`}>
|
|
{topic.attributes.label}
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</SidebarSection>
|
|
)}
|
|
|
|
{user?.isModerator && (
|
|
<SidebarSection>
|
|
<Link
|
|
to={`https://squeak.posthog.cc/admin/content-manager/collectionType/api::question.question/${id}`}
|
|
>
|
|
View in Squeak!
|
|
</Link>
|
|
</SidebarSection>
|
|
)}
|
|
</div>
|
|
) : null
|
|
}
|
|
|
|
export default QuestionSidebar
|