Skip to content

Commit

Permalink
style: fix the border radius and translate the error message (#463)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingwanying authored Nov 12, 2024
1 parent 562c258 commit 247ed72
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/components/AddBotCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const AddBotCard = (props: { onPress: Function }) => {
props.onPress();
}}
>
<CardBody className="overflow-visible p-0 bg-gradient-to-b from-[rgba(255,255,255,0.65)] to-white bg-[#F3F4F6] h-[400px] flex justify-center items-center rounded-[8px]">
<CardBody className="overflow-visible p-0 bg-gradient-to-b from-[rgba(255,255,255,0.65)] to-white bg-[#F3F4F6] h-[400px] flex justify-center items-center rounded-[16px]">
<AddBotIcon className="" />
</CardBody>
</BaseBotCard>
Expand Down
2 changes: 1 addition & 1 deletion client/components/BaseBotCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const BaseBotCard = (props: {
}) => {
return (
<Card
className="border-none w-full max-h-[400px] bg-[#FFF] rounded-[16px] p-2 h-[384px] rounded-[8px]"
className="border-none w-full max-h-[400px] bg-[#FFF] rounded-[16px] p-2 h-[384px] rounded-[16px]"
shadow="none"
isPressable
onPress={() => {
Expand Down
40 changes: 29 additions & 11 deletions server/bot/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ async def create_bot(
res = await bot_builder(user_id, **filtered_bot_data)
if not res:
return JSONResponse(
content={"success": False, "errorMessage": "仓库不存在,生成失败"},
content={
"success": False,
"errorMessage": "Repository does not exist, generation failed.",
},
status_code=500,
)
return res
Expand All @@ -138,7 +141,10 @@ async def bot_generator(
res = await bot_info_generator(user_id, **bot_data.model_dump())
if not res:
return JSONResponse(
content={"success": False, "errorMessage": "仓库不存在,生成失败"}
content={
"success": False,
"errorMessage": "Repository does not exist, generation failed.",
}
)
return JSONResponse(content={"success": True, "data": res})
except Exception as e:
Expand All @@ -165,7 +171,7 @@ def update_bot(
}
if not update_fields:
return JSONResponse(
content={"success": False, "errorMessage": "No fields to update"},
content={"success": False, "errorMessage": "No fields to update."},
status_code=400,
)

Expand All @@ -180,7 +186,10 @@ def update_bot(

if not response.data:
return JSONResponse(
content={"success": False, "errorMessage": "bot 不存在,更新失败"}
content={
"success": False,
"errorMessage": "Bot does not exist, update failed.",
}
)

return JSONResponse(content={"success": True})
Expand All @@ -202,7 +211,10 @@ async def delete_bot(
)
if not response.data:
return JSONResponse(
content={"success": False, "errorMessage": "bot 不存在,删除失败"}
content={
"success": False,
"errorMessage": "Bot does not exist, delete failed.",
}
)
return JSONResponse(content={"success": True})
except Exception as e:
Expand All @@ -221,22 +233,25 @@ async def deploy_bot_to_market(
return JSONResponse(
content={
"success": False,
"errorMessage": "您必须先使用 GitHub 登录 Petercat 才能使用此功能。",
"errorMessage": "You must first log in to Petercat with GitHub before you can use this function.",
},
status_code=500,
)
bot_dao = BotDAO()
bot = bot_dao.get_bot(bot_id)
if not bot:
return JSONResponse(
content={"success": False, "errorMessage": "机器人不存在,无法操作"},
content={
"success": False,
"errorMessage": "Bot does not exist, cannot perform operation.",
},
status_code=500,
)
if bot.public:
return JSONResponse(
content={
"success": False,
"errorMessage": "机器人已公开,无需重复操作",
"errorMessage": "Bot is already public, no need to repeat the operation.",
},
status_code=500,
)
Expand Down Expand Up @@ -283,22 +298,25 @@ async def unPublic_bot_from_market(
return JSONResponse(
content={
"success": False,
"errorMessage": "您必须先使用 GitHub 登录 Petercat 才能使用此功能。",
"errorMessage": "You must first log in to Petercat with GitHub before you can use this function.",
},
status_code=500,
)
bot_dao = BotDAO()
bot = bot_dao.get_bot(bot_id)
if not bot:
return JSONResponse(
content={"success": False, "errorMessage": "机器人不存在,无法操作"},
content={
"success": False,
"errorMessage": "Bot does not exist, cannot perform operation.",
},
status_code=500,
)
if not bot["public"]:
return JSONResponse(
content={
"success": False,
"errorMessage": "机器人未公开,无需重复操作",
"errorMessage": "Bot is already public, no need to repeat the operation.",
},
status_code=500,
)
Expand Down

0 comments on commit 247ed72

Please sign in to comment.