@repzo/widget-react-native 1.2.1 → 1.2.2
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/CHANGELOG.md +28 -0
- package/README.md +31 -0
- package/lib/commonjs/api/client.js +47 -2
- package/lib/commonjs/api/client.js.map +1 -1
- package/lib/commonjs/audio/voice.js +119 -0
- package/lib/commonjs/audio/voice.js.map +1 -0
- package/lib/commonjs/i18n.js +6 -0
- package/lib/commonjs/i18n.js.map +1 -1
- package/lib/commonjs/locales.js +4 -0
- package/lib/commonjs/locales.js.map +1 -1
- package/lib/commonjs/state/use-widget-state.js +31 -0
- package/lib/commonjs/state/use-widget-state.js.map +1 -1
- package/lib/commonjs/state/widget-store.js +22 -1
- package/lib/commonjs/state/widget-store.js.map +1 -1
- package/lib/commonjs/ui/WidgetProvider.js +6 -0
- package/lib/commonjs/ui/WidgetProvider.js.map +1 -1
- package/lib/commonjs/ui/components/FileCard.js +134 -0
- package/lib/commonjs/ui/components/FileCard.js.map +1 -0
- package/lib/commonjs/ui/components/Launcher.js +15 -1
- package/lib/commonjs/ui/components/Launcher.js.map +1 -1
- package/lib/commonjs/ui/components/VoiceNote.js +354 -0
- package/lib/commonjs/ui/components/VoiceNote.js.map +1 -0
- package/lib/commonjs/ui/components/icons.js +57 -0
- package/lib/commonjs/ui/components/icons.js.map +1 -1
- package/lib/commonjs/ui/screens/chat/ChatView.js +33 -14
- package/lib/commonjs/ui/screens/chat/ChatView.js.map +1 -1
- package/lib/commonjs/ui/screens/chat/ChatView.styles.js +0 -9
- package/lib/commonjs/ui/screens/chat/ChatView.styles.js.map +1 -1
- package/lib/module/api/client.js +48 -2
- package/lib/module/api/client.js.map +1 -1
- package/lib/module/audio/voice.js +110 -0
- package/lib/module/audio/voice.js.map +1 -0
- package/lib/module/i18n.js +6 -0
- package/lib/module/i18n.js.map +1 -1
- package/lib/module/locales.js +4 -0
- package/lib/module/locales.js.map +1 -1
- package/lib/module/state/use-widget-state.js +30 -1
- package/lib/module/state/use-widget-state.js.map +1 -1
- package/lib/module/state/widget-store.js +22 -1
- package/lib/module/state/widget-store.js.map +1 -1
- package/lib/module/ui/WidgetProvider.js +6 -0
- package/lib/module/ui/WidgetProvider.js.map +1 -1
- package/lib/module/ui/components/FileCard.js +130 -0
- package/lib/module/ui/components/FileCard.js.map +1 -0
- package/lib/module/ui/components/Launcher.js +16 -2
- package/lib/module/ui/components/Launcher.js.map +1 -1
- package/lib/module/ui/components/VoiceNote.js +350 -0
- package/lib/module/ui/components/VoiceNote.js.map +1 -0
- package/lib/module/ui/components/icons.js +55 -0
- package/lib/module/ui/components/icons.js.map +1 -1
- package/lib/module/ui/screens/chat/ChatView.js +33 -14
- package/lib/module/ui/screens/chat/ChatView.js.map +1 -1
- package/lib/module/ui/screens/chat/ChatView.styles.js +0 -9
- package/lib/module/ui/screens/chat/ChatView.styles.js.map +1 -1
- package/lib/typescript/commonjs/api/client.d.ts +12 -0
- package/lib/typescript/commonjs/api/client.d.ts.map +1 -1
- package/lib/typescript/commonjs/audio/voice.d.ts +29 -0
- package/lib/typescript/commonjs/audio/voice.d.ts.map +1 -0
- package/lib/typescript/commonjs/i18n.d.ts +4 -0
- package/lib/typescript/commonjs/i18n.d.ts.map +1 -1
- package/lib/typescript/commonjs/locales.d.ts.map +1 -1
- package/lib/typescript/commonjs/state/use-widget-state.d.ts +8 -0
- package/lib/typescript/commonjs/state/use-widget-state.d.ts.map +1 -1
- package/lib/typescript/commonjs/state/widget-store.d.ts +2 -0
- package/lib/typescript/commonjs/state/widget-store.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/WidgetProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/FileCard.d.ts +21 -0
- package/lib/typescript/commonjs/ui/components/FileCard.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/Launcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/VoiceNote.d.ts +32 -0
- package/lib/typescript/commonjs/ui/components/VoiceNote.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/icons.d.ts +4 -0
- package/lib/typescript/commonjs/ui/components/icons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts +0 -9
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts +4 -0
- package/lib/typescript/commonjs/ui/screens/chat/ChatView.types.d.ts.map +1 -1
- package/lib/typescript/module/api/client.d.ts +12 -0
- package/lib/typescript/module/api/client.d.ts.map +1 -1
- package/lib/typescript/module/audio/voice.d.ts +29 -0
- package/lib/typescript/module/audio/voice.d.ts.map +1 -0
- package/lib/typescript/module/i18n.d.ts +4 -0
- package/lib/typescript/module/i18n.d.ts.map +1 -1
- package/lib/typescript/module/locales.d.ts.map +1 -1
- package/lib/typescript/module/state/use-widget-state.d.ts +8 -0
- package/lib/typescript/module/state/use-widget-state.d.ts.map +1 -1
- package/lib/typescript/module/state/widget-store.d.ts +2 -0
- package/lib/typescript/module/state/widget-store.d.ts.map +1 -1
- package/lib/typescript/module/ui/WidgetProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/FileCard.d.ts +21 -0
- package/lib/typescript/module/ui/components/FileCard.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/Launcher.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/VoiceNote.d.ts +32 -0
- package/lib/typescript/module/ui/components/VoiceNote.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/icons.d.ts +4 -0
- package/lib/typescript/module/ui/components/icons.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts +0 -9
- package/lib/typescript/module/ui/screens/chat/ChatView.styles.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts +4 -0
- package/lib/typescript/module/ui/screens/chat/ChatView.types.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/api/client.ts +56 -2
- package/src/audio/voice.ts +103 -0
- package/src/i18n.ts +6 -0
- package/src/locales.ts +4 -0
- package/src/state/use-widget-state.ts +30 -1
- package/src/state/widget-store.ts +22 -1
- package/src/ui/WidgetProvider.tsx +6 -0
- package/src/ui/components/FileCard.tsx +111 -0
- package/src/ui/components/Launcher.tsx +7 -2
- package/src/ui/components/VoiceNote.tsx +363 -0
- package/src/ui/components/icons.tsx +33 -0
- package/src/ui/screens/chat/ChatView.styles.ts +0 -9
- package/src/ui/screens/chat/ChatView.tsx +39 -13
- package/src/ui/screens/chat/ChatView.types.ts +4 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FileCard = FileCard;
|
|
7
|
+
exports.fileTypeLabel = fileTypeLabel;
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _pickers = require("../../attachments/pickers.js");
|
|
10
|
+
var _icons = require("./icons.js");
|
|
11
|
+
var _theme = require("../styles/theme.js");
|
|
12
|
+
var _rtl = require("../utils/rtl.js");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
/**
|
|
15
|
+
* An attachment that opens outside the chat (PDF, video, sheet…), drawn as a
|
|
16
|
+
* card that reads as tappable: a tile with the file's type, its name, the
|
|
17
|
+
* type and size under it, and an arrow — instead of a bare name in a box.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** `PDF`, `MP4`, `XLSX` — from the name, else the MIME subtype; at most 4 letters. */
|
|
21
|
+
function fileTypeLabel(name, contentType) {
|
|
22
|
+
const fromName = /\.([a-z0-9]{1,8})$/i.exec(name.trim())?.[1];
|
|
23
|
+
const fromType = (contentType ?? '').split('/')[1]?.split(/[;+.-]/)[0];
|
|
24
|
+
const label = (fromName || fromType || 'file').toUpperCase();
|
|
25
|
+
return label.length > 4 ? label.slice(0, 4) : label;
|
|
26
|
+
}
|
|
27
|
+
function FileCard({
|
|
28
|
+
name,
|
|
29
|
+
contentType,
|
|
30
|
+
size,
|
|
31
|
+
color,
|
|
32
|
+
onBrandBubble,
|
|
33
|
+
openLabel,
|
|
34
|
+
onPress
|
|
35
|
+
}) {
|
|
36
|
+
const type = fileTypeLabel(name, contentType);
|
|
37
|
+
const isVideo = (contentType ?? '').toLowerCase().startsWith('video/');
|
|
38
|
+
const meta = size > 0 ? `${type} · ${(0, _pickers.formatBytes)(size)}` : type;
|
|
39
|
+
const accent = onBrandBubble ? _theme.palette.white : color;
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
|
|
41
|
+
onPress: onPress,
|
|
42
|
+
disabled: !onPress,
|
|
43
|
+
accessibilityRole: "button",
|
|
44
|
+
accessibilityLabel: openLabel,
|
|
45
|
+
style: ({
|
|
46
|
+
pressed
|
|
47
|
+
}) => [styles.card, onBrandBubble ? {
|
|
48
|
+
backgroundColor: (0, _theme.withAlpha)(_theme.palette.white, 0.16),
|
|
49
|
+
borderColor: (0, _theme.withAlpha)(_theme.palette.white, 0.35)
|
|
50
|
+
} : {
|
|
51
|
+
backgroundColor: _theme.palette.white,
|
|
52
|
+
borderColor: _theme.palette.border
|
|
53
|
+
}, !onPress && styles.unavailable, pressed && styles.pressed],
|
|
54
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
55
|
+
style: [styles.tile, {
|
|
56
|
+
backgroundColor: onBrandBubble ? _theme.palette.white : (0, _theme.withAlpha)(color, 0.12)
|
|
57
|
+
}],
|
|
58
|
+
children: isVideo ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlayIcon, {
|
|
59
|
+
size: 16,
|
|
60
|
+
color: color
|
|
61
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
62
|
+
style: [styles.tileLabel, {
|
|
63
|
+
color
|
|
64
|
+
}],
|
|
65
|
+
numberOfLines: 1,
|
|
66
|
+
children: type
|
|
67
|
+
})
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
69
|
+
style: styles.text,
|
|
70
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
71
|
+
style: [styles.name, {
|
|
72
|
+
color: onBrandBubble ? _theme.palette.white : _theme.palette.ink
|
|
73
|
+
}],
|
|
74
|
+
numberOfLines: 2,
|
|
75
|
+
children: name
|
|
76
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
77
|
+
style: [styles.meta, {
|
|
78
|
+
color: onBrandBubble ? (0, _theme.withAlpha)(_theme.palette.white, 0.8) : _theme.palette.textMuted
|
|
79
|
+
}],
|
|
80
|
+
children: meta
|
|
81
|
+
})]
|
|
82
|
+
}), onPress ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.ChevronIcon, {
|
|
83
|
+
size: 14,
|
|
84
|
+
color: accent,
|
|
85
|
+
direction: (0, _rtl.forwardDirection)()
|
|
86
|
+
}) : null]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const styles = _reactNative.StyleSheet.create({
|
|
90
|
+
card: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
gap: _theme.spacing.sm + 2,
|
|
94
|
+
minWidth: 220,
|
|
95
|
+
paddingVertical: _theme.spacing.sm + 1,
|
|
96
|
+
paddingHorizontal: _theme.spacing.sm + 2,
|
|
97
|
+
borderWidth: _reactNative.StyleSheet.hairlineWidth,
|
|
98
|
+
borderRadius: _theme.radius.lg
|
|
99
|
+
},
|
|
100
|
+
pressed: {
|
|
101
|
+
opacity: 0.7
|
|
102
|
+
},
|
|
103
|
+
unavailable: {
|
|
104
|
+
opacity: 0.6
|
|
105
|
+
},
|
|
106
|
+
tile: {
|
|
107
|
+
width: 40,
|
|
108
|
+
height: 40,
|
|
109
|
+
borderRadius: _theme.radius.sm,
|
|
110
|
+
alignItems: 'center',
|
|
111
|
+
justifyContent: 'center'
|
|
112
|
+
},
|
|
113
|
+
tileLabel: {
|
|
114
|
+
fontSize: 11,
|
|
115
|
+
fontWeight: '800',
|
|
116
|
+
letterSpacing: 0.3
|
|
117
|
+
},
|
|
118
|
+
text: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
minWidth: 0,
|
|
121
|
+
gap: 2
|
|
122
|
+
},
|
|
123
|
+
// A Latin file name in an Arabic chat still lines up with the card's start.
|
|
124
|
+
name: {
|
|
125
|
+
fontSize: _theme.fontSize.meta + 1,
|
|
126
|
+
fontWeight: '600',
|
|
127
|
+
textAlign: _rtl.START_ALIGN
|
|
128
|
+
},
|
|
129
|
+
meta: {
|
|
130
|
+
fontSize: _theme.fontSize.caption,
|
|
131
|
+
textAlign: _rtl.START_ALIGN
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=FileCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_pickers","_icons","_theme","_rtl","_jsxRuntime","fileTypeLabel","name","contentType","fromName","exec","trim","fromType","split","label","toUpperCase","length","slice","FileCard","size","color","onBrandBubble","openLabel","onPress","type","isVideo","toLowerCase","startsWith","meta","formatBytes","accent","palette","white","jsxs","Pressable","disabled","accessibilityRole","accessibilityLabel","style","pressed","styles","card","backgroundColor","withAlpha","borderColor","border","unavailable","children","jsx","View","tile","PlayIcon","Text","tileLabel","numberOfLines","text","ink","textMuted","ChevronIcon","direction","forwardDirection","StyleSheet","create","flexDirection","alignItems","gap","spacing","sm","minWidth","paddingVertical","paddingHorizontal","borderWidth","hairlineWidth","borderRadius","radius","lg","opacity","width","height","justifyContent","fontSize","fontWeight","letterSpacing","flex","textAlign","START_AL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C/BG,iBAAiB,EAAEJ,cAAO,CAACC,EAAE,GAAG,CAAC;IACjCI,WAAW,EAAEV,uBAAU,CAACW,aAAa;IACrCC,YAAY,EAAEC,aAAM,CAACC;EACvB,CAAC;EACDpC,OAAO,EAAE;IAAEqC,OAAO,EAAE;EAAI,CAAC;EACzB9B,WAAW,EAAE;IAAE8B,OAAO,EAAE;EAAI,CAAC;EAC7B1B,IAAI,EAAE;IACJ2B,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVL,YAAY,EAAEC,aAAM,CAACP,EAAE;IACvBH,UAAU,EAAE,QAAQ;IACpBe,cAAc,EAAE;EAClB,CAAC;EACD1B,SAAS,EAAE;IAAE2B,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE,KAAK;IAAEC,aAAa,EAAE;EAAI,CAAC;EAClE3B,IAAI,EAAE;IAAE4B,IAAI,EAAE,CAAC;IAAEf,QAAQ,EAAE,CAAC;IAAEH,GAAG,EAAE;EAAE,CAAC;EACtC;EACA1D,IAAI,EAAE;IAAEyE,QAAQ,EAAEA,eAAQ,CAACpD,IAAI,GAAG,CAAC;IAAEqD,UAAU,EAAE,KAAK;IAAEG,SAAS,EAAEC;EAAY,CAAC;EAChFzD,IAAI,EAAE;IAAEoD,QAAQ,EAAEA,eAAQ,CAACM,OAAO;IAAEF,SAAS,EAAEC;EAAY;AAC7D,CAAC,CAAC","ignoreList":[]}
|
|
@@ -26,7 +26,21 @@ function Launcher({
|
|
|
26
26
|
horizontalPadding,
|
|
27
27
|
hidden = false
|
|
28
28
|
}) {
|
|
29
|
-
|
|
29
|
+
// Only what the launcher draws: it sits on the host's screens and shouldn't
|
|
30
|
+
// redraw on every message or typing event.
|
|
31
|
+
const state = (0, _useWidgetState.useWidgetSelector)(({
|
|
32
|
+
booted,
|
|
33
|
+
config,
|
|
34
|
+
isOpen,
|
|
35
|
+
locale,
|
|
36
|
+
unreadCount
|
|
37
|
+
}) => ({
|
|
38
|
+
booted,
|
|
39
|
+
config,
|
|
40
|
+
isOpen,
|
|
41
|
+
locale,
|
|
42
|
+
unreadCount
|
|
43
|
+
}), _useWidgetState.shallowEqual);
|
|
30
44
|
const config = state.config;
|
|
31
45
|
if (hidden || !state.booted || config?.showLauncher === false) return null;
|
|
32
46
|
const color = config?.primaryColor || _theme.DEFAULT_PRIMARY_COLOR;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_i18n","_useWidgetState","_controller","_icons","_theme","_jsxRuntime","Launcher","position","verticalPadding","horizontalPadding","hidden","state","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_i18n","_useWidgetState","_controller","_icons","_theme","_jsxRuntime","Launcher","position","verticalPadding","horizontalPadding","hidden","state","useWidgetSelector","booted","config","isOpen","locale","unreadCount","shallowEqual","showLauncher","color","primaryColor","DEFAULT_PRIMARY_COLOR","side","bottom","Math","max","launcherVerticalPadding","inset","launcherHorizontalPadding","text","bubbleText","showText","translate","createTranslator","accessibilityLabel","DEFAULT_LABELS","launcherClose","launcherOpen","jsxs","View","style","styles","wrapper","right","left","pointerEvents","children","Pressable","onPress","controller","store","toggle","accessibilityRole","pressed","bubble","bubbleWithText","bubbleRound","backgroundColor","jsx","Text","ChevronIcon","size","direction","palette","white","ChatIcon","badge","badgeLabel","StyleSheet","create","height","alignItems","justifyContent","flexDirection","gap","spacing","sm","shadows","floating","width","borderRadius","radius","pill","paddingHorizontal","xl","fontSize","body","fontWeight","opacity","transform","scale","top","minWidth","xs","danger","caption"],"sourceRoot":"../../../../src","sources":["ui/components/Launcher.tsx"],"mappings":";;;;;;AASA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAOyB,IAAAM,WAAA,GAAAN,OAAA;AAtBzB;AACA;AACA;A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;MAAEC,KAAK,EAAE;IAAK,CAAC;EAC7B,CAAC;EACDxB,KAAK,EAAE;IACL5D,QAAQ,EAAE,UAAU;IACpBqF,GAAG,EAAE,CAAC,CAAC;IACPhD,KAAK,EAAE,CAAC,CAAC;IACTiD,QAAQ,EAAE,EAAE;IACZtB,MAAM,EAAE,EAAE;IACVU,YAAY,EAAE,EAAE;IAChBG,iBAAiB,EAAER,cAAO,CAACkB,EAAE;IAC7BpC,eAAe,EAAEM,cAAO,CAAC+B,MAAM;IAC/BvB,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB,CAAC;EACDL,UAAU,EAAE;IACVhD,KAAK,EAAE4C,cAAO,CAACC,KAAK;IACpBqB,QAAQ,EAAEA,eAAQ,CAACU,OAAO;IAC1BR,UAAU,EAAE;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VoiceNote = VoiceNote;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _voice = require("../../audio/voice.js");
|
|
10
|
+
var _icons = require("./icons.js");
|
|
11
|
+
var _theme = require("../styles/theme.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* A voice note (or any audio attachment) played inside the chat, laid out the
|
|
15
|
+
* way messaging apps do it: a play button beside a waveform the visitor can
|
|
16
|
+
* tap or drag to jump through the note, the time under it, and a speed chip
|
|
17
|
+
* once the note has been started. Only rendered when the host app has
|
|
18
|
+
* `expo-audio` (see `src/audio/voice.ts`); without it audio stays a file row.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const BAR_COUNT = 32;
|
|
22
|
+
const BAR_WIDTH = 3;
|
|
23
|
+
const BAR_MIN_HEIGHT = 4;
|
|
24
|
+
const BAR_MAX_HEIGHT = 24;
|
|
25
|
+
const BUTTON_SIZE = 36;
|
|
26
|
+
const KNOB_SIZE = 12;
|
|
27
|
+
const SPEEDS = [1, 1.5, 2];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The player is only created once the visitor taps play. The whole thread
|
|
31
|
+
* renders at once, so a player per note would download every note in the
|
|
32
|
+
* conversation as soon as the chat opened.
|
|
33
|
+
*/
|
|
34
|
+
function VoiceNote(props) {
|
|
35
|
+
const [started, setStarted] = (0, _react.useState)(false);
|
|
36
|
+
if (started) return /*#__PURE__*/(0, _jsxRuntime.jsx)(ActiveVoiceNote, {
|
|
37
|
+
...props
|
|
38
|
+
});
|
|
39
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(VoiceNoteLayout, {
|
|
40
|
+
...props,
|
|
41
|
+
playing: false,
|
|
42
|
+
loading: false,
|
|
43
|
+
progress: 0,
|
|
44
|
+
time: null,
|
|
45
|
+
onToggle: () => setStarted(true)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A note that has been started: owns its expo-audio player and plays on mount. */
|
|
50
|
+
function ActiveVoiceNote(props) {
|
|
51
|
+
const {
|
|
52
|
+
url,
|
|
53
|
+
onError
|
|
54
|
+
} = props;
|
|
55
|
+
const audio = (0, _voice.voicePlaybackModule)();
|
|
56
|
+
const player = audio.useAudioPlayer({
|
|
57
|
+
uri: url
|
|
58
|
+
}, (0, _voice.audioPlayerOptions)());
|
|
59
|
+
const status = audio.useAudioPlayerStatus(player);
|
|
60
|
+
const [speedIndex, setSpeedIndex] = (0, _react.useState)(0);
|
|
61
|
+
const [scrub, setScrub] = (0, _react.useState)(null);
|
|
62
|
+
const [trackWidth, setTrackWidth] = (0, _react.useState)(0);
|
|
63
|
+
// Whether the visitor asked for playback, so a note still loading shows a
|
|
64
|
+
// spinner, and one they paused while it loaded doesn't.
|
|
65
|
+
const [wantsPlay, setWantsPlay] = (0, _react.useState)(true);
|
|
66
|
+
// This note's hold on playback: starting it pauses any other note.
|
|
67
|
+
const releasePlayback = (0, _react.useRef)(null);
|
|
68
|
+
const duration = Math.max(Number(status?.duration) || 0, 0);
|
|
69
|
+
const currentTime = Math.max(Number(status?.currentTime) || 0, 0);
|
|
70
|
+
const playing = !!status?.playing;
|
|
71
|
+
const finished = !!status?.didJustFinish || duration > 0 && currentTime >= duration - 0.1;
|
|
72
|
+
// `isLoaded` / `isBuffering` are compared strictly: an expo-audio that
|
|
73
|
+
// doesn't report them never gets a spinner that can't go away.
|
|
74
|
+
const loading = wantsPlay && !playing && (status?.isLoaded === false || status?.isBuffering === true);
|
|
75
|
+
const pause = () => {
|
|
76
|
+
setWantsPlay(false);
|
|
77
|
+
player.pause();
|
|
78
|
+
};
|
|
79
|
+
const start = () => {
|
|
80
|
+
releasePlayback.current?.();
|
|
81
|
+
releasePlayback.current = (0, _voice.claimVoicePlayback)(pause);
|
|
82
|
+
setWantsPlay(true);
|
|
83
|
+
player.play();
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// The visitor tapped play on the idle note, which created this player.
|
|
87
|
+
// Neither callback changes for the player's lifetime.
|
|
88
|
+
(0, _react.useEffect)(() => {
|
|
89
|
+
start();
|
|
90
|
+
return () => releasePlayback.current?.();
|
|
91
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
92
|
+
}, []);
|
|
93
|
+
|
|
94
|
+
// The error is only on the status update that reports it (the next one
|
|
95
|
+
// clears it), so it is acted on as it arrives.
|
|
96
|
+
const error = status?.error;
|
|
97
|
+
(0, _react.useEffect)(() => {
|
|
98
|
+
if (error) onError();
|
|
99
|
+
}, [error, onError]);
|
|
100
|
+
const togglePlay = async () => {
|
|
101
|
+
if (playing || loading) {
|
|
102
|
+
pause();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (finished) await player.seekTo(0);
|
|
106
|
+
start();
|
|
107
|
+
};
|
|
108
|
+
const cycleSpeed = () => {
|
|
109
|
+
const next = (speedIndex + 1) % SPEEDS.length;
|
|
110
|
+
setSpeedIndex(next);
|
|
111
|
+
try {
|
|
112
|
+
player.setPlaybackRate(SPEEDS[next], 'high');
|
|
113
|
+
} catch {
|
|
114
|
+
// Some versions take no pitch-correction argument.
|
|
115
|
+
try {
|
|
116
|
+
player.setPlaybackRate(SPEEDS[next]);
|
|
117
|
+
} catch {
|
|
118
|
+
// Speed unsupported: the note keeps playing at 1×.
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// The latest values for the (stable) PanResponder below.
|
|
124
|
+
const latest = (0, _react.useRef)({
|
|
125
|
+
trackWidth,
|
|
126
|
+
duration,
|
|
127
|
+
player
|
|
128
|
+
});
|
|
129
|
+
latest.current = {
|
|
130
|
+
trackWidth,
|
|
131
|
+
duration,
|
|
132
|
+
player
|
|
133
|
+
};
|
|
134
|
+
const ratioAt = x => {
|
|
135
|
+
const width = latest.current.trackWidth;
|
|
136
|
+
return width > 0 ? Math.min(1, Math.max(0, x / width)) : 0;
|
|
137
|
+
};
|
|
138
|
+
// Where the finger first touched the track. Later positions are that plus
|
|
139
|
+
// the drag distance: a move event's own `locationX` is measured from
|
|
140
|
+
// whatever view is under the finger, not from the track.
|
|
141
|
+
const startX = (0, _react.useRef)(0);
|
|
142
|
+
const pan = (0, _react.useRef)(_reactNative.PanResponder.create({
|
|
143
|
+
onStartShouldSetPanResponder: () => true,
|
|
144
|
+
onMoveShouldSetPanResponder: () => true,
|
|
145
|
+
onPanResponderGrant: event => {
|
|
146
|
+
startX.current = event.nativeEvent.locationX;
|
|
147
|
+
setScrub(ratioAt(startX.current));
|
|
148
|
+
},
|
|
149
|
+
onPanResponderMove: (_, gesture) => setScrub(ratioAt(startX.current + gesture.dx)),
|
|
150
|
+
onPanResponderRelease: (_, gesture) => {
|
|
151
|
+
const {
|
|
152
|
+
duration: length,
|
|
153
|
+
player: current
|
|
154
|
+
} = latest.current;
|
|
155
|
+
if (length > 0) void current.seekTo(ratioAt(startX.current + gesture.dx) * length);
|
|
156
|
+
setScrub(null);
|
|
157
|
+
},
|
|
158
|
+
onPanResponderTerminate: () => setScrub(null)
|
|
159
|
+
})).current;
|
|
160
|
+
const displayTime = scrub != null ? scrub * duration : playing ? currentTime : finished ? duration : currentTime || duration;
|
|
161
|
+
// The chip joins once the note was started, so an untouched note shows only its length.
|
|
162
|
+
const showSpeed = speedIndex > 0 || playing || currentTime > 0 && !finished;
|
|
163
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(VoiceNoteLayout, {
|
|
164
|
+
...props,
|
|
165
|
+
playing: playing,
|
|
166
|
+
loading: loading,
|
|
167
|
+
progress: scrub ?? (duration > 0 ? Math.min(1, currentTime / duration) : 0)
|
|
168
|
+
// Nothing to show until the player knows the note's length.
|
|
169
|
+
,
|
|
170
|
+
time: duration > 0 ? (0, _voice.formatVoiceClock)(displayTime) : null,
|
|
171
|
+
onToggle: () => void togglePlay(),
|
|
172
|
+
track: {
|
|
173
|
+
panHandlers: pan.panHandlers,
|
|
174
|
+
onWidth: setTrackWidth
|
|
175
|
+
},
|
|
176
|
+
speed: showSpeed ? {
|
|
177
|
+
value: SPEEDS[speedIndex],
|
|
178
|
+
changed: speedIndex > 0,
|
|
179
|
+
onPress: cycleSpeed
|
|
180
|
+
} : null
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function VoiceNoteLayout({
|
|
184
|
+
seed,
|
|
185
|
+
color,
|
|
186
|
+
onBrandBubble,
|
|
187
|
+
labels,
|
|
188
|
+
playing,
|
|
189
|
+
loading,
|
|
190
|
+
progress,
|
|
191
|
+
time,
|
|
192
|
+
onToggle,
|
|
193
|
+
track,
|
|
194
|
+
speed
|
|
195
|
+
}) {
|
|
196
|
+
const accent = onBrandBubble ? _theme.palette.white : color;
|
|
197
|
+
const onAccent = onBrandBubble ? color : _theme.palette.white;
|
|
198
|
+
const trackColor = onBrandBubble ? (0, _theme.withAlpha)(_theme.palette.white, 0.4) : _theme.palette.disabled;
|
|
199
|
+
const subtle = onBrandBubble ? (0, _theme.withAlpha)(_theme.palette.white, 0.8) : _theme.palette.textMuted;
|
|
200
|
+
const levels = (0, _react.useMemo)(() => (0, _voice.voiceWaveformLevels)(seed, BAR_COUNT), [seed]);
|
|
201
|
+
const [trackWidth, setTrackWidth] = (0, _react.useState)(0);
|
|
202
|
+
const onTrackLayout = event => {
|
|
203
|
+
setTrackWidth(event.nativeEvent.layout.width);
|
|
204
|
+
track?.onWidth(event.nativeEvent.layout.width);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// Bar i's centre sits at this share of the track; the playhead travels the same span.
|
|
208
|
+
const barCentre = i => trackWidth > BAR_WIDTH ? (BAR_WIDTH / 2 + i * (trackWidth - BAR_WIDTH) / (BAR_COUNT - 1)) / trackWidth : i / (BAR_COUNT - 1);
|
|
209
|
+
const knobOffset = trackWidth > 0 ? Math.round(progress * (trackWidth - KNOB_SIZE)) : 0;
|
|
210
|
+
let icon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PlayIcon, {
|
|
211
|
+
size: 14,
|
|
212
|
+
color: onAccent
|
|
213
|
+
});
|
|
214
|
+
if (loading) icon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
|
|
215
|
+
size: "small",
|
|
216
|
+
color: onAccent
|
|
217
|
+
});else if (playing) icon = /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.PauseIcon, {
|
|
218
|
+
size: 14,
|
|
219
|
+
color: onAccent
|
|
220
|
+
});
|
|
221
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
222
|
+
style: styles.root,
|
|
223
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
224
|
+
style: styles.row,
|
|
225
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
226
|
+
onPress: onToggle,
|
|
227
|
+
accessibilityRole: "button",
|
|
228
|
+
accessibilityLabel: playing || loading ? labels.pause : labels.play,
|
|
229
|
+
accessibilityState: {
|
|
230
|
+
busy: loading
|
|
231
|
+
},
|
|
232
|
+
hitSlop: 4,
|
|
233
|
+
style: ({
|
|
234
|
+
pressed
|
|
235
|
+
}) => [styles.playButton, {
|
|
236
|
+
backgroundColor: accent,
|
|
237
|
+
opacity: pressed ? 0.8 : 1
|
|
238
|
+
}],
|
|
239
|
+
children: icon
|
|
240
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
241
|
+
style: styles.track,
|
|
242
|
+
onLayout: onTrackLayout,
|
|
243
|
+
...track?.panHandlers,
|
|
244
|
+
children: [levels.map((level, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
245
|
+
// Touches land on the track itself, so their position is measured from its edge.
|
|
246
|
+
pointerEvents: "none",
|
|
247
|
+
style: [styles.bar, {
|
|
248
|
+
height: BAR_MIN_HEIGHT + level * (BAR_MAX_HEIGHT - BAR_MIN_HEIGHT),
|
|
249
|
+
backgroundColor: barCentre(i) <= progress ? accent : trackColor
|
|
250
|
+
}]
|
|
251
|
+
}, i)), trackWidth > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
252
|
+
pointerEvents: "none",
|
|
253
|
+
style: [styles.knob, {
|
|
254
|
+
backgroundColor: accent,
|
|
255
|
+
transform: [{
|
|
256
|
+
translateX: knobOffset
|
|
257
|
+
}]
|
|
258
|
+
}]
|
|
259
|
+
}) : null]
|
|
260
|
+
})]
|
|
261
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
262
|
+
style: styles.meta,
|
|
263
|
+
children: [time != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
264
|
+
style: [styles.time, {
|
|
265
|
+
color: subtle
|
|
266
|
+
}],
|
|
267
|
+
children: time
|
|
268
|
+
}) : null, speed ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
269
|
+
onPress: speed.onPress,
|
|
270
|
+
accessibilityRole: "button",
|
|
271
|
+
accessibilityLabel: labels.speed,
|
|
272
|
+
hitSlop: 12,
|
|
273
|
+
style: ({
|
|
274
|
+
pressed
|
|
275
|
+
}) => [styles.speed, {
|
|
276
|
+
backgroundColor: speed.changed ? accent : trackColor,
|
|
277
|
+
opacity: pressed ? 0.6 : 1
|
|
278
|
+
}],
|
|
279
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
280
|
+
style: [styles.speedText, {
|
|
281
|
+
color: speed.changed ? onAccent : onBrandBubble ? _theme.palette.white : _theme.palette.text
|
|
282
|
+
}],
|
|
283
|
+
children: [speed.value, "\xD7"]
|
|
284
|
+
})
|
|
285
|
+
}) : null]
|
|
286
|
+
})]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
const styles = _reactNative.StyleSheet.create({
|
|
290
|
+
// A timeline runs left to right in every language, so RTL doesn't mirror it
|
|
291
|
+
// (the touch position and the playhead stay in the same coordinates).
|
|
292
|
+
root: {
|
|
293
|
+
minWidth: 200,
|
|
294
|
+
direction: 'ltr'
|
|
295
|
+
},
|
|
296
|
+
row: {
|
|
297
|
+
flexDirection: 'row',
|
|
298
|
+
alignItems: 'center',
|
|
299
|
+
gap: 10
|
|
300
|
+
},
|
|
301
|
+
playButton: {
|
|
302
|
+
width: BUTTON_SIZE,
|
|
303
|
+
height: BUTTON_SIZE,
|
|
304
|
+
borderRadius: BUTTON_SIZE / 2,
|
|
305
|
+
alignItems: 'center',
|
|
306
|
+
justifyContent: 'center'
|
|
307
|
+
},
|
|
308
|
+
track: {
|
|
309
|
+
flex: 1,
|
|
310
|
+
minWidth: 0,
|
|
311
|
+
height: BUTTON_SIZE,
|
|
312
|
+
flexDirection: 'row',
|
|
313
|
+
alignItems: 'center',
|
|
314
|
+
justifyContent: 'space-between'
|
|
315
|
+
},
|
|
316
|
+
bar: {
|
|
317
|
+
width: BAR_WIDTH,
|
|
318
|
+
borderRadius: BAR_WIDTH / 2
|
|
319
|
+
},
|
|
320
|
+
knob: {
|
|
321
|
+
position: 'absolute',
|
|
322
|
+
left: 0,
|
|
323
|
+
width: KNOB_SIZE,
|
|
324
|
+
height: KNOB_SIZE,
|
|
325
|
+
borderRadius: KNOB_SIZE / 2
|
|
326
|
+
},
|
|
327
|
+
meta: {
|
|
328
|
+
minHeight: 18,
|
|
329
|
+
marginTop: -2,
|
|
330
|
+
marginLeft: BUTTON_SIZE + 10,
|
|
331
|
+
flexDirection: 'row',
|
|
332
|
+
alignItems: 'center',
|
|
333
|
+
gap: 6
|
|
334
|
+
},
|
|
335
|
+
time: {
|
|
336
|
+
fontSize: _theme.fontSize.caption,
|
|
337
|
+
fontWeight: '500',
|
|
338
|
+
fontVariant: ['tabular-nums']
|
|
339
|
+
},
|
|
340
|
+
speed: {
|
|
341
|
+
minWidth: 30,
|
|
342
|
+
height: 18,
|
|
343
|
+
paddingHorizontal: 6,
|
|
344
|
+
borderRadius: 9,
|
|
345
|
+
alignItems: 'center',
|
|
346
|
+
justifyContent: 'center'
|
|
347
|
+
},
|
|
348
|
+
speedText: {
|
|
349
|
+
fontSize: 11,
|
|
350
|
+
fontWeight: '700',
|
|
351
|
+
fontVariant: ['tabular-nums']
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
//# sourceMappingURL=VoiceNote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNative","_voice","_icons","_theme","_jsxRuntime","BAR_COUNT","BAR_WIDTH","BAR_MIN_HEIGHT","BAR_MAX_HEIGHT","BUTTON_SIZE","KNOB_SIZE","SPEEDS","VoiceNote","props","started","setStarted","useState","jsx","ActiveVoiceNote","VoiceNoteLayout","playing","loading","progress","time","onToggle","url","onError","audio","voicePlaybackModule","player","useAudioPlayer","uri","audioPlayerOptions","status","useAudioPlayerStatus","speedIndex","setSpeedIndex","scrub","setScrub","trackWidth","setTrackWidth","wantsPlay","setWantsPlay","releasePlayback","useRef","duration","Math","max","Number","currentTime","finished","didJustFinish","isLoaded","isBuffering","pause","start","current","claimVoicePlayback","play","useEffect","error","togglePlay","seekTo","cycleSpeed","next","length","setPlaybackRate","latest","ratioAt","x","width","min","startX","pan","PanResponder","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onPanResponderGrant","event","nativeEvent","locationX","onPanResponderMove","_","gesture","dx","onPanResponderRelease","onPanResponderTerminate","displayTime","showSpeed","formatVoiceClock","track","panHandlers","onWidth","speed","value","changed","onPress","seed","color","onBrandBubble","labels","accent","palette","white","onAccent","trackColor","withAlpha","disabled","subtle","textMuted","levels","useMemo","voiceWaveformLevels","onTrackLayout","layout","barCentre","i","knobOffset","round","icon","PlayIcon","size","ActivityIndicator","PauseIcon","jsxs","View","style","styles","root","children","row","Pressable","accessibilityRole","accessibilityLabel","accessibilityState","busy","hitSlop","pressed","playButton","backgroundColor","opacity","onLayout","map","level","pointerEvents","bar","height","knob","transform","translateX","meta","Text","speedText","text","StyleSheet","minWidth","direction","flexDirection","alignItems","gap","borderRadius","justifyContent","flex","position","left","minHeight","marginTop","marginLeft","fontSize","caption","fontWeight","fontVariant","paddingHorizontal"],"sourceRoot":"../../../../src","sources":["ui/components/VoiceNote.tsx"],"mappings":";;;;;;AAQA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAWA,IAAAE,MAAA,GAAAF,OAAA;AAOA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAA+D,IAAAK,WAAA,GAAAL,OAAA;AA5B/D;AACA;AACA;AACA;AACA;AACA;AACA;;AA2CA,MAAMM,SAAS,GAAG,EAAE;AACpB,MAAMC,SAAS,GAAG,CAAC;AACnB,MAAMC,cAAc,GAAG,CAAC;AACxB,MAAMC,cAAc,GAAG,EAAE;AACzB,MAAMC,WAAW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AAG;EAAE,CAAC;EACtD8I,IAAI,EAAE;IACJgB,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACP/F,KAAK,EAAE5D,SAAS;IAChByI,MAAM,EAAEzI,SAAS;IACjBuJ,YAAY,EAAEvJ,SAAS,GAAG;EAC5B,CAAC;EACD6I,IAAI,EAAE;IACJe,SAAS,EAAE,EAAE;IACbC,SAAS,EAAE,CAAC,CAAC;IACbC,UAAU,EAAE/J,WAAW,GAAG,EAAE;IAC5BqJ,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE;EACP,CAAC;EACDzI,IAAI,EAAE;IAAEkJ,QAAQ,EAAEA,eAAQ,CAACC,OAAO;IAAEC,UAAU,EAAE,KAAK;IAAEC,WAAW,EAAE,CAAC,cAAc;EAAE,CAAC;EACtF9E,KAAK,EAAE;IACL8D,QAAQ,EAAE,EAAE;IACZT,MAAM,EAAE,EAAE;IACV0B,iBAAiB,EAAE,CAAC;IACpBZ,YAAY,EAAE,CAAC;IACfF,UAAU,EAAE,QAAQ;IACpBG,cAAc,EAAE;EAClB,CAAC;EACDT,SAAS,EAAE;IAAEgB,QAAQ,EAAE,EAAE;IAAEE,UAAU,EAAE,KAAK;IAAEC,WAAW,EAAE,CAAC,cAAc;EAAE;AAC9E,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,7 +13,9 @@ exports.ClockIcon = ClockIcon;
|
|
|
13
13
|
exports.CloseIcon = CloseIcon;
|
|
14
14
|
exports.HomeIcon = HomeIcon;
|
|
15
15
|
exports.PaperclipIcon = PaperclipIcon;
|
|
16
|
+
exports.PauseIcon = PauseIcon;
|
|
16
17
|
exports.PersonIcon = PersonIcon;
|
|
18
|
+
exports.PlayIcon = PlayIcon;
|
|
17
19
|
var _reactNative = require("react-native");
|
|
18
20
|
var _theme = require("../styles/theme.js");
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -93,6 +95,61 @@ function ChevronIcon({
|
|
|
93
95
|
});
|
|
94
96
|
}
|
|
95
97
|
|
|
98
|
+
/** A right-pointing triangle, drawn with borders — a voice note's play button. */
|
|
99
|
+
function PlayIcon({
|
|
100
|
+
size = 16,
|
|
101
|
+
color = _theme.palette.white,
|
|
102
|
+
style
|
|
103
|
+
}) {
|
|
104
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
105
|
+
style: [{
|
|
106
|
+
width: size,
|
|
107
|
+
height: size
|
|
108
|
+
}, styles.center, style],
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
110
|
+
style: {
|
|
111
|
+
width: 0,
|
|
112
|
+
height: 0,
|
|
113
|
+
// The triangle's weight sits left of its box; nudge it to look centred.
|
|
114
|
+
marginLeft: size * 0.12,
|
|
115
|
+
borderLeftWidth: size * 0.72,
|
|
116
|
+
borderTopWidth: size * 0.42,
|
|
117
|
+
borderBottomWidth: size * 0.42,
|
|
118
|
+
borderLeftColor: color,
|
|
119
|
+
borderTopColor: 'transparent',
|
|
120
|
+
borderBottomColor: 'transparent'
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** Two upright bars — a playing voice note's pause button. */
|
|
127
|
+
function PauseIcon({
|
|
128
|
+
size = 16,
|
|
129
|
+
color = _theme.palette.white,
|
|
130
|
+
style
|
|
131
|
+
}) {
|
|
132
|
+
const bar = {
|
|
133
|
+
width: size * 0.26,
|
|
134
|
+
height: size * 0.8,
|
|
135
|
+
borderRadius: 1.5,
|
|
136
|
+
backgroundColor: color
|
|
137
|
+
};
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
139
|
+
style: [{
|
|
140
|
+
width: size,
|
|
141
|
+
height: size,
|
|
142
|
+
flexDirection: 'row',
|
|
143
|
+
gap: size * 0.2
|
|
144
|
+
}, styles.center, style],
|
|
145
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
146
|
+
style: bar
|
|
147
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
148
|
+
style: bar
|
|
149
|
+
})]
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
96
153
|
/** Arrow with a shaft — used for the "start a conversation" affordance. */
|
|
97
154
|
function ArrowRightIcon({
|
|
98
155
|
size = 16,
|