Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
Lullabyq committed Jan 22, 2025
1 parent 9e8b5af commit a3f3b84
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 55 deletions.
2 changes: 1 addition & 1 deletion config/searchExcludeRoutes.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["/automations/automations-by-event/welcome-series", "/updates/HVG123РЕ97E", "/updates/BC1ADF523"]
["/automations/automations-by-event/welcome-series", "/updates/HVG123РЕ97E", "/updates/BC1ADF523E4"]
7 changes: 3 additions & 4 deletions docs/account-settings/how-to-create-sublogin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
sidebar_position: 1
sidebar_label: 'Как создать учётную запись'
recent_article:
status: update
theses:
- Keisgfsgd
- Lorem
- fgdgsfgasfgafga asdfadfasdf
- Пример
- Изменения
- 24 правки текста
---

# Как создать учётную запись для нового пользователя
Expand Down
2 changes: 1 addition & 1 deletion docs/automations/autoimport/how-to-set-autoexport.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sidebar_position: 2
sidebar_label: 'Экспорт по шаблону'
recent_article:
status: new
new: true
---

# Как настроить регулярный экспорт по шаблону
Expand Down
1 change: 0 additions & 1 deletion plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const yandexMetricaCounter = process.env.YANDEX_METRICA_COUNTER_ID;
const plugins = [
'./src/plugins/iframe-detected',
'./src/plugins/tailwind',
'./src/plugins/webpackConfig',
[
'./src/plugins/docs-plugin-extended',
{
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomLastUpdate/CustomLastUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const enum CustomLastUpdateType {
interface CustomLastUpdateProps {
lastUpdatedAt: number;
type: CustomLastUpdateType;
frontMatter?: {
frontMatter: {
recent_article?: {
ignore: boolean;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ import Layout from '@theme/Layout';
import { CustomLastUpdate } from '../CustomLastUpdate';
import { CustomLastUpdateType } from '../CustomLastUpdate/CustomLastUpdate';
import { RECENT_ARTICLES_CONTENT_ID } from './constants.js';
import { truncateString } from './utils/truncateString';

const NBSP = '\u00A0';

const ArticleStatus = {
New: 'new',
Updated: 'updated',
};

const RecentlyUpdatedArticlesCard = ({ children, slug }) => {
const handleClick = () => {
document.dispatchEvent(new CustomEvent('redirect', { detail: { slug } }));
Expand Down Expand Up @@ -49,7 +45,7 @@ const RecentlyUpdatedArticlesChanges = ({ frontMatter }) => {
const RecentlyUpdatedArticles = ({ recentArticles }) => (
<Layout>
<div className="flex flex-col gap-4" id={RECENT_ARTICLES_CONTENT_ID}>
{recentArticles.map(({ title, lastUpdatedAt, frontMatter, slug }) => (
{recentArticles.map(({ title, lastUpdatedAt, frontMatter, slug, description }) => (
<RecentlyUpdatedArticlesCard key={slug} slug={slug}>
<div className="flex flex-col gap-2">
<h5 className="text-gray-800 text-base font-medium m-0 group-hover:text-blue-600">
Expand All @@ -59,14 +55,18 @@ const RecentlyUpdatedArticles = ({ recentArticles }) => (
<CustomLastUpdate
lastUpdatedAt={lastUpdatedAt}
type={
frontMatter.recent_article?.status === ArticleStatus.New
frontMatter.recent_article?.new
? CustomLastUpdateType.CreationDate
: CustomLastUpdateType.UpdateDate
}
/>
</div>

<RecentlyUpdatedArticlesChanges frontMatter={frontMatter} />

{description && frontMatter.recent_article?.new && (
<span className="text-gray-800 text-sm">{truncateString(description, 180)}</span>
)}
</RecentlyUpdatedArticlesCard>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { useRef, useState } from 'react';
import { RECENT_ARTICLES_CONTENT_ID, RECENT_ARTICLES_TEMP_URL } from './constants.js';
import { useHistory } from '@docusaurus/router';
import { RECENT_ARTICLES_CONTENT_ID, RECENT_ARTICLES_TEMP_URL } from './constants.js';

const DEFAULT_IFRAME_HEIGHT = '650px';

export const RecentlyUpdatedArticlesIframe = () => {
const history = useHistory();
Expand All @@ -16,17 +18,15 @@ export const RecentlyUpdatedArticlesIframe = () => {

const resizeIframe = () => {
if (!iframeRef.current) {
setIsError(true);

return;
}

const recentArticleContentElement = iframeRef.current.contentWindow.document.getElementById(
RECENT_ARTICLES_CONTENT_ID
);

if (!recentArticleContentElement) {
setIsError(true);
}

iframeRef.current.style.height = `${recentArticleContentElement?.scrollHeight}px`;

iframeRef.current?.contentWindow.document.addEventListener('redirect', handleRedirectInIframe);
Expand All @@ -45,10 +45,11 @@ export const RecentlyUpdatedArticlesIframe = () => {
style={{
border: 'none',
outline: 'none',
height: DEFAULT_IFRAME_HEIGHT,
}}
onLoad={resizeIframe}
scrolling="no"
seamless="seamless"
seamless={true}
/>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const DEFAULT_MAX_LENGTH = 20;

export const truncateString = (value = '', maxLength = DEFAULT_MAX_LENGTH) =>
value.length > maxLength ? `${value.slice(0, maxLength)}...` : value;
32 changes: 0 additions & 32 deletions src/plugins/webpackConfig/index.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/theme/DocItem/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ const DocItemLayout = ({ children }: Props): JSX.Element => {
const docTOC = useDocTOC();
const { metadata } = useDoc();

console.log('!!metadata', metadata);

return (
<div className="row">
<div className={clsx('col', !docTOC.hidden && styles.docItemCol)}>
Expand Down

0 comments on commit a3f3b84

Please sign in to comment.