Explorar el Código

edit button i18n

visuddhinanda hace 3 años
padre
commit
9e5e21356a

+ 52 - 14
dashboard/src/pages/studio/anthology/list.tsx

@@ -56,14 +56,18 @@ const Widget = () => {
 			<ProTable<IItem>
 				columns={[
 					{
-						title: intl.formatMessage({ id: "dict.fields.sn.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.sn.label",
+						}),
 						dataIndex: "id",
 						key: "id",
 						width: 50,
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.title.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.title.label",
+						}),
 						dataIndex: "title",
 						key: "title",
 						tip: "过长会自动收缩",
@@ -80,7 +84,9 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.power.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.power.label",
+						}),
 						dataIndex: "tag",
 						key: "tag",
 						width: 100,
@@ -95,7 +101,9 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "article.fields.article.count.label" }),
+						title: intl.formatMessage({
+							id: "article.fields.article.count.label",
+						}),
 						dataIndex: "articles",
 						key: "articles",
 						width: 100,
@@ -103,7 +111,9 @@ const Widget = () => {
 						sorter: (a, b) => a.articles - b.articles,
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.created-at.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.created-at.label",
+						}),
 						key: "created-at",
 						width: 100,
 						search: false,
@@ -117,8 +127,14 @@ const Widget = () => {
 						width: 120,
 						valueType: "option",
 						render: (text, row, index, action) => [
-							<Dropdown.Button type="link" key={index} overlay={menu}>
-								编辑
+							<Dropdown.Button
+								type="link"
+								key={index}
+								overlay={menu}
+							>
+								{intl.formatMessage({
+									id: "buttons.edit",
+								})}
 							</Dropdown.Button>,
 						],
 					},
@@ -128,11 +144,19 @@ const Widget = () => {
 					// 注释该行则默认不显示下拉选项
 					selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
 				}}
-				tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
+				tableAlertRender={({
+					selectedRowKeys,
+					selectedRows,
+					onCleanSelected,
+				}) => (
 					<Space size={24}>
 						<span>
 							已选 {selectedRowKeys.length} 项
-							<Button type="link" style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
+							<Button
+								type="link"
+								style={{ marginInlineStart: 8 }}
+								onClick={onCleanSelected}
+							>
 								取消选择
 							</Button>
 						</span>
@@ -154,15 +178,21 @@ const Widget = () => {
 						total: 1 << 12,
 						success: true,
 						data: Array.from(Array(size).keys()).map((x) => {
-							const id = ((params.current || 1) - 1) * size + x + 1;
+							const id =
+								((params.current || 1) - 1) * size + x + 1;
 
 							var it: IItem = {
 								id,
 								title: `title ${id}`,
 								subtitle: `subtitle ${id}`,
-								tag: ((Math.floor(Math.random() * 3) + 1) * 10).toString(),
+								tag: (
+									(Math.floor(Math.random() * 3) + 1) *
+									10
+								).toString(),
 								articles: Math.floor(Math.random() * 40),
-								createdAt: Date.now() - Math.floor(Math.random() * 2000000000),
+								createdAt:
+									Date.now() -
+									Math.floor(Math.random() * 2000000000),
 							};
 							return it;
 						}),
@@ -179,8 +209,16 @@ const Widget = () => {
 					search: true,
 				}}
 				toolBarRender={() => [
-					<Popover content={anthologyCreate} title="new article" placement="bottomRight">
-						<Button key="button" icon={<PlusOutlined />} type="primary">
+					<Popover
+						content={anthologyCreate}
+						title="new article"
+						placement="bottomRight"
+					>
+						<Button
+							key="button"
+							icon={<PlusOutlined />}
+							type="primary"
+						>
 							{intl.formatMessage({ id: "buttons.create" })}
 						</Button>
 					</Popover>,

+ 50 - 14
dashboard/src/pages/studio/channel/list.tsx

@@ -58,14 +58,18 @@ const Widget = () => {
 			<ProTable<IItem>
 				columns={[
 					{
-						title: intl.formatMessage({ id: "dict.fields.sn.label" }),
+						title: intl.formatMessage({
+							id: "dict.fields.sn.label",
+						}),
 						dataIndex: "id",
 						key: "id",
 						width: 50,
 						search: false,
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.title.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.title.label",
+						}),
 						dataIndex: "title",
 						key: "title",
 						tip: "过长会自动收缩",
@@ -83,7 +87,9 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.type.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.type.label",
+						}),
 						dataIndex: "type",
 						key: "type",
 						width: 100,
@@ -100,7 +106,9 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.publicity.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.publicity.label",
+						}),
 						dataIndex: "publicity",
 						key: "publicity",
 						width: 100,
@@ -117,7 +125,9 @@ const Widget = () => {
 						},
 					},
 					{
-						title: intl.formatMessage({ id: "forms.fields.created-at.label" }),
+						title: intl.formatMessage({
+							id: "forms.fields.created-at.label",
+						}),
 						key: "created-at",
 						width: 100,
 						search: false,
@@ -131,8 +141,14 @@ const Widget = () => {
 						width: 120,
 						valueType: "option",
 						render: (text, row, index, action) => [
-							<Dropdown.Button key={index} type="link" overlay={menu}>
-								编辑
+							<Dropdown.Button
+								key={index}
+								type="link"
+								overlay={menu}
+							>
+								{intl.formatMessage({
+									id: "buttons.edit",
+								})}
 							</Dropdown.Button>,
 						],
 					},
@@ -142,11 +158,19 @@ const Widget = () => {
 					// 注释该行则默认不显示下拉选项
 					selections: [Table.SELECTION_ALL, Table.SELECTION_INVERT],
 				}}
-				tableAlertRender={({ selectedRowKeys, selectedRows, onCleanSelected }) => (
+				tableAlertRender={({
+					selectedRowKeys,
+					selectedRows,
+					onCleanSelected,
+				}) => (
 					<Space size={24}>
 						<span>
 							已选 {selectedRowKeys.length} 项
-							<Button type="link" style={{ marginInlineStart: 8 }} onClick={onCleanSelected}>
+							<Button
+								type="link"
+								style={{ marginInlineStart: 8 }}
+								onClick={onCleanSelected}
+							>
 								取消选择
 							</Button>
 						</span>
@@ -168,15 +192,19 @@ const Widget = () => {
 						total: 1 << 12,
 						success: true,
 						data: Array.from(Array(size).keys()).map((x) => {
-							const id = ((params.current || 1) - 1) * size + x + 1;
+							const id =
+								((params.current || 1) - 1) * size + x + 1;
 
 							var it: IItem = {
 								id,
 								title: `title ${id}`,
 								subtitle: `subtitle ${id}`,
 								type: EType[Math.floor(Math.random() * 4)],
-								publicity: (Math.floor(Math.random() * 3) + 1) * 10,
-								createdAt: Date.now() - Math.floor(Math.random() * 2000000000),
+								publicity:
+									(Math.floor(Math.random() * 3) + 1) * 10,
+								createdAt:
+									Date.now() -
+									Math.floor(Math.random() * 2000000000),
 							};
 							return it;
 						}),
@@ -193,8 +221,16 @@ const Widget = () => {
 					search: true,
 				}}
 				toolBarRender={() => [
-					<Popover content={channelCreate} title="new channel" placement="bottomRight">
-						<Button key="button" icon={<PlusOutlined />} type="primary">
+					<Popover
+						content={channelCreate}
+						title="new channel"
+						placement="bottomRight"
+					>
+						<Button
+							key="button"
+							icon={<PlusOutlined />}
+							type="primary"
+						>
 							{intl.formatMessage({ id: "buttons.create" })}
 						</Button>
 					</Popover>,

+ 48 - 16
dashboard/src/pages/studio/group/index.tsx

@@ -71,13 +71,23 @@ const Widget = () => {
 				<Content>
 					<Breadcrumb>
 						<Breadcrumb.Item>
-							<Link to={linkStudio}>{intl.formatMessage({ id: "columns.studio.title" })}</Link>
+							<Link to={linkStudio}>
+								{intl.formatMessage({
+									id: "columns.studio.title",
+								})}
+							</Link>
 						</Breadcrumb.Item>
 						<Breadcrumb.Item>
-							{intl.formatMessage({ id: "columns.studio.collaboration.title" })}
+							{intl.formatMessage({
+								id: "columns.studio.collaboration.title",
+							})}
 						</Breadcrumb.Item>
 						<Breadcrumb.Item>
-							<Link to={linkGroup}>{intl.formatMessage({ id: "columns.studio.group.title" })}</Link>
+							<Link to={linkGroup}>
+								{intl.formatMessage({
+									id: "columns.studio.group.title",
+								})}
+							</Link>
 						</Breadcrumb.Item>
 						<Breadcrumb.Item>列表</Breadcrumb.Item>
 					</Breadcrumb>
@@ -95,9 +105,20 @@ const Widget = () => {
 							}}
 							onDataSourceChange={setDataSource}
 							toolBarRender={() => [
-								<Popover content={<GroupCreate studio={studioname} />} placement="bottomRight">
-									<Button key="button" icon={<PlusOutlined />} type="primary">
-										{intl.formatMessage({ id: "buttons.create" })}
+								<Popover
+									content={
+										<GroupCreate studio={studioname} />
+									}
+									placement="bottomRight"
+								>
+									<Button
+										key="button"
+										icon={<PlusOutlined />}
+										type="primary"
+									>
+										{intl.formatMessage({
+											id: "buttons.create",
+										})}
 									</Button>
 								</Popover>,
 							]}
@@ -105,7 +126,9 @@ const Widget = () => {
 								title: {
 									dataIndex: "name",
 									render: (text, row, index, action) => {
-										return <Link to={row.id}>{row.name}</Link>;
+										return (
+											<Link to={row.id}>{row.name}</Link>
+										);
 									},
 								},
 								avatar: {
@@ -121,14 +144,21 @@ const Widget = () => {
 								},
 								subTitle: {
 									render: (text, row, index, action) => {
-										const showtag = row.tag.map((item, id) => {
-											return (
-												<Tag color={item.color} key={id}>
-													{item.title}
-												</Tag>
-											);
-										});
-										return <Space size={0}>{showtag}</Space>;
+										const showtag = row.tag.map(
+											(item, id) => {
+												return (
+													<Tag
+														color={item.color}
+														key={id}
+													>
+														{item.title}
+													</Tag>
+												);
+											}
+										);
+										return (
+											<Space size={0}>{showtag}</Space>
+										);
 									},
 								},
 								actions: {
@@ -139,7 +169,9 @@ const Widget = () => {
 											}}
 											key="link"
 										>
-											编辑
+											{intl.formatMessage({
+												id: "buttons.edit",
+											})}
 										</Button>,
 									],
 								},

+ 48 - 16
dashboard/src/pages/studio/group/list.tsx

@@ -71,13 +71,23 @@ const Widget = () => {
 				<Content>
 					<Breadcrumb>
 						<Breadcrumb.Item>
-							<Link to={linkStudio}>{intl.formatMessage({ id: "columns.studio.title" })}</Link>
+							<Link to={linkStudio}>
+								{intl.formatMessage({
+									id: "columns.studio.title",
+								})}
+							</Link>
 						</Breadcrumb.Item>
 						<Breadcrumb.Item>
-							{intl.formatMessage({ id: "columns.studio.collaboration.title" })}
+							{intl.formatMessage({
+								id: "columns.studio.collaboration.title",
+							})}
 						</Breadcrumb.Item>
 						<Breadcrumb.Item>
-							<Link to={linkGroup}>{intl.formatMessage({ id: "columns.studio.group.title" })}</Link>
+							<Link to={linkGroup}>
+								{intl.formatMessage({
+									id: "columns.studio.group.title",
+								})}
+							</Link>
 						</Breadcrumb.Item>
 						<Breadcrumb.Item>列表</Breadcrumb.Item>
 					</Breadcrumb>
@@ -95,9 +105,20 @@ const Widget = () => {
 							}}
 							onDataSourceChange={setDataSource}
 							toolBarRender={() => [
-								<Popover content={<GroupCreate studio={studioname} />} placement="bottomRight">
-									<Button key="button" icon={<PlusOutlined />} type="primary">
-										{intl.formatMessage({ id: "buttons.create" })}
+								<Popover
+									content={
+										<GroupCreate studio={studioname} />
+									}
+									placement="bottomRight"
+								>
+									<Button
+										key="button"
+										icon={<PlusOutlined />}
+										type="primary"
+									>
+										{intl.formatMessage({
+											id: "buttons.create",
+										})}
 									</Button>
 								</Popover>,
 							]}
@@ -105,7 +126,9 @@ const Widget = () => {
 								title: {
 									dataIndex: "name",
 									render: (text, row, index, action) => {
-										return <Link to={row.id}>{row.name}</Link>;
+										return (
+											<Link to={row.id}>{row.name}</Link>
+										);
 									},
 								},
 								avatar: {
@@ -121,14 +144,21 @@ const Widget = () => {
 								},
 								subTitle: {
 									render: (text, row, index, action) => {
-										const showtag = row.tag.map((item, id) => {
-											return (
-												<Tag color={item.color} key={id}>
-													{item.title}
-												</Tag>
-											);
-										});
-										return <Space size={0}>{showtag}</Space>;
+										const showtag = row.tag.map(
+											(item, id) => {
+												return (
+													<Tag
+														color={item.color}
+														key={id}
+													>
+														{item.title}
+													</Tag>
+												);
+											}
+										);
+										return (
+											<Space size={0}>{showtag}</Space>
+										);
 									},
 								},
 								actions: {
@@ -139,7 +169,9 @@ const Widget = () => {
 											}}
 											key="link"
 										>
-											编辑
+											{intl.formatMessage({
+												id: "buttons.edit",
+											})}
 										</Button>,
 									],
 								},