[Glitch] Profile editing: Add initial route

Port 4b1f66418b to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
Echo authored and Claire committed 2026-02-18 18:53:23 +01:00
1 parent 925d1ffde5
commit b8b1d3a934
9 files changed
+124 -10

No files matched your search

@@ -1,6 +1,8 @@
import { forwardRef, useRef, useImperativeHandle } from 'react';
import type { Ref } from 'react';
import classNames from 'classnames';
import { scrollTop } from 'flavours/glitch/scroll';
export interface ColumnRef {
@@ -12,10 +14,11 @@ interface ColumnProps {
children?: React.ReactNode;
label?: string;
bindToDocument?: boolean;
className?: string;
}
export const Column = forwardRef<ColumnRef, ColumnProps>(
({ children, label, bindToDocument }, ref: Ref<ColumnRef>) => {
({ children, label, bindToDocument, className }, ref: Ref<ColumnRef>) => {
const nodeRef = useRef<HTMLDivElement>(null);
useImperativeHandle(ref, () => ({
@@ -39,7 +42,12 @@ export const Column = forwardRef<ColumnRef, ColumnProps>(
}));
return (
<div role='region' aria-label={label} className='column' ref={nodeRef}>
<div
role='region'
aria-label={label}
className={classNames('column', className)}
ref={nodeRef}
>
{children}
</div>
);
@@ -73,6 +73,7 @@ export interface Props {
iconComponent?: IconProp;
active?: boolean;
children?: React.ReactNode;
className?: string;
pinned?: boolean;
multiColumn?: boolean;
extraButton?: React.ReactNode;
@@ -91,6 +92,7 @@ export const ColumnHeader: React.FC<Props> = ({
iconComponent,
active,
children,
className,
pinned,
multiColumn,
extraButton,
@@ -141,7 +143,7 @@ export const ColumnHeader: React.FC<Props> = ({
onPin?.();
}, [history, pinned, onPin]);
const wrapperClassName = classNames('column-header__wrapper', {
const wrapperClassName = classNames('column-header__wrapper', className, {
active,
});
@@ -256,7 +258,8 @@ export const ColumnHeader: React.FC<Props> = ({
}
const hasIcon = icon && iconComponent;
const hasTitle = hasIcon && title;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const hasTitle = (hasIcon || backButton) && title;
const component = (
<div className={wrapperClassName}>
@@ -270,7 +273,7 @@ export const ColumnHeader: React.FC<Props> = ({
className='column-header__title'
type='button'
>
{!backButton && (
{!backButton && hasIcon && (
<Icon
id={icon}
icon={iconComponent}
@@ -3,8 +3,10 @@ import { useCallback, useEffect } from 'react';
import { useIntl, defineMessages } from 'react-intl';
import classNames from 'classnames';
import { Link } from 'react-router-dom';
import { useIdentity } from '@/flavours/glitch/identity_context';
import { isClientFeatureEnabled } from '@/flavours/glitch/utils/environment';
import {
fetchRelationships,
followAccount,
@@ -158,14 +160,24 @@ export const FollowButton: React.FC<{
}
if (accountId === me) {
const buttonClasses = classNames(className, 'button button-secondary', {
'button--compact': compact,
});
if (isClientFeatureEnabled('profile_editing')) {
return (
<Link to='/profile/edit' className={buttonClasses}>
{label}
</Link>
);
}
return (
<a
href='/settings/profile'
target='_blank'
rel='noopener'
className={classNames(className, 'button button-secondary', {
'button--compact': compact,
})}
className={buttonClasses}
>
{label}
</a>