@openpeepshq/rn-components 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -143,7 +143,7 @@
143
143
  "validator": "^13.15.23",
144
144
  "zustand": "^5.0.3",
145
145
  "@openpeepshq/common": "^0.4.0",
146
- "@openpeepshq/react": "^0.8.2"
146
+ "@openpeepshq/react": "^0.8.5"
147
147
  },
148
148
  "devDependencies": {
149
149
  "@babel/core": "^7.26.7",
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { View } from 'react-native';
2
+ import { Image, View } from 'react-native';
3
3
  import type { MediaAttachmentData } from '@openpeepshq/common/types';
4
4
  import { AudioPlayer } from '../../custom/common/audio-player';
5
5
  import { ThemedText } from '../../ui/themed-text';
@@ -12,6 +12,8 @@ export const isAudioAttachment = (
12
12
 
13
13
  export interface AudioAttachmentProps {
14
14
  src?: string;
15
+ /** Waveform/thumbnail image rendered above the player when available. */
16
+ previewUrl?: string;
15
17
  label?: string;
16
18
  size?: number;
17
19
  /** Only the visible carousel item keeps its player active. */
@@ -30,6 +32,7 @@ const formatBytes = (bytes?: number): string | undefined => {
30
32
 
31
33
  export const AudioAttachment = ({
32
34
  src,
35
+ previewUrl,
33
36
  label,
34
37
  size,
35
38
  isActive = true,
@@ -39,6 +42,13 @@ export const AudioAttachment = ({
39
42
  const sizeLabel = formatBytes(size);
40
43
  return (
41
44
  <View className={cn('w-full gap-1 rounded-md bg-muted p-3', className)}>
45
+ {previewUrl ? (
46
+ <Image
47
+ source={{ uri: previewUrl }}
48
+ resizeMode="cover"
49
+ className="mb-1 h-40 w-full rounded-md"
50
+ />
51
+ ) : null}
42
52
  {label ? (
43
53
  <View className="flex-row items-center gap-2">
44
54
  <ThemedText className="flex-1 text-sm font-medium" numberOfLines={1}>
@@ -37,7 +37,7 @@ export const EventLocation: React.FC<EventLocationProps> = ({
37
37
  <>
38
38
  <LinkIcon className="text-muted-foreground" size={18} />
39
39
  <ThemedText className="text-muted-foreground">
40
- {t('events.location.online', { defaultValue: 'Online' })}
40
+ {t('events.location.external', { defaultValue: 'External Event' })}
41
41
  </ThemedText>
42
42
  </>
43
43
  ) : null}
@@ -61,6 +61,7 @@ export const GalleryModal = ({
61
61
  <AudioAttachment
62
62
  key={attachment.url}
63
63
  src={attachment.url}
64
+ previewUrl={attachment.previewUrl ?? undefined}
64
65
  label={attachment.filename ?? attachment.description}
65
66
  size={attachment.meta?.size}
66
67
  />
@@ -12,6 +12,7 @@ export const GalleryAudio = ({ attachment, isActive }: GalleryAudioProps) => (
12
12
  <View className="size-full items-center justify-center rounded-none bg-muted p-4">
13
13
  <AudioAttachment
14
14
  src={attachment.url}
15
+ previewUrl={attachment.previewUrl ?? undefined}
15
16
  label={attachment.filename ?? attachment.description}
16
17
  size={attachment.meta?.size}
17
18
  isActive={isActive}
@@ -129,6 +129,7 @@ export const FullResource = ({ post }: FullResourceProps) => {
129
129
  preview={
130
130
  <AudioAttachment
131
131
  src={audioAtt.url}
132
+ previewUrl={audioAtt.previewUrl ?? undefined}
132
133
  label={audioAtt.filename ?? audioAtt.description}
133
134
  size={audioAtt.meta?.size}
134
135
  />
@@ -119,6 +119,14 @@ export const ResourceCard = ({
119
119
  attachmentMediaKind(att) === 'video' ||
120
120
  attachmentMediaKind(att) === 'audio'
121
121
  );
122
+ // File resources show their filename (with extension) so users can tell
123
+ // what they're about to download; other kinds show the size.
124
+ if (resource.resourceKind === 'file') {
125
+ const size = fileAtt?.meta?.size;
126
+ const filename = fileAtt?.filename;
127
+ if (filename && size) return `${filename} · ${formatSize(size)}`;
128
+ return filename ?? (size ? formatSize(size) : null);
129
+ }
122
130
  const size = fileAtt?.meta?.size;
123
131
  if (size) return formatSize(size);
124
132
  return null;