Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Load previous state in alt text modal (#546)

authored by

Ollie Hsieh and committed by
GitHub
7a2c2102 c8e51a7d

+11 -5
+5 -1
src/lib/media/alt-text.ts
··· 1 1 import {RootStoreModel} from 'state/index' 2 2 3 - export async function openAltTextModal(store: RootStoreModel): Promise<string> { 3 + export async function openAltTextModal( 4 + store: RootStoreModel, 5 + prevAltText: string, 6 + ): Promise<string> { 4 7 return new Promise((resolve, reject) => { 5 8 store.shell.openModal({ 6 9 name: 'alt-text-image', 10 + prevAltText, 7 11 onAltTextSet: (altText?: string) => { 8 12 if (altText) { 9 13 resolve(altText)
+2 -2
src/state/models/media/image.ts
··· 15 15 width: number 16 16 height: number 17 17 size: number 18 - altText?: string = undefined 18 + altText = '' 19 19 cropped?: RNImage = undefined 20 20 compressed?: RNImage = undefined 21 21 scaledWidth: number = POST_IMG_MAX.width ··· 45 45 46 46 async setAltText() { 47 47 try { 48 - const altText = await openAltTextModal(this.rootStore) 48 + const altText = await openAltTextModal(this.rootStore, this.altText) 49 49 50 50 runInAction(() => { 51 51 this.altText = altText
+1
src/state/models/ui/shell.ts
··· 43 43 44 44 export interface AltTextImageModal { 45 45 name: 'alt-text-image' 46 + prevAltText: string 46 47 onAltTextSet: (altText?: string) => void 47 48 } 48 49
+3 -2
src/view/com/modals/AltImage.tsx
··· 15 15 export const snapPoints = ['80%'] 16 16 17 17 interface Props { 18 + prevAltText: string 18 19 onAltTextSet: (altText?: string | undefined) => void 19 20 } 20 21 21 - export function Component({onAltTextSet}: Props) { 22 + export function Component({prevAltText, onAltTextSet}: Props) { 22 23 const pal = usePalette('default') 23 24 const store = useStores() 24 25 const theme = useTheme() 25 - const [altText, setAltText] = useState('') 26 + const [altText, setAltText] = useState(prevAltText) 26 27 27 28 const onPressSave = useCallback(() => { 28 29 onAltTextSet(altText)