-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
249 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 交流群 | ||
|
||
## Telegram交流群 | ||
|
||
群组链接:[https://t.me/SocialMediaCopilot](https://t.me/SocialMediaCopilot) | ||
|
||
## QQ交流群 | ||
|
||
<img width="400px" src="images/qq-group-qr-code.png" /> | ||
|
||
## 微信交流群 | ||
|
||
<img width="400px" src="images/wechat-group-qr-code.png" /> | ||
|
||
> 如二维码已失效,可加作者微信。记得备注来意 | ||
<img width="400px" src="../src/assets/images/wechat-qr-code.png" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "social-media-copilot", | ||
"private": true, | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"type": "module", | ||
"author": "Andy Zhou <[email protected]>", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form"; | ||
import { ControllerProps, FieldPath, FieldValues } from "react-hook-form"; | ||
import { Checkbox } from "@/components/ui/checkbox"; | ||
|
||
export const MaterialTypesFormField = < | ||
TFieldValues extends FieldValues = FieldValues, | ||
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues> | ||
>(props: Omit<ControllerProps<TFieldValues, TName>, "render"> & { | ||
items: { value: string, label: string, required?: boolean }[] | ||
}) => { | ||
const { items, ...restProps } = props; | ||
return ( | ||
<FormField | ||
{...restProps} | ||
render={({ field }) => { | ||
const [needMaterial, setNeedMaterial] = useState<boolean | 'indeterminate'>(false); | ||
useEffect(() => { | ||
if (!needMaterial) { | ||
field.onChange([]); | ||
return; | ||
} | ||
field.onChange(items.filter((item) => item.required).map((item) => item.value)); | ||
}, [needMaterial]) | ||
|
||
return ( | ||
<FormItem> | ||
<div className="flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4 shadow mb-4"> | ||
<Checkbox | ||
checked={needMaterial} | ||
onCheckedChange={setNeedMaterial} | ||
/> | ||
<div className="space-y-1 leading-none"> | ||
<FormLabel>同时导出素材</FormLabel> | ||
<FormDescription> | ||
{import.meta.env.EDGE ? "请确认Edge下载设置中的”每次下载都询问我该做些什么“选项处于关闭状态。否则,下载区域会弹出很多“打开”和“另存为”的选项按钮。" : "请确认Chrome下载设置中的”下载前询问每个文件的保存位置“选项未被选中。否则,会弹出很多“另存为”对话框。"} | ||
</FormDescription> | ||
</div> | ||
</div> | ||
{needMaterial && <div className="mr-4 flex items-center space-x-4"> | ||
<FormLabel>素材类型</FormLabel> | ||
{items.map((item) => ( | ||
<FormField | ||
key={item.value} | ||
{...restProps} | ||
render={() => { | ||
return ( | ||
<FormItem | ||
key={field.value} | ||
className="flex items-center space-x-2 space-y-0" | ||
> | ||
<FormControl> | ||
<Checkbox | ||
disabled={item.required} | ||
checked={field.value?.includes(item.value)} | ||
onCheckedChange={(checked) => { | ||
return checked | ||
? field.onChange([...field.value, item.value]) | ||
: field.onChange( | ||
field.value?.filter( | ||
(value: string) => value !== item.value | ||
) | ||
) | ||
}} | ||
/> | ||
</FormControl> | ||
<FormLabel className="text-sm font-normal">{item.label}</FormLabel> | ||
</FormItem> | ||
) | ||
}} | ||
/> | ||
))} | ||
</div>} | ||
<FormMessage /> | ||
</FormItem> | ||
) | ||
}} | ||
/>) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.