Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mertbagt committed Dec 31, 2024
1 parent 5c66723 commit 6dde9af
Showing 1 changed file with 3 additions and 29 deletions.
32 changes: 3 additions & 29 deletions components/ProfilePage/ProfileButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import { useTranslation } from "next-i18next"
import React, { useContext, useState } from "react"
import React, { useContext } from "react"
import styled from "styled-components"
import { useAuth } from "../auth"
import { FillButton, GearIcon, OutlineButton } from "../buttons"
import { Button } from "../bootstrap"
import { Role } from "components/auth/types"
import { FillButton, GearButton, ToggleButton } from "components/buttons"
import { useProfile, ProfileHook } from "components/db"
import { useFlags } from "components/featureFlags"
import { Internal } from "components/links"
import { FollowUserButton } from "components/shared/FollowButton"
import { TabContext } from "components/shared/ProfileTabsContext"

import { GearIcon, OutlineButton } from "../buttons"

export const StyledButton = styled(Button).attrs(props => ({
className: `col-12 d-flex align-items-center justify-content-center py-3 text-nowrap`,
size: "lg"
Expand Down Expand Up @@ -74,33 +68,13 @@ export const EditProfileButton = ({
}

export function ProfileButtons({
isProfilePublic,
onProfilePublicityChanged,
onSettingsModalOpen,
isUser,
profileId
isUser
}: {
isProfilePublic: boolean | undefined
onProfilePublicityChanged: (isPublic: boolean) => void
onSettingsModalOpen: () => void
isUser: boolean
profileId: string
}) {
const { t } = useTranslation("editProfile")
const { user } = useAuth()

const actions = useProfile()

const handleSave = async () => {
await updateProfile({ actions })
}
/* Only regular users are allowed to have a private profile. */
async function updateProfile({ actions }: { actions: ProfileHook }) {
const { updateIsPublic } = actions

await updateIsPublic(!isProfilePublic)
onProfilePublicityChanged(!isProfilePublic)
}

const { tabStatus, setTabStatus } = useContext(TabContext)

Expand Down

0 comments on commit 6dde9af

Please sign in to comment.