mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-18 16:29:43 +02:00
style: auto-format codebase with Prettier
Applied formatting to 1487+ files using pnpm format:write - TypeScript/JavaScript files - Svelte components - Astro pages - JSON configs - Markdown docs 13 files still need manual review (Astro JSX comments)
This commit is contained in:
parent
0241f5554c
commit
d36b321d9d
3952 changed files with 661498 additions and 739751 deletions
|
|
@ -7,23 +7,23 @@ import ContextMenu from 'react-native-context-menu-view';
|
|||
import { View, Text, Image } from 'react-native';
|
||||
|
||||
function BasicExample() {
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save', systemIcon: 'square.and.arrow.down' },
|
||||
{ title: 'Share', systemIcon: 'square.and.arrow.up' },
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' }
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action pressed:', e.nativeEvent.name);
|
||||
// Handle action based on e.nativeEvent.index or e.nativeEvent.name
|
||||
}}
|
||||
>
|
||||
<View className="p-4 bg-gray-100 rounded-lg">
|
||||
<Text>Long press me!</Text>
|
||||
</View>
|
||||
</ContextMenu>
|
||||
);
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save', systemIcon: 'square.and.arrow.down' },
|
||||
{ title: 'Share', systemIcon: 'square.and.arrow.up' },
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' },
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action pressed:', e.nativeEvent.name);
|
||||
// Handle action based on e.nativeEvent.index or e.nativeEvent.name
|
||||
}}
|
||||
>
|
||||
<View className="p-4 bg-gray-100 rounded-lg">
|
||||
<Text>Long press me!</Text>
|
||||
</View>
|
||||
</ContextMenu>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -33,31 +33,31 @@ function BasicExample() {
|
|||
import ContextMenu from 'react-native-context-menu-view';
|
||||
|
||||
function SubmenuExample() {
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save', systemIcon: 'square.and.arrow.down' },
|
||||
{
|
||||
title: 'Export',
|
||||
systemIcon: 'square.and.arrow.up.on.square',
|
||||
// Nested submenu actions
|
||||
actions: [
|
||||
{ title: 'Export as PDF', systemIcon: 'doc.fill' },
|
||||
{ title: 'Export as Image', systemIcon: 'photo' },
|
||||
{ title: 'Export as Video', systemIcon: 'video' }
|
||||
]
|
||||
},
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' }
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action:', e.nativeEvent.name);
|
||||
}}
|
||||
>
|
||||
<View className="p-4 bg-blue-100 rounded-lg">
|
||||
<Text>Long press for submenu!</Text>
|
||||
</View>
|
||||
</ContextMenu>
|
||||
);
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save', systemIcon: 'square.and.arrow.down' },
|
||||
{
|
||||
title: 'Export',
|
||||
systemIcon: 'square.and.arrow.up.on.square',
|
||||
// Nested submenu actions
|
||||
actions: [
|
||||
{ title: 'Export as PDF', systemIcon: 'doc.fill' },
|
||||
{ title: 'Export as Image', systemIcon: 'photo' },
|
||||
{ title: 'Export as Video', systemIcon: 'video' },
|
||||
],
|
||||
},
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' },
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action:', e.nativeEvent.name);
|
||||
}}
|
||||
>
|
||||
<View className="p-4 bg-blue-100 rounded-lg">
|
||||
<Text>Long press for submenu!</Text>
|
||||
</View>
|
||||
</ContextMenu>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -67,24 +67,21 @@ function SubmenuExample() {
|
|||
import ContextMenu from 'react-native-context-menu-view';
|
||||
|
||||
function PreviewExample() {
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Edit', systemIcon: 'pencil' },
|
||||
{ title: 'Duplicate', systemIcon: 'plus.square.on.square' },
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' }
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action:', e.nativeEvent.name);
|
||||
}}
|
||||
previewBackgroundColor="white"
|
||||
>
|
||||
<Image
|
||||
source={{ uri: 'https://example.com/image.jpg' }}
|
||||
className="w-full h-48 rounded-lg"
|
||||
/>
|
||||
</ContextMenu>
|
||||
);
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Edit', systemIcon: 'pencil' },
|
||||
{ title: 'Duplicate', systemIcon: 'plus.square.on.square' },
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' },
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action:', e.nativeEvent.name);
|
||||
}}
|
||||
previewBackgroundColor="white"
|
||||
>
|
||||
<Image source={{ uri: 'https://example.com/image.jpg' }} className="w-full h-48 rounded-lg" />
|
||||
</ContextMenu>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -96,57 +93,53 @@ import * as MediaLibrary from 'expo-media-library';
|
|||
import * as FileSystem from 'expo-file-system';
|
||||
|
||||
function GeneratedImageMenu({ imageUrl }: { imageUrl: string }) {
|
||||
const handleSave = async () => {
|
||||
// Request permissions
|
||||
const { status } = await MediaLibrary.requestPermissionsAsync();
|
||||
if (status !== 'granted') {
|
||||
alert('Permission required to save images');
|
||||
return;
|
||||
}
|
||||
const handleSave = async () => {
|
||||
// Request permissions
|
||||
const { status } = await MediaLibrary.requestPermissionsAsync();
|
||||
if (status !== 'granted') {
|
||||
alert('Permission required to save images');
|
||||
return;
|
||||
}
|
||||
|
||||
// Download and save image
|
||||
const fileUri = FileSystem.documentDirectory + 'generated-image.jpg';
|
||||
await FileSystem.downloadAsync(imageUrl, fileUri);
|
||||
await MediaLibrary.createAssetAsync(fileUri);
|
||||
alert('Image saved!');
|
||||
};
|
||||
// Download and save image
|
||||
const fileUri = FileSystem.documentDirectory + 'generated-image.jpg';
|
||||
await FileSystem.downloadAsync(imageUrl, fileUri);
|
||||
await MediaLibrary.createAssetAsync(fileUri);
|
||||
alert('Image saved!');
|
||||
};
|
||||
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save to Photos', systemIcon: 'square.and.arrow.down' },
|
||||
{ title: 'Share', systemIcon: 'square.and.arrow.up' },
|
||||
{
|
||||
title: 'More Options',
|
||||
actions: [
|
||||
{ title: 'Set as Wallpaper', systemIcon: 'photo.on.rectangle' },
|
||||
{ title: 'Copy', systemIcon: 'doc.on.doc' },
|
||||
{ title: 'View Details', systemIcon: 'info.circle' }
|
||||
]
|
||||
},
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' }
|
||||
]}
|
||||
onPress={(e) => {
|
||||
switch(e.nativeEvent.index) {
|
||||
case 0: // Save to Photos
|
||||
handleSave();
|
||||
break;
|
||||
case 1: // Share
|
||||
// Implement share
|
||||
break;
|
||||
case 2: // Delete
|
||||
// Implement delete
|
||||
break;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
source={{ uri: imageUrl }}
|
||||
className="w-full h-full rounded-lg"
|
||||
resizeMode="cover"
|
||||
/>
|
||||
</ContextMenu>
|
||||
);
|
||||
return (
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save to Photos', systemIcon: 'square.and.arrow.down' },
|
||||
{ title: 'Share', systemIcon: 'square.and.arrow.up' },
|
||||
{
|
||||
title: 'More Options',
|
||||
actions: [
|
||||
{ title: 'Set as Wallpaper', systemIcon: 'photo.on.rectangle' },
|
||||
{ title: 'Copy', systemIcon: 'doc.on.doc' },
|
||||
{ title: 'View Details', systemIcon: 'info.circle' },
|
||||
],
|
||||
},
|
||||
{ title: 'Delete', destructive: true, systemIcon: 'trash' },
|
||||
]}
|
||||
onPress={(e) => {
|
||||
switch (e.nativeEvent.index) {
|
||||
case 0: // Save to Photos
|
||||
handleSave();
|
||||
break;
|
||||
case 1: // Share
|
||||
// Implement share
|
||||
break;
|
||||
case 2: // Delete
|
||||
// Implement delete
|
||||
break;
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Image source={{ uri: imageUrl }} className="w-full h-full rounded-lg" resizeMode="cover" />
|
||||
</ContextMenu>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -154,13 +147,13 @@ function GeneratedImageMenu({ imageUrl }: { imageUrl: string }) {
|
|||
|
||||
```tsx
|
||||
interface Action {
|
||||
title: string; // Action title
|
||||
systemIcon?: string; // SF Symbol name (iOS only)
|
||||
icon?: string; // Custom icon (Android)
|
||||
destructive?: boolean; // Red text for destructive actions
|
||||
disabled?: boolean; // Disable the action
|
||||
inlineChildren?: boolean; // Show submenu items inline
|
||||
actions?: Action[]; // Nested submenu actions
|
||||
title: string; // Action title
|
||||
systemIcon?: string; // SF Symbol name (iOS only)
|
||||
icon?: string; // Custom icon (Android)
|
||||
destructive?: boolean; // Red text for destructive actions
|
||||
disabled?: boolean; // Disable the action
|
||||
inlineChildren?: boolean; // Show submenu items inline
|
||||
actions?: Action[]; // Nested submenu actions
|
||||
}
|
||||
```
|
||||
|
||||
|
|
@ -185,16 +178,16 @@ The library also works on Android with Material Design menus:
|
|||
|
||||
```tsx
|
||||
<ContextMenu
|
||||
actions={[
|
||||
{ title: 'Save', icon: 'save' }, // Use Android icon names
|
||||
{ title: 'Share', icon: 'share' },
|
||||
{ title: 'Delete', destructive: true, icon: 'delete' }
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action:', e.nativeEvent.index);
|
||||
}}
|
||||
actions={[
|
||||
{ title: 'Save', icon: 'save' }, // Use Android icon names
|
||||
{ title: 'Share', icon: 'share' },
|
||||
{ title: 'Delete', destructive: true, icon: 'delete' },
|
||||
]}
|
||||
onPress={(e) => {
|
||||
console.log('Action:', e.nativeEvent.index);
|
||||
}}
|
||||
>
|
||||
<YourComponent />
|
||||
<YourComponent />
|
||||
</ContextMenu>
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue