🏷️(frontend) adapt new doc type nb_accesses_direct
We renamed the `nb_accesses` field to `nb_accesses_direct` and added a new `nb_accesses_ancestors` field. We adapt the frontend to use the new fields.
This commit is contained in:
committed by
Manuel Raynaud
parent
f20d256cd1
commit
57cead448d
@@ -37,7 +37,7 @@ interface DocToolBoxProps {
|
|||||||
|
|
||||||
export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const hasAccesses = doc.nb_accesses > 1 && doc.abilities.accesses_view;
|
const hasAccesses = doc.nb_accesses_direct > 1 && doc.abilities.accesses_view;
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
|
|
||||||
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
const { spacingsTokens, colorsTokens } = useCunninghamTheme();
|
||||||
@@ -193,7 +193,7 @@ export const DocToolBox = ({ doc }: DocToolBoxProps) => {
|
|||||||
}}
|
}}
|
||||||
size={isSmallMobile ? 'small' : 'medium'}
|
size={isSmallMobile ? 'small' : 'medium'}
|
||||||
>
|
>
|
||||||
{doc.nb_accesses}
|
{doc.nb_accesses_direct}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ export interface Doc {
|
|||||||
is_favorite: boolean;
|
is_favorite: boolean;
|
||||||
link_reach: LinkReach;
|
link_reach: LinkReach;
|
||||||
link_role: LinkRole;
|
link_role: LinkRole;
|
||||||
nb_accesses: number;
|
nb_accesses_ancestors: number;
|
||||||
|
nb_accesses_direct: number;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
abilities: {
|
abilities: {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ type Props = {
|
|||||||
};
|
};
|
||||||
export const DocsGridItemSharedButton = ({ doc, handleClick }: Props) => {
|
export const DocsGridItemSharedButton = ({ doc, handleClick }: Props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const sharedCount = doc.nb_accesses;
|
const sharedCount = doc.nb_accesses_direct;
|
||||||
const isShared = sharedCount - 1 > 0;
|
const isShared = sharedCount - 1 > 0;
|
||||||
|
|
||||||
if (!isShared) {
|
if (!isShared) {
|
||||||
|
|||||||
@@ -173,7 +173,8 @@ export class ApiPlugin implements WorkboxPlugin {
|
|||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
creator: 'dummy-id',
|
creator: 'dummy-id',
|
||||||
is_favorite: false,
|
is_favorite: false,
|
||||||
nb_accesses: 1,
|
nb_accesses_direct: 1,
|
||||||
|
nb_accesses_ancestors: 1,
|
||||||
updated_at: new Date().toISOString(),
|
updated_at: new Date().toISOString(),
|
||||||
abilities: {
|
abilities: {
|
||||||
accesses_manage: true,
|
accesses_manage: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user