This commit is contained in:
Francis Cao 2023-04-20 12:07:10 -07:00
commit 7aac95a410
11 changed files with 42 additions and 27 deletions

View File

@ -1,3 +1,3 @@
.favicon {
margin-right: 8px;
margin-inline-end: 8px;
}

View File

@ -14,7 +14,7 @@
.row .link {
display: none;
margin-left: 20px;
margin-inline-start: 20px;
}
.row .label {

View File

@ -10,16 +10,16 @@
}
.row > .col {
border-left: 1px solid var(--base300);
border-inline-start: 1px solid var(--base300);
}
.row > .col:first-child {
border-left: 0;
padding-left: 0;
border-inline-start: 0;
padding-inline-start: 0;
}
.row > .col:last-child {
padding-right: 0;
padding-inline-end: 0;
}
@media only screen and (max-width: 992px) {
@ -29,7 +29,7 @@
.row > .col {
border-top: 1px solid var(--base300);
border-left: 0;
border-inline-end: 0;
padding: 20px 0;
}
}

View File

@ -68,8 +68,8 @@
.value {
width: 50px;
text-align: right;
margin-right: 10px;
text-align: end;
margin-inline-end: 10px;
font-weight: 600;
cursor: pointer;
}
@ -79,7 +79,7 @@
width: 50px;
color: var(--base600);
border-left: 1px solid var(--base600);
padding-left: 10px;
padding-inline-start: 10px;
z-index: 1;
}

View File

@ -13,7 +13,7 @@
}
.label + .label {
margin-left: 20px;
margin-inline-start: 20px;
}
.hidden {

View File

@ -10,6 +10,7 @@ import EmptyPlaceholder from 'components/common/EmptyPlaceholder';
import useApi from 'hooks/useApi';
import useDashboard from 'store/dashboard';
import useMessages from 'hooks/useMessages';
import useLocale from 'hooks/useLocale';
export default function Dashboard({ userId }) {
const { formatMessage, labels, messages } = useMessages();
@ -19,6 +20,7 @@ export default function Dashboard({ userId }) {
const { get, useQuery } = useApi();
const { data, isLoading, error } = useQuery(['websites'], () => get('/websites', { userId }));
const hasData = data && data.length !== 0;
const { dir } = useLocale();
function handleMore() {
setMax(max + limit);
@ -33,7 +35,7 @@ export default function Dashboard({ userId }) {
<EmptyPlaceholder message={formatMessage(messages.noWebsitesConfigured)}>
<Link href="/settings/websites">
<Button>
<Icon>
<Icon rotate={dir === 'rtl' ? 180 : 0}>
<Icons.ArrowRight />
</Icon>
<Text>{formatMessage(messages.goToSettings)}</Text>
@ -48,7 +50,7 @@ export default function Dashboard({ userId }) {
{max < data.length && (
<Flexbox justifyContent="center">
<Button onClick={handleMore}>
<Icon>
<Icon rotate={dir === 'rtl' ? 180 : 0}>
<Icons.More />
</Icon>
<Text>{formatMessage(labels.more)}</Text>

View File

@ -6,10 +6,12 @@ import useMessages from 'hooks/useMessages';
import useUser from 'hooks/useUser';
import { ROLES } from 'lib/constants';
import SettingsTable from 'components/common/SettingsTable';
import useLocale from 'hooks/useLocale';
export default function TeamsTable({ data = [], onDelete }) {
const { formatMessage, labels } = useMessages();
const { user } = useUser();
const { dir } = useLocale();
const columns = [
{ name: 'name', label: formatMessage(labels.name) },
@ -64,7 +66,7 @@ export default function TeamsTable({ data = [], onDelete }) {
{!showDelete && (
<ModalTrigger>
<Button>
<Icon>
<Icon rotate={dir === 'rtl' ? 180 : 0}>
<Icons.ArrowRight />
</Icon>
<Text>{formatMessage(labels.leave)}</Text>

View File

@ -1,12 +1,13 @@
import { TextArea } from 'react-basics';
import { TRACKER_SCRIPT_URL } from 'lib/constants';
import useMessages from 'hooks/useMessages';
import useConfig from 'hooks/useConfig';
export default function TrackingCode({ websiteId }) {
const { formatMessage, messages } = useMessages();
const url = TRACKER_SCRIPT_URL.startsWith('http')
? TRACKER_SCRIPT_URL
: `${location.origin}${TRACKER_SCRIPT_URL}`;
const { trackerScriptName } = useConfig();
const url = trackerScriptName.startsWith('http')
? trackerScriptName
: `${location.origin}/${trackerScriptName}.js`;
const code = `<script async src="${url}" data-website-id="${websiteId}"></script>`;

View File

@ -18,6 +18,7 @@ import SideNav from 'components/layout/SideNav';
import usePageQuery from 'hooks/usePageQuery';
import useMessages from 'hooks/useMessages';
import styles from './WebsiteMenuView.module.css';
import useLocale from 'hooks/useLocale';
const views = {
url: PagesTable,
@ -37,6 +38,7 @@ const views = {
export default function WebsiteMenuView({ websiteId, websiteDomain }) {
const { formatMessage, labels } = useMessages();
const { dir } = useLocale();
const {
resolveUrl,
query: { view },
@ -113,7 +115,7 @@ export default function WebsiteMenuView({ websiteId, websiteDomain }) {
<Link href={resolveUrl({ view: undefined })}>
<Flexbox justifyContent="center">
<Button variant="quiet">
<Icon rotate={180}>
<Icon rotate={dir === 'rtl' ? 0 : 180}>
<Icons.ArrowRight />
</Icon>
<Text>{formatMessage(labels.back)}</Text>

View File

@ -1,7 +1,7 @@
{
"label.access-code": "访问代码",
"label.actions": "用户行为",
"label.activity-log": "Activity log",
"label.activity-log": "活动日志",
"label.add-website": "添加网站",
"label.admin": "管理员",
"label.all": "所有",
@ -13,7 +13,7 @@
"label.browsers": "浏览器",
"label.cancel": "取消",
"label.change-password": "更新密码",
"label.cities": "市",
"label.cities": "/县",
"label.clear-all": "清除全部",
"label.confirm": "确认",
"label.confirm-password": "确认密码",
@ -32,7 +32,7 @@
"label.delete-team": "删除团队",
"label.delete-user": "删除用户",
"label.delete-website": "删除网站",
"label.desktop": "桌面电脑",
"label.desktop": "台式机",
"label.details": "详细信息",
"label.devices": "设备",
"label.dismiss": "关闭",
@ -41,7 +41,7 @@
"label.edit-dashboard": "编辑仪表板",
"label.enable-share-url": "启用共享链接",
"label.events": "行为类别",
"label.filter-combined": "总和",
"label.filter-combined": "合并",
"label.filter-raw": "原始",
"label.join": "加入",
"label.join-team": "加入团队",
@ -72,7 +72,7 @@
"label.referrers": "来源域名",
"label.refresh": "刷新",
"label.regenerate": "重新生成",
"label.regions": "地区",
"label.regions": "州/省",
"label.remove": "移除",
"label.required": "必填",
"label.reset": "重置",

View File

@ -112,13 +112,21 @@
};
const callback = e => {
const findATagParent = (rootElem, maxSearchDepth) => {
let currentElement = rootElem;
for (let i = 0; i < maxSearchDepth; i++) {
if (currentElement.tagName === 'A')
return currentElement;
currentElement = currentElement.parentElement;
}
return null;
};
const el = e.target;
const anchor =
el.tagName === 'A'
? el
: el.parentElement && el.parentElement.tagName === 'A'
? el.parentElement
: null;
: findATagParent(el, 5);
if (anchor) {
const { href, target } = anchor;