@churchapps/apphelper 0.4.8 → 0.4.9
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/b1app-specific-components.md +146 -0
- package/component-usage-analysis.md +169 -0
- package/dist/components/ImageEditor.d.ts +1 -1
- package/dist/components/ImageEditor.d.ts.map +1 -1
- package/dist/components/ImageEditor.js +1 -1
- package/dist/components/ImageEditor.js.map +1 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/markdownEditor/IconNamesList.d.ts.map +1 -0
- package/dist/components/markdownEditor/IconNamesList.js +16 -0
- package/dist/components/markdownEditor/IconNamesList.js.map +1 -0
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.js +1 -1
- package/dist/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.js.map +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.js +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiNodeTransform.js.map +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.js +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.js.map +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.js +1 -1
- package/dist/components/markdownEditor/plugins/emoji/EmojisPlugin.js.map +1 -1
- package/dist/components/notes/index.d.ts +0 -2
- package/dist/components/notes/index.d.ts.map +1 -1
- package/dist/components/notes/index.js +1 -5
- package/dist/components/notes/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ImageEditor.tsx +1 -1
- package/src/components/index.tsx +0 -3
- package/src/components/markdownEditor/IconNamesList.ts +14 -0
- package/src/components/markdownEditor/plugins/customLink/CustomLinkNodeTransformer.tsx +1 -1
- package/src/components/markdownEditor/plugins/emoji/EmojiNodeTransform.ts +1 -1
- package/src/components/markdownEditor/plugins/emoji/EmojiPickerPlugin.tsx +1 -1
- package/src/components/markdownEditor/plugins/emoji/EmojisPlugin.tsx +1 -1
- package/src/components/notes/index.ts +0 -2
- package/dist/components/B1ShareModal.d.ts +0 -9
- package/dist/components/B1ShareModal.d.ts.map +0 -1
- package/dist/components/B1ShareModal.js +0 -77
- package/dist/components/B1ShareModal.js.map +0 -1
- package/dist/components/gallery/GalleryModal.d.ts +0 -9
- package/dist/components/gallery/GalleryModal.d.ts.map +0 -1
- package/dist/components/gallery/GalleryModal.js +0 -111
- package/dist/components/gallery/GalleryModal.js.map +0 -1
- package/dist/components/gallery/StockPhotos.d.ts +0 -9
- package/dist/components/gallery/StockPhotos.d.ts.map +0 -1
- package/dist/components/gallery/StockPhotos.js +0 -79
- package/dist/components/gallery/StockPhotos.js.map +0 -1
- package/dist/components/gallery/index.d.ts +0 -2
- package/dist/components/gallery/index.d.ts.map +0 -1
- package/dist/components/gallery/index.js +0 -6
- package/dist/components/gallery/index.js.map +0 -1
- package/dist/components/iconPicker/IconNamesList.d.ts.map +0 -1
- package/dist/components/iconPicker/IconNamesList.js +0 -2241
- package/dist/components/iconPicker/IconNamesList.js.map +0 -1
- package/dist/components/iconPicker/IconPicker.d.ts +0 -6
- package/dist/components/iconPicker/IconPicker.d.ts.map +0 -1
- package/dist/components/iconPicker/IconPicker.js +0 -142
- package/dist/components/iconPicker/IconPicker.js.map +0 -1
- package/dist/components/notes/Conversation.d.ts +0 -10
- package/dist/components/notes/Conversation.d.ts.map +0 -1
- package/dist/components/notes/Conversation.js +0 -55
- package/dist/components/notes/Conversation.js.map +0 -1
- package/dist/components/notes/Conversations.d.ts +0 -10
- package/dist/components/notes/Conversations.d.ts.map +0 -1
- package/dist/components/notes/Conversations.js +0 -54
- package/dist/components/notes/Conversations.js.map +0 -1
- package/dist/components/notes/NewConversation.d.ts +0 -12
- package/dist/components/notes/NewConversation.d.ts.map +0 -1
- package/dist/components/notes/NewConversation.js +0 -54
- package/dist/components/notes/NewConversation.js.map +0 -1
- package/src/components/B1ShareModal.tsx +0 -104
- package/src/components/gallery/GalleryModal.tsx +0 -139
- package/src/components/gallery/StockPhotos.tsx +0 -75
- package/src/components/gallery/index.ts +0 -1
- package/src/components/iconPicker/IconNamesList.ts +0 -2240
- package/src/components/iconPicker/IconPicker.tsx +0 -160
- package/src/components/notes/Conversation.tsx +0 -84
- package/src/components/notes/Conversations.tsx +0 -60
- package/src/components/notes/NewConversation.tsx +0 -80
- /package/dist/components/{iconPicker → markdownEditor}/IconNamesList.d.ts +0 -0
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import { FileHelper, ApiHelper, Locale } from "../../helpers";
|
|
4
|
-
import { CommonEnvironmentHelper } from "../../helpers/CommonEnvironmentHelper";
|
|
5
|
-
import { } from "../../helpers";
|
|
6
|
-
import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, FormControl, Grid, IconButton, InputLabel, MenuItem, Select, Tab, Tabs, Tooltip, Icon } from "@mui/material";
|
|
7
|
-
import React, { useState } from "react";
|
|
8
|
-
import { ImageEditor } from "../ImageEditor";
|
|
9
|
-
import { TabPanel } from "../TabPanel";
|
|
10
|
-
import { StockPhotos } from "./StockPhotos";
|
|
11
|
-
|
|
12
|
-
interface Props {
|
|
13
|
-
aspectRatio: number,
|
|
14
|
-
onClose: () => void,
|
|
15
|
-
onSelect: (img: string) => void
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const GalleryModal: React.FC<Props> = (props: Props) => {
|
|
19
|
-
const [images, setImages] = useState<string[]>([]);
|
|
20
|
-
const [tabIndex, setTabIndex] = React.useState(0);
|
|
21
|
-
const [aspectRatio, setAspectRatio] = React.useState(Math.round(props.aspectRatio * 100) / 100);
|
|
22
|
-
const [editorPhotoUrl, setEditorPhotoUrl] = React.useState("");
|
|
23
|
-
|
|
24
|
-
const handleTabChange = (el: any, newValue: any) => { setTabIndex(newValue); }
|
|
25
|
-
|
|
26
|
-
const loadData = () => { ApiHelper.get("/gallery/" + aspectRatio.toString(), "ContentApi").then(data => setImages(data.images)); }
|
|
27
|
-
|
|
28
|
-
const handleImageUpdated = async (dataUrl: string) => {
|
|
29
|
-
const fileName = Math.floor(Date.now() / 1000).toString() + ".jpg"
|
|
30
|
-
const blob = FileHelper.dataURLtoBlob(dataUrl);
|
|
31
|
-
const file = new File([blob], "file_name");
|
|
32
|
-
|
|
33
|
-
const params = { folder: aspectRatio.toString(), fileName };
|
|
34
|
-
const presigned = await ApiHelper.post("/gallery/requestUpload", params, "ContentApi");
|
|
35
|
-
const doUpload = presigned.key !== undefined;
|
|
36
|
-
if (doUpload) await FileHelper.postPresignedFile(presigned, file, () => { });
|
|
37
|
-
//return doUpload;
|
|
38
|
-
setTabIndex(0);
|
|
39
|
-
loadData();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const handleDelete = (folder: string, image: string) => {
|
|
43
|
-
if (window.confirm(Locale.label("gallery.confirmDelete"))){
|
|
44
|
-
ApiHelper.delete("/gallery/" + folder + "/" + image, "ContentApi").then(() => { loadData(); });
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
React.useEffect(() => { if (aspectRatio !== props.aspectRatio) setAspectRatio(Math.round(props.aspectRatio * 100) / 100) }, [props.aspectRatio]); //eslint-disable-line
|
|
49
|
-
React.useEffect(loadData, [aspectRatio]); //eslint-disable-line
|
|
50
|
-
|
|
51
|
-
const getImages = () => {
|
|
52
|
-
let result: React.ReactElement[] = [];
|
|
53
|
-
images.forEach(img => {
|
|
54
|
-
const parts = img.split("/");
|
|
55
|
-
|
|
56
|
-
result.push(<Grid size={{ xs: 12, md: 4 }}>
|
|
57
|
-
<Box sx={{ position: "relative", ":hover #deleteIcon": { visibility: "visible" } }}>
|
|
58
|
-
<a href="about:blank" onClick={(e) => { e.preventDefault(); props.onSelect(CommonEnvironmentHelper.ContentRoot + "/" + img) }} aria-label="Select image" data-testid="select-image">
|
|
59
|
-
<Box component="img" src={CommonEnvironmentHelper.ContentRoot + "/" + img} className="img-fluid" alt="custom" />
|
|
60
|
-
</a>
|
|
61
|
-
<Box id="deleteIcon" sx={{ position: "absolute", top: 3, right: 3, visibility: "hidden", backgroundColor: "whitesmoke", borderRadius: 5 }}>
|
|
62
|
-
<Tooltip title="Delete">
|
|
63
|
-
<IconButton size="small" color="error" onClick={() => handleDelete(parts[2], parts[3])} aria-label="Delete image" data-testid="delete-image">
|
|
64
|
-
<Icon sx={{ fontSize: "17px !important" }}>delete_outline</Icon>
|
|
65
|
-
</IconButton>
|
|
66
|
-
</Tooltip>
|
|
67
|
-
</Box>
|
|
68
|
-
</Box>
|
|
69
|
-
</Grid>);
|
|
70
|
-
})
|
|
71
|
-
return result;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const handleStockSelect = (url: string) => {
|
|
75
|
-
setEditorPhotoUrl(url);
|
|
76
|
-
setTabIndex(1);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const getDisplayAspect = () => {
|
|
80
|
-
let result = aspectRatio.toString();
|
|
81
|
-
if (aspectRatio === 0) result = "Free Form";
|
|
82
|
-
else if (aspectRatio === 1) result = "1:1";
|
|
83
|
-
else if (aspectRatio === 2) result = "2:1";
|
|
84
|
-
else if (aspectRatio === 3) result = "3:1";
|
|
85
|
-
else if (aspectRatio === 4) result = "4:1";
|
|
86
|
-
else if (aspectRatio === 1.33) result = "4:3";
|
|
87
|
-
else if (aspectRatio === 1.78) result = "16:9";
|
|
88
|
-
else if (aspectRatio === 0.5) result = "1:2";
|
|
89
|
-
else if (aspectRatio === 0.5625) result = "9:16";
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return (<>
|
|
94
|
-
<Dialog open={true} onClose={props.onClose}>
|
|
95
|
-
<DialogTitle>Select a Photo</DialogTitle>
|
|
96
|
-
<DialogContent style={{ overflowX: "hidden" }}>
|
|
97
|
-
|
|
98
|
-
{(props.aspectRatio === 0) && (
|
|
99
|
-
<FormControl fullWidth>
|
|
100
|
-
<InputLabel>{Locale.label("gallery.aspectRatio")}</InputLabel>
|
|
101
|
-
<Select size="small" label={Locale.label("gallery.aspectRatio")} name="aspectRatio" value={aspectRatio} onChange={(e) => setAspectRatio(parseFloat(e.target.value.toString()))}>
|
|
102
|
-
<MenuItem value="0">{Locale.label("gallery.freeForm")}</MenuItem>
|
|
103
|
-
<MenuItem value="1">1:1</MenuItem>
|
|
104
|
-
<MenuItem value="2">2:1</MenuItem>
|
|
105
|
-
<MenuItem value="3">3:1</MenuItem>
|
|
106
|
-
<MenuItem value="4">4:1</MenuItem>
|
|
107
|
-
<MenuItem value="1.33">4:3</MenuItem>
|
|
108
|
-
<MenuItem value="1.78">16:9</MenuItem>
|
|
109
|
-
<MenuItem value="0.5">1:2</MenuItem>
|
|
110
|
-
<MenuItem value="0.5625">9:16</MenuItem>
|
|
111
|
-
</Select>
|
|
112
|
-
</FormControl>
|
|
113
|
-
)}
|
|
114
|
-
|
|
115
|
-
<Tabs variant="fullWidth" value={tabIndex} onChange={handleTabChange}>
|
|
116
|
-
<Tab label="Gallery" />
|
|
117
|
-
<Tab label="Upload" />
|
|
118
|
-
<Tab label="Stock Photos" />
|
|
119
|
-
</Tabs>
|
|
120
|
-
<TabPanel value={tabIndex} index={0}>
|
|
121
|
-
|
|
122
|
-
<Grid container spacing={3} alignItems="center">
|
|
123
|
-
{getImages()}
|
|
124
|
-
</Grid>
|
|
125
|
-
</TabPanel>
|
|
126
|
-
<TabPanel value={tabIndex} index={1}>
|
|
127
|
-
<div>{Locale.label("gallery.aspectRatio")}: {getDisplayAspect()}</div>
|
|
128
|
-
<ImageEditor onUpdate={handleImageUpdated} photoUrl={editorPhotoUrl} aspectRatio={aspectRatio} outputWidth={1280} outputHeight={768} hideDelete={true} />
|
|
129
|
-
</TabPanel>
|
|
130
|
-
<TabPanel value={tabIndex} index={2}>
|
|
131
|
-
<StockPhotos aspectRatio={aspectRatio} onSelect={props.onSelect} onStockSelect={handleStockSelect} />
|
|
132
|
-
</TabPanel>
|
|
133
|
-
</DialogContent>
|
|
134
|
-
<DialogActions sx={{ paddingX: "16px", paddingBottom: "12px" }}>
|
|
135
|
-
<Button variant="outlined" onClick={props.onClose}>Close</Button>
|
|
136
|
-
</DialogActions>
|
|
137
|
-
</Dialog>
|
|
138
|
-
</>);
|
|
139
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Button, Grid, TextField } from "@mui/material";
|
|
3
|
-
import React, { useState } from "react";
|
|
4
|
-
import { ApiHelper, Locale } from "../../helpers";
|
|
5
|
-
import { CommonEnvironmentHelper } from "../../helpers/CommonEnvironmentHelper";
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
aspectRatio: number,
|
|
9
|
-
onSelect: (img: string) => void,
|
|
10
|
-
onStockSelect: (img: string) => void
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface SearchResult { description: string, url: string, photographer: string, photographerUrl: string, large: string, thumbnail: string }
|
|
14
|
-
|
|
15
|
-
export const StockPhotos: React.FC<Props> = (props: Props) => {
|
|
16
|
-
const [images, setImages] = useState<string[]>([]);
|
|
17
|
-
const [searchText, setSearchText] = useState("");
|
|
18
|
-
const [searchResults, setSearchResults] = useState<SearchResult[]>(null);
|
|
19
|
-
|
|
20
|
-
const loadData = () => { ApiHelper.getAnonymous("/gallery/stock/" + props.aspectRatio.toString(), "ContentApi").then(data => setImages(data.images)); }
|
|
21
|
-
|
|
22
|
-
React.useEffect(loadData, [props.aspectRatio]); //eslint-disable-line
|
|
23
|
-
|
|
24
|
-
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { e.preventDefault(); setSearchText(e.currentTarget.value); }
|
|
25
|
-
|
|
26
|
-
const handleSearch = (e: React.MouseEvent) => {
|
|
27
|
-
if (e !== null) e.preventDefault();
|
|
28
|
-
let term = searchText.trim();
|
|
29
|
-
ApiHelper.post("/stock/search", { term: term }, "ContentApi").then((data: SearchResult[]) => { setSearchResults(data) });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const getImages = () => {
|
|
33
|
-
if (searchResults) return getResults();
|
|
34
|
-
else return getSuggested();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const getResults = () => {
|
|
38
|
-
let result: React.ReactElement[] = [];
|
|
39
|
-
searchResults.forEach(p => {
|
|
40
|
-
result.push(<Grid size={{ xs: 12, md: 4 }}>
|
|
41
|
-
<a href="about:blank" onClick={(e) => { e.preventDefault(); props.onStockSelect(p.large) }}>
|
|
42
|
-
<img src={p.thumbnail} className="img-fluid" alt="stock" />
|
|
43
|
-
</a>
|
|
44
|
-
<div>
|
|
45
|
-
<i style={{ fontSize: 12 }}>
|
|
46
|
-
<a href={p.url} target="_blank" rel="noreferrer noopener">{Locale.label("stockPhotos.photoBy")}</a> <a href={p.photographerUrl} target="_blank" rel="noreferrer noopener">{p.photographer}</a></i>
|
|
47
|
-
</div>
|
|
48
|
-
</Grid>);
|
|
49
|
-
})
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const getSuggested = () => {
|
|
54
|
-
let result: React.ReactElement[] = [];
|
|
55
|
-
images.forEach(img => {
|
|
56
|
-
result.push(<Grid size={{ xs: 12, md: 4 }}>
|
|
57
|
-
<a href="about:blank" onClick={(e) => { e.preventDefault(); props.onSelect(CommonEnvironmentHelper.ContentRoot + "/" + img) }}>
|
|
58
|
-
<img src={CommonEnvironmentHelper.ContentRoot + "/" + img} className="img-fluid" alt="stock" />
|
|
59
|
-
</a>
|
|
60
|
-
</Grid>);
|
|
61
|
-
})
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (<>
|
|
66
|
-
<TextField fullWidth name="personAddText" label="Search Term" value={searchText} onChange={handleChange}
|
|
67
|
-
InputProps={{ endAdornment: <Button variant="contained" id="searchButton" data-testid="search-button" onClick={handleSearch}>Search</Button> }}
|
|
68
|
-
/>
|
|
69
|
-
{searchResults && <div>{Locale.label("stockPhotos.providedBy")} <a href="https://pexels.com">Pexels</a>.</div>}
|
|
70
|
-
<Grid container spacing={3} alignItems="center">
|
|
71
|
-
{getImages()}
|
|
72
|
-
</Grid>
|
|
73
|
-
|
|
74
|
-
</>);
|
|
75
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { GalleryModal } from "./GalleryModal";
|