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

ENG-3866 fix(portal): allow users to remove profile image #824

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions apps/portal/app/components/edit-profile/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,16 @@ export function EditProfileForm({
// Handle Initial Form Submit
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
logger('previewImage in handleSubmit', previewImage)
try {
dispatch({ type: 'START_TRANSACTION' })
setLoading(true)
const formData = new FormData()
formData.append('display_name', displayName)
formData.append('description', description)
formData.append('image_url', previewImage || userObject.image || '')
if (previewImage !== null) {
formData.append('image_url', previewImage)
}

// Check if any changes were made
const hasChanges =
Expand All @@ -232,6 +235,7 @@ export function EditProfileForm({
const submission = parseWithZod(formData, {
schema: updateProfileSchema(),
})
logger('image file in submission', imageFile)
if (
submission.status === 'error' &&
submission.error !== null &&
Expand Down Expand Up @@ -352,7 +356,7 @@ export function EditProfileForm({
<button
onClick={(e) => {
e.preventDefault()
setPreviewImage(null)
setPreviewImage('')
setImageFilename(null)
setImageFilesize(null)
setImageFile(undefined)
Expand Down
5 changes: 0 additions & 5 deletions apps/portal/app/components/list/list-claims.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
SortColumnType,
useSearchAndSortParamsHandler,
} from '@lib/hooks/useSearchAndSortParams'
import logger from '@lib/utils/logger'
import { useNavigate } from '@remix-run/react'
import { PaginationType } from 'app/types/pagination'

Expand Down Expand Up @@ -58,8 +57,6 @@ export function ListClaimsList<T extends SortColumnType = ClaimSortColumn>({

const [isLoading, setIsLoading] = useState(false)

logger('listClaims', listClaims)

const uniqueClaimData = Array.from(
new Map(
listClaims.map((claim) => [
Expand All @@ -73,8 +70,6 @@ export function ListClaimsList<T extends SortColumnType = ClaimSortColumn>({
claim_id: claim.claim_id,
}))

logger('uniqueClaimData', uniqueClaimData)

const listContainerRef = useRef<HTMLDivElement>(null)
const { handleSearchChange, handleSortChange } =
useSearchAndSortParamsHandler(paramPrefix)
Expand Down
3 changes: 0 additions & 3 deletions apps/portal/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { Toaster } from '@0xintuition/1ui'
import { ErrorPage } from '@components/error-page'
import { GlobalLoading } from '@components/global-loading'
import { getChainEnvConfig } from '@lib/utils/environment'
import logger from '@lib/utils/logger'
import { setupAPI } from '@server/auth'
import { CURRENT_ENV } from 'app/consts'
import { ClientOnly } from 'remix-utils/client-only'
Expand Down Expand Up @@ -72,8 +71,6 @@ export const meta: MetaFunction<typeof loader> = ({ data }) => {
export async function loader({ request }: LoaderFunctionArgs) {
setupAPI(request)

logger('env', getEnv())

return json({
env: getEnv(),
requestInfo: {
Expand Down
Loading