Skip to content

Commit b048b94

Browse files
Merge upstream develop
2 parents f9dc81f + b25b6d5 commit b048b94

12 files changed

Lines changed: 811 additions & 159 deletions

File tree

.gitlab/ci/build_app.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,11 @@
2828
- pnpm config set @polycentric:registry https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/
2929
- pnpm install
3030

31-
app-format-check:
31+
app-biome-check:
3232
extends: .app-check-base
3333
stage: check
3434
script:
35-
- pnpm format apps/polycentric
36-
allow_failure: true
37-
38-
app-lint-check:
39-
extends: .app-check-base
40-
stage: check
41-
script:
42-
- pnpm --filter polycentric-app lint
35+
- pnpm exec biome check apps/polycentric --diagnostic-level=error
4336
allow_failure: true
4437

4538
app-tests:

.gitlab/ci/build_js_sdks.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,11 @@
2525
- pnpm config set @polycentric:registry https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/
2626
- pnpm install
2727

28-
js-sdks-format-check:
28+
js-sdks-biome-check:
2929
extends: .js-sdks-base
3030
stage: check
3131
script:
32-
- pnpm format
33-
allow_failure: true
34-
35-
js-sdks-lint-check:
36-
extends: .js-sdks-base
37-
stage: check
38-
script:
39-
- pnpm --filter js-core lint
32+
- pnpm exec biome check packages/js-core --diagnostic-level=error
4033
allow_failure: true
4134

4235
js-core-tests-check:

apps/polycentric/src/common/components/layout/Layout.tsx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
KeyboardAvoidingView,
1515
Platform,
1616
Pressable,
17+
ScrollView as RNScrollView,
1718
useWindowDimensions,
1819
View,
1920
} from 'react-native';
@@ -142,7 +143,10 @@ function Screen({
142143
testID="layout-screen"
143144
style={[
144145
Atoms.flex_row,
145-
Atoms.flex_1,
146+
// Web: grow with content so the sidebars' containing block spans the
147+
// full scroll height, letting `position: sticky` pin them. Native
148+
// keeps a fixed viewport-height screen.
149+
isWeb ? { minHeight: '100%' } : Atoms.flex_1,
146150
{ backgroundColor: theme.palette.neutral_0 },
147151
{ paddingTop: insets.top },
148152
!isWeb && {
@@ -200,22 +204,23 @@ export const LeftSidebar = memo(function LeftSidebar({
200204
{ alignItems: 'flex-end' },
201205
]}
202206
>
203-
<View style={{ width: narrowSidebar ? 88 : 275 }}>
207+
<View style={{ width: narrowSidebar ? 88 : 275, height: '100%' }}>
204208
<View
205209
style={[
206210
{
207-
position: 'fixed',
211+
position: 'sticky',
208212
top: 0,
209-
height: '100%',
213+
height: '100vh',
210214
},
211215
]}
212216
>
213-
<View
214-
style={[
217+
<RNScrollView
218+
showsVerticalScrollIndicator={false}
219+
contentContainerStyle={[
215220
Atoms.justify_between,
216221
Atoms.align_center,
217-
Atoms.h_full,
218222
{
223+
minHeight: '100%',
219224
paddingHorizontal: narrowSidebar ? 0 : 30,
220225
width: narrowSidebar ? 88 : 275,
221226
},
@@ -280,7 +285,7 @@ export const LeftSidebar = memo(function LeftSidebar({
280285
>
281286
{identity && <IdentityFooter compact={narrowSidebar} />}
282287
</View>
283-
</View>
288+
</RNScrollView>
284289
</View>
285290
</View>
286291
</View>
@@ -293,13 +298,11 @@ export const RightSidebar = memo(function RightSidebar() {
293298
const marginRight = deviceWidth <= Breakpoints['2xl'] ? 10 : 70;
294299

295300
return (
296-
<View style={{ width, marginRight }}>
297-
{/* Pin to viewport on web so it stays visible while the primary
298-
column scrolls; the outer View reserves the row space. */}
301+
<View style={{ width, marginRight, height: '100%' }}>
299302
<View
300303
style={
301304
isWeb
302-
? { position: 'fixed', top: 0, height: '100%', width }
305+
? { position: 'sticky', top: 0, height: '100vh', width }
303306
: undefined
304307
}
305308
>

apps/polycentric/src/features/composer/ComposeSheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export function ComposeSheet({
110110
onRemoveAttachment={composer.handleRemoveAttachment}
111111
linkPreview={composer.linkPreview}
112112
linkPreviewLoading={composer.linkPreviewLoading}
113+
onRemoveLinkPreview={composer.handleRemoveLinkPreview}
113114
autoFocus={autoFocus}
114115
/>
115116
</Sheet.Content>

apps/polycentric/src/features/composer/ComposeTabScreen.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export default function ComposeTabScreen() {
7474
onRemoveAttachment={composer.handleRemoveAttachment}
7575
linkPreview={composer.linkPreview}
7676
linkPreviewLoading={composer.linkPreviewLoading}
77+
onRemoveLinkPreview={composer.handleRemoveLinkPreview}
7778
/>
7879
</View>
7980
<ComposeSheetFooterBar

apps/polycentric/src/features/composer/ComposerFields.tsx

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ type ComposerFieldsProps = {
4444
linkPreview: v2.Link | null;
4545
/** True while the link preview is being fetched. */
4646
linkPreviewLoading: boolean;
47+
/**
48+
* Remove the link preview (X button).
49+
*/
50+
onRemoveLinkPreview: () => void;
4751
/** Auto-focus the text field.**/
4852
autoFocus?: boolean;
4953
};
@@ -67,6 +71,7 @@ export function ComposerFields({
6771
onRemoveAttachment,
6872
linkPreview,
6973
linkPreviewLoading,
74+
onRemoveLinkPreview,
7075
autoFocus = true,
7176
}: ComposerFieldsProps) {
7277
const { theme } = useTheme();
@@ -136,6 +141,8 @@ export function ComposerFields({
136141
<ComposerLinkPreview
137142
link={linkPreview}
138143
loading={linkPreviewLoading}
144+
disabled={submitting}
145+
onRemove={onRemoveLinkPreview}
139146
/>
140147
{/* Quote preview */}
141148
{!!quote && <ComposerPostEmbed post={quote} intentText="Quoting" />}
@@ -148,39 +155,71 @@ export function ComposerFields({
148155
/**
149156
* Live link preview shown while composing: a loading row until the unfurl
150157
* resolves, then the same `LinkPreviewCard` used in the feed (so the composer
151-
* preview matches what the post will look like).
158+
* preview matches what the post will look like). Both states carry an X
159+
* button that removes the preview from the draft.
152160
*/
153161
function ComposerLinkPreview({
154162
link,
155163
loading,
164+
disabled,
165+
onRemove,
156166
}: {
157167
link: v2.Link | null;
158168
loading: boolean;
169+
disabled: boolean;
170+
onRemove: () => void;
159171
}) {
160172
const { theme } = useTheme();
161173

162-
if (link) return <LinkPreviewCard link={link} />;
163-
if (!loading) return null;
174+
if (!link && !loading) return null;
164175

165176
return (
166-
<View
167-
style={[
168-
Atoms.flex_row,
169-
Atoms.align_center,
170-
Atoms.gap_sm,
171-
Atoms.p_md,
172-
Atoms.rounded_md,
173-
Atoms.mt_md,
174-
{
175-
borderWidth: 1,
176-
borderColor: withHexOpacity(theme.palette.neutral_500, '30'),
177-
},
178-
]}
179-
>
180-
<ActivityIndicator size="small" color={theme.palette.neutral_500} />
181-
<Text variant="secondary" color="neutral_500">
182-
Loading preview…
183-
</Text>
177+
<View>
178+
{link ? (
179+
<LinkPreviewCard link={link} />
180+
) : (
181+
<View
182+
style={[
183+
Atoms.flex_row,
184+
Atoms.align_center,
185+
Atoms.gap_sm,
186+
Atoms.p_md,
187+
Atoms.rounded_md,
188+
Atoms.mt_md,
189+
{
190+
borderWidth: 1,
191+
borderColor: withHexOpacity(theme.palette.neutral_500, '30'),
192+
},
193+
]}
194+
>
195+
<ActivityIndicator size="small" color={theme.palette.neutral_500} />
196+
<Text variant="secondary" color="neutral_500">
197+
Loading preview…
198+
</Text>
199+
</View>
200+
)}
201+
<Pressable
202+
onPress={onRemove}
203+
disabled={disabled}
204+
accessibilityLabel="Remove link preview"
205+
hitSlop={6}
206+
style={{
207+
position: 'absolute',
208+
// Below the card's own mt_md top margin (margins stay inside the
209+
// wrapper, so the card's top edge is Spacing.md down from ours).
210+
top: Spacing.md + 4,
211+
right: 4,
212+
width: 22,
213+
height: 22,
214+
borderRadius: 11,
215+
alignItems: 'center',
216+
justifyContent: 'center',
217+
backgroundColor: withHexOpacity(theme.palette.black, 'b0'),
218+
opacity: disabled ? 0.4 : 1,
219+
}}
220+
>
221+
<Icon name="close" size={14} color="white" />
222+
</Pressable>
184223
</View>
185224
);
186225
}

0 commit comments

Comments
 (0)