Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s

This commit is contained in:
huncode committed 2026-10-27 15:19:49 +03:00
1 parent 99c848189e
commit 12562baeb5
2040 files changed
+184656 -181

No files matched your search

+1 -6
View File
@@ -1,6 +1 @@
"use client";
import {useState,useEffect} from 'react';
import Link from 'next/link';
import {trackGoal} from '../lib/metrika.mjs';
import {formatDate} from '../lib/dates.mjs';
export default function Catalog({articles}){const [q,setQ]=useState(''),[topic,setTopic]=useState('Все');const topics=['Все',...new Set(articles.flatMap(a=>a.categories))];const shown=articles.filter(a=>(topic==='Все'||a.categories.includes(topic))&&(a.title+' '+a.excerpt+' '+a.categories.join(' ')).toLocaleLowerCase('ru').includes(q.toLocaleLowerCase('ru')));useEffect(()=>{if(!q.trim()||shown.length)return;const timer=setTimeout(()=>trackGoal('search_zero_results'),500);return()=>clearTimeout(timer);},[q,shown.length]);return <section id="journal" className="journal"><div className="journal-heading"><div><p className="kicker">ПОЛНЫЙ ИНДЕКС</p><h2>Статьи и заметки</h2></div><span>{articles.length} материалов</span></div><div className="catalog-controls"><label htmlFor="search"><span>Найти в журнале</span><input id="search" type="search" value={q} onChange={e=>setQ(e.target.value)} placeholder="Тема, язык или задача"/></label><div className="topic-tabs" aria-label="Темы">{topics.map(t=><button aria-pressed={topic===t} key={t} onClick={()=>setTopic(t)}>{t}</button>)}</div></div><p role="status" className="search-status">{shown.length?`Найдено материалов: ${shown.length}`:'По этому запросу ничего нет. Попробуйте другое слово или сбросьте тему.'}</p><div className="journal-list">{shown.map(a=><article key={a.slug} className="index-entry"><div className="index-date"><time dateTime={a.date}>{formatDate(a.date,{month:'short',day:'numeric'})}</time><span>{a.categories.join(' · ')}</span></div><Link onClick={e=>{if(e.isTrusted&&q.trim())trackGoal('search_used');}} href={'/articles/'+encodeURIComponent(a.slug)+'/'}><h3>{a.title}</h3><p>{a.excerpt}</p></Link><span className="index-duration">{a.readingMinutes} мин <b aria-hidden="true">↗</b></span></article>)}</div>{!shown.length&&<button onClick={()=>{setQ('');setTopic('Все');}}>Сбросить поиск</button>}</section>}
export {default} from '../fsd/widgets/journal-index';
+1 -9
View File
@@ -1,9 +1 @@
"use client";
import {useEffect} from 'react';
import {usePathname} from 'next/navigation';
import {observePage} from '../lib/metrika.mjs';
export default function Metrika() {
const pathname = usePathname();
useEffect(observePage, [pathname]);
return null;
}
export {Metrika as default} from '../fsd/features/analytics';
+1 -12
View File
@@ -1,12 +1 @@
"use client";
import {useEffect} from 'react';
import links from '../data/shortlinks.json';
export default function Shortlinks(){
useEffect(()=>{
const id=new URLSearchParams(location.search).get('p');
if(!id||!Object.hasOwn(links,id))return;
const target=links[id];
if(typeof target==='string'&&target.startsWith('/articles/'))location.replace(target);
},[]);
return null;
}
export {Shortlinks as default} from '../fsd/features/shortlinks';
+8 -8
View File
@@ -1,12 +1,12 @@
import Link from 'next/link';
import {notFound} from 'next/navigation';
import ArticlePage,{generateMetadata as articleMetadata} from '../articles/[slug]/page';
import About from '../about/page';
import Resources from '../resources/page';
import ArticlePage from '../../fsd/pages/article';
import AboutPage from '../../fsd/pages/about';
import ResourcesPage from '../../fsd/pages/resources';
import CatalogPage from '../../fsd/pages/catalog';
import {getArticles,getArticleBySlug} from '../../fsd/entities/article';
import routes from '../../data/archive-routes.json';
import {getArticles,formatDate} from '../../lib/articles';
export const dynamicParams=false;
export function generateStaticParams(){return Object.keys(routes).map(p=>({path:p.split('/').filter(Boolean)}));}
export function generateStaticParams(){return Object.keys(routes).map(path=>({path:path.split('/').filter(Boolean)}));}
async function lookup(params){const {path}=await params;const route=routes['/'+path.map(decodeURIComponent).join('/')];if(!route)notFound();return route;}
export async function generateMetadata({params}){const r=await lookup(params);if(r.type==='article')return articleMetadata({params:Promise.resolve({slug:r.slug})});return {title:(r.type==='index'?r.title:r.type==='about'?'О блоге':'Справочники')+' — ProgCode'};}
export default async function Legacy({params}){const r=await lookup(params);if(r.type==='article')return ArticlePage({params:Promise.resolve({slug:r.slug})});if(r.type==='about')return About();if(r.type==='resources')return Resources();const articles=getArticles().filter(a=>r.slugs.includes(a.slug));return <main id="main" className="archive-page"><p className="kicker">ТЕМАТИЧЕСКИЙ ИНДЕКС</p><h1>{r.title}</h1><p className="large-text">Материалы по этой теме: {articles.length}. <Link href="/#journal">Перейти к поиску по всему журналу</Link>.</p><div className="journal-list">{articles.map(a=><article className="index-entry" key={a.slug}><div className="index-date"><time dateTime={a.date}>{formatDate(a.date)}</time><span>{a.categories.join(' · ')}</span></div><Link href={'/articles/'+encodeURIComponent(a.slug)+'/'}><h3>{a.title}</h3><p>{a.excerpt}</p></Link><span className="index-duration">{a.readingMinutes} мин ↗</span></article>)}</div></main>}
export async function generateMetadata({params}){const route=await lookup(params);if(route.type==='article'){const article=getArticleBySlug(route.slug);return {title:article.title+' — ProgCode',description:article.excerpt,alternates:{canonical:'/articles/'+encodeURIComponent(article.slug)+'/'}};}return {title:(route.type==='index'?route.title:route.type==='about'?'О блоге':'Справочники')+' — ProgCode'};}
export default async function LegacyRoute({params}){const route=await lookup(params);if(route.type==='article'){const article=getArticleBySlug(route.slug);const related=getArticles().filter(item=>item.slug!==article.slug&&item.categories.some(category=>article.categories.includes(category))).slice(0,3);return <ArticlePage article={article} related={related}/>;}if(route.type==='about')return <AboutPage/>;if(route.type==='resources')return <ResourcesPage/>;return <CatalogPage title={route.title} articles={getArticles().filter(article=>route.slugs.includes(article.slug))}/>;}
+1 -1
View File
@@ -1,2 +1,2 @@
export const metadata={title:'О блоге — ProgCode'};
export default function About(){return <main id="main" className="simple-page"><p className="kicker">PROGCODE.RU</p><h1>Блог одного<br/>программиста.</h1><p className="large-text">Здесь разбирают устройство инструментов, пишут небольшие функции и задают вопросы разработчикам.</p><div className="article-content"><h2>Что читать</h2><p>Основная коллекция — заметки DarkRiDDeR 2017–2019 годов о D, PHP, Bitrix, JavaScript и рабочем окружении. Среди них есть короткие рецепты, большой разбор сборщика мусора и интервью с создателем Tilix.</p><p>Технические примеры привязаны к контексту своих версий. Там, где старый совет мог привести к ошибке, текст уточнён. Интервью и переводы сохраняют авторство и ссылки на первичные публикации.</p><h2>Как ориентироваться</h2><p>Начните с <a href="/#journal">индекса статей</a>, выберите тему или задайте поиск. Для длинных разборов предусмотрено оглавление. В <a href="/resources/">справочниках</a> собраны первичные источники по темам блога, а <a href="/tools/">JSON-инструмент</a> помогает проверить ответ API.</p><h2>Автор и связь</h2><p>Автор исторических заметок подписывался DarkRiDDeR. Подтверждённый актуальный канал связи не указан; старые формы отправки сообщений больше не используются.</p></div></main>}
export {default} from '../../fsd/pages/about';
+2
View File
@@ -0,0 +1,2 @@
export const metadata={title:'Доступность и чтение — ProgCode'};
export {default} from '../../fsd/pages/accessibility';
+5 -5
View File
@@ -1,6 +1,6 @@
import Link from 'next/link';
import {notFound} from 'next/navigation';
import {getArticles,getArticleBySlug,formatDate} from '../../../lib/articles';
export function generateStaticParams(){return getArticles().map(a=>({slug:a.slug}));}
export async function generateMetadata({params}){const {slug}=await params;const a=getArticleBySlug(decodeURIComponent(slug));return a?{title:a.title+' — ProgCode',description:a.excerpt,alternates:{canonical:'/articles/'+encodeURIComponent(a.slug)+'/'}}:{title:'Статья не найдена'};}
export default async function Article({params}){const {slug}=await params;const a=getArticleBySlug(decodeURIComponent(slug));if(!a)notFound();const related=getArticles().filter(x=>x.slug!==a.slug&&x.categories.some(c=>a.categories.includes(c))).slice(0,3);return <main id="main" className="article-shell"><nav className="breadcrumbs" aria-label="Путь"><Link href="/#journal">Журнал</Link><span>/</span><span>{a.categories.join(' · ')}</span></nav><header className="article-header"><p className="kicker">{a.categories.join(' / ')}</p><h1>{a.title}</h1><p className="article-deck">{a.excerpt}</p><div className="article-meta"><time dateTime={a.date}>{formatDate(a.date)}</time><span>{a.readingMinutes} мин чтения</span><span>{a.author}</span></div></header><div className="reading-layout">{a.toc?.length>1&&<aside className="contents-rail"><details open><summary>В этой статье</summary><nav aria-label="Оглавление статьи">{a.toc.map((s,i)=><a key={s.id} href={'#'+s.id}><span>{String(i+1).padStart(2,'0')}</span>{s.title}</a>)}</nav></details></aside>}<div className="reading-column"><div className="article-content" dangerouslySetInnerHTML={{__html:a.contentHtml}}/><div className="article-end"><span>КОНЕЦ ЗАМЕТКИ</span><a href="#main">↑ В начало</a></div>{related.length>0&&<section className="related"><p className="kicker">ПРОДОЛЖИТЬ ЧТЕНИЕ</p>{related.map(x=><Link key={x.slug} href={'/articles/'+encodeURIComponent(x.slug)+'/'}>{x.title}<span>↗</span></Link>)}</section>}</div></div></main>}
import {getArticles,getArticleBySlug} from '../../../fsd/entities/article';
import ArticlePage from '../../../fsd/pages/article';
export function generateStaticParams(){return getArticles().map(article=>({slug:article.slug}));}
export async function generateMetadata({params}){const {slug}=await params;const article=getArticleBySlug(decodeURIComponent(slug));return article?{title:article.title+' — ProgCode',description:article.excerpt,alternates:{canonical:'/articles/'+encodeURIComponent(article.slug)+'/'}}:{title:'Статья не найдена'};}
export default async function ArticleRoute({params}){const {slug}=await params;const article=getArticleBySlug(decodeURIComponent(slug));if(!article)notFound();const related=getArticles().filter(item=>item.slug!==article.slug&&item.categories.some(category=>article.categories.includes(category))).slice(0,3);return <ArticlePage article={article} related={related}/>}
+3 -6
View File
@@ -1,6 +1,3 @@
:root{--paper:#f6f4ef;--white:#fffefa;--ink:#242521;--muted:#6e7168;--line:#d8d8cd;--accent:#b84927;--soft:#eae7de;--code:#202621}*{box-sizing:border-box}html{scroll-behavior:smooth;scroll-padding-top:92px}body{margin:0;color:var(--ink);background:var(--paper);font-family:Arial,Helvetica,sans-serif;line-height:1.6}a{color:inherit;text-underline-offset:4px}button,input,textarea{font:inherit}button,a,input,textarea,summary{touch-action:manipulation}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,summary:focus-visible,pre:focus-visible{outline:3px solid var(--accent);outline-offset:4px}img{max-width:100%;height:auto;display:block}h1,h2,h3,p{margin-top:0}h1,h2,h3{line-height:1.12}button{border:1px solid var(--line);padding:9px 14px;background:transparent;color:var(--ink);border-radius:3px}.button{display:inline-flex;align-items:center;justify-content:center;background:var(--ink);color:var(--white);padding:12px 20px;border:1px solid var(--ink);text-decoration:none;font-weight:700;border-radius:3px}.button:hover{background:var(--accent);border-color:var(--accent)}.skip-link{position:absolute;left:16px;top:-80px;z-index:30;background:var(--ink);color:#fff;padding:12px}.skip-link:focus{top:10px}.masthead{max-width:1264px;margin:auto;min-height:88px;padding:16px 32px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--ink);gap:24px}.wordmark{text-decoration:none;font-size:32px;font-weight:900;letter-spacing:-1.8px;line-height:1}.wordmark span{font-weight:400}.wordmark i{font-style:normal;color:var(--accent)}.masthead nav{display:flex;gap:28px;align-items:center;font-size:14px}.masthead nav a{text-decoration:none}.masthead nav a:hover{color:var(--accent)}.edition{font:11px monospace;letter-spacing:1px;color:var(--muted)}main{max-width:1200px;margin:auto}.kicker{font:700 11px/1.5 Arial,sans-serif;letter-spacing:1.5px;color:var(--accent);margin-bottom:16px}.intro{padding:58px 0 42px;display:flex;align-items:flex-end;justify-content:space-between;gap:40px}.intro h1{font-size:clamp(36px,4.2vw,62px);letter-spacing:-2.5px;margin-bottom:0}.intro h1 em{font-style:normal;color:var(--accent)}.intro-deck{font-size:16px;line-height:1.7;color:var(--muted);max-width:350px;margin-bottom:5px}.front-grid{display:grid;grid-template-columns:1.4fr 1fr;gap:40px;border-top:1px solid var(--line);padding-top:28px}.lead-story{text-decoration:none;background:#e9e5d9;border:1px solid #d9d4c7;border-radius:4px;padding:30px 32px;display:flex;flex-direction:column}.story-meta{display:flex;justify-content:space-between;gap:10px;font:10px monospace;letter-spacing:1px;color:#706e63;margin-bottom:26px}.lead-story h2{font-size:clamp(28px,3vw,42px);letter-spacing:-1.4px;margin-bottom:17px}.lead-story>p{font-size:16px;color:#565b51;max-width:480px;line-height:1.6}.lead-visual{margin:20px -8px 26px}.lead-visual img{width:100%;max-height:280px;object-fit:contain}.text-link{display:flex;justify-content:space-between;font-size:14px;font-weight:700;margin-top:auto;border-top:1px solid #cbc8bb;padding-top:16px}.text-link b{color:var(--accent);font-size:22px}.section-title{border-bottom:2px solid var(--ink);padding-bottom:16px}.section-title .kicker{margin-bottom:8px}.section-title h2{font-size:25px;letter-spacing:-.6px;margin:0}.recipe{display:flex;gap:15px;border-bottom:1px solid var(--line);padding:22px 0;text-decoration:none;align-items:flex-start}.recipe-number{font:12px monospace;color:var(--muted);padding-top:3px}.tiny-topic{font:10px monospace;letter-spacing:.8px;color:var(--accent)}.recipe h3{font-size:19px;line-height:1.3;margin:6px 0 0;font-weight:600}.recipe>b{margin-left:auto;font-size:22px;color:var(--accent)}.recipe:hover h3,.index-entry a:hover h3{color:var(--accent)}.reading-routes{margin-top:58px;border-top:1px solid var(--ink);padding:24px 0 36px}.reading-routes>div{display:grid;grid-template-columns:repeat(3,1fr);gap:30px}.reading-routes a{text-decoration:none;border-right:1px solid var(--line);display:flex;flex-direction:column;gap:9px;padding-right:24px}.reading-routes a:last-child{border:0}.reading-routes a>span{font:11px monospace;color:var(--muted)}.reading-routes strong{font-size:20px;line-height:1.25}.reading-routes small{font-size:13px;color:var(--muted)}.journal{padding:40px 0 56px;border-top:1px solid var(--ink)}.journal-heading{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:25px}.journal-heading h2{font-size:38px;letter-spacing:-1px;margin:0}.journal-heading>span{font:12px monospace;color:var(--muted)}.catalog-controls{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;background:var(--soft);padding:24px}.catalog-controls label{flex:1;max-width:390px}.catalog-controls label>span{display:block;font-size:12px;margin-bottom:8px}input{width:100%;background:var(--white);border:1px solid #a7aa9c;padding:12px;color:var(--ink);border-radius:2px}.topic-tabs{display:flex;flex-wrap:wrap;gap:7px}Line truncated
@media(min-width:1600px){main{max-width:1200px}}@media(max-width:1280px){main{margin:0 32px}.article-header{margin-left:220px}.reading-layout{grid-template-columns:185px minmax(0,1fr);gap:35px}.reading-layout:has(>.reading-column:first-child){margin-left:220px}.simple-page{margin-left:auto;margin-right:auto;padding-left:25px;padding-right:25px}}@media(max-width:950px){.edition{display:none}.front-grid{grid-template-columns:1.2fr 1fr;gap:25px}.lead-story{padding:25px}.recipe h3{font-size:17px}.intro-deck{max-width:280px;font-size:14px}.catalog-controls{flex-direction:column;align-items:stretch;gap:18px}.catalog-controls label{max-width:none}.article-header{margin-left:0;max-width:820px}.reading-layout{display:block}.reading-layout:has(>.reading-column:first-child){margin-left:0}.contents-rail{position:static;max-height:none;max-width:810px;padding:15px 20px;background:var(--soft);margin-bottom:30px}.contents-rail nav{display:grid;grid-template-columns:1fr 1fr;gap:0 25px}.contents-rail details summary{padding-bottom:10px}.footer{grid-template-columns:1fr 1.5fr 1fr}.footer>span{display:none}.workbench{gap:20px}.index-entry{grid-template-columns:140px 1fr 70px;gap:20px}.article-content{font-size:17px}}
@media(max-width:650px){html{scroll-padding-top:20px}.masthead{margin:0 20px;padding:20px 0;gap:20px;flex-wrap:wrap;min-height:108px}.wordmark{font-size:30px}.masthead nav{gap:22px;width:100%;font-size:12px;justify-content:space-between}.masthead nav a{white-space:nowrap}main{margin:0 20px}.intro{padding:35px 0 28px;display:block}.intro h1{font-size:41px;letter-spacing:-1.8px}.intro-deck{max-width:none;font-size:14px;margin:23px 0 0}.intro-deck br{display:none}.kicker{font-size:10px;letter-spacing:1.2px}.front-grid{display:block;padding-top:20px}.lead-story{padding:22px}.story-meta{font-size:8px;margin-bottom:22px;letter-spacing:.8px}.lead-story h2{font-size:29px;letter-spacing:-1px}.lead-story>p{font-size:14px}.lead-visual{margin:15px -12px 20px}.lead-visual img{max-height:none}.text-link{font-size:12px}.recipe-column{margin-top:30px}.section-title h2{font-size:25px}.recipe{padding:18px 0}.recipe h3{font-size:19px}.reading-routes{margin-top:35px;padding-top:20px}.reading-routes>div{display:block}.reading-routes a{border-right:0;border-bottom:1px solid var(--line);padding:17px 0;gap:7px}.reading-routes strong{font-size:20px}.journal{padding-top:28px;padding-bottom:35px}.journal-heading{display:block}.journal-heading h2{font-size:30px;margin-bottom:14px}.journal-heading>span{font-size:11px}.catalog-controls{padding:18px;margin:0 -4px}.topic-tabs{gap:6px}.topic-tabs button{font-size:12px;padding:8px 11px}.index-entry{grid-template-columns:1fr 55px;gap:10px;padding:22px 0}.index-date{grid-column:1/-1;display:flex;justify-content:space-between;gap:15px;font-size:10px;padding:0}.index-date span{display:inline;margin:0;font-size:10px}.index-entry h3{font-size:20px;line-height:1.3;margin:0 0 10px}.index-entry p{font-size:13px;line-height:1.6}.index-duration{font-size:10px;display:block;text-align:right;padding-top:6px}.index-duration b{display:block;font-size:23px;padding-top:15px}.utility-promo{display:block;padding:25px;margin-bottom:35px}.utility-promo h2{font-size:29px}.utility-promo p{font-size:14px}.utility-promo .button{font-size:12px;margin-top:25px}.footer{margin:0 20px;padding:28px 0;grid-template-columns:1fr 1fr;gap:22px}.footer>p{grid-column:1}.footer>div{grid-column:2;grid-row:1/3;font-size:12px}.footer .wordmark{font-size:24px}.breadcrumbs{font-size:10px;padding:22px 0;gap:10px}.article-header{margin:12px 0 26px}.article-header h1{font-size:34px;letter-spacing:-1px;line-height:1.13;margin-bottom:20px}.article-deck{font-size:18px;line-height:1.5;margin-bottom:20px}.article-meta{font-size:10px;gap:8px 15px;padding-top:13px}.contents-rail{padding:13px 16px;margin:0 0 25px}.contents-rail nav{display:flex;gap:0}.contents-rail nav a{padding:7px 0;font-size:12px}.article-content{font-size:17px;line-height:1.75}.article-content h2{font-size:25px;margin:36px 0 18px;line-height:1.25;letter-spacing:-.4px}.article-content h3{font-size:20px;margin-top:28px}.article-content pre{font-size:12px;padding:20px 18px;margin:24px -4px;max-width:calc(100% + 8px)}.article-content figure{margin:25px -4px;padding:10px}.article-content figcaption{font-size:11px;line-height:1.6;padding-top:10px;margin-top:10px}.article-content blockquote{padding-left:18px;margin:20px 0}.article-end{font-size:10px}.related{padding:20px}.related a{font-size:17px}.reading-layout{padding-bottom:35px}.simple-page{margin:0;padding:35px 20px 50px;max-width:none}.simple-page h1,.tool-page h1{font-size:43px;letter-spacing:-1.6px}.large-text{font-size:20px;line-height:1.6;margin-bottom:35px}.tool-page{padding:35px 0 50px}.tool-heading p:not(.kicker){font-size:15px}.workbench{grid-template-columns:1fr;gap:28px}.workbench textarea{min-height:260px;font-size:13px;padding:16px}.result-panel{min-height:280px;padding:0 18px 18px}.result-panel pre{font-size:13px;min-height:150px}.tool-actions{gap:7px}.tool-actions button{font-size:12px;padding:10px 13px}.field-note{font-size:10px;line-height:1.5}.tool-notes{margin-top:30px;font-size:14px}.missing{padding:45px 0 65px}.missing h1{font-size:34px}.missing>p:not(.kicker){font-size:14px}.missing-code{font-size:70px}.archive-page{padding:35px 0}.archive-page h1{font-size:37px}.archive-page>.large-text{font-size:18px}.resource-groups section>h2{font-size:25px}.resource-groups h3{font-size:18px}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
.article-content .table-scroll{max-width:100%;overflow:auto;margin:25px 0;border:1px solid var(--line);border-radius:3px}.article-content .table-scroll:focus-visible{outline:3px solid var(--accent);outline-offset:4px}.article-content .table-scroll table{display:table;min-width:620px;max-width:none;width:100%;margin:0;overflow-wrap:normal}.article-content figure img[src$=".jpg"]{width:auto;max-width:100%;margin-inline:auto}
@import '../fsd/shared/styles/tokens.css';
@import '../fsd/shared/styles/editorial.css';
@import '../fsd/shared/styles/components.css';
+5 -4
View File
@@ -1,5 +1,6 @@
import './globals.css';
import Link from 'next/link';
import Metrika from './Metrika';
export const metadata={metadataBase:new URL('https://progcode.ru'),icons:{icon:'/icon.svg'},title:'ProgCode — записки о программировании',description:'D, PHP, Bitrix и JavaScript: разборы механизмов, рабочие рецепты и разговоры с разработчиками.'};
export default function RootLayout({children}){return <html lang="ru"><body><Metrika/><a className="skip-link" href="#main">К содержанию</a><header className="masthead"><Link className="wordmark" href="/" aria-label="ProgCode — главная">prog<span>code</span><i>_</i></Link><nav aria-label="Главная навигация"><Link href="/#journal">Статьи</Link><Link href="/resources/">Справочники</Link><Link href="/tools/">JSON</Link><Link href="/about/">О блоге</Link></nav><span className="edition">D / PHP / WEB</span></header>{children}<footer className="footer"><Link className="wordmark" href="/">prog<span>code</span><i>_</i></Link><p>Заметки о том, как устроен код.<br/>D, PHP, Bitrix и веб-разработка.</p><div><Link href="/#journal">Все статьи</Link><Link href="/resources/">Полезные ссылки</Link><Link href="/tools/">JSON-инструмент</Link></div><span>Материалы 2017–2019</span></footer></body></html>}
import {SiteHeader,SiteFooter} from '../fsd/widgets/site-shell';
import {ThemeInit} from '../fsd/features/theme-selection';
import {Metrika} from '../fsd/features/analytics';
export const metadata={metadataBase:new URL('https://progcode.ru'),icons:{icon:[{url:'/brand/v3/favicon.svg',type:'image/svg+xml'},{url:'/brand/v3/favicon.ico',sizes:'16x16 32x32 48x48'},{url:'/brand/v3/favicon-32.png',sizes:'32x32',type:'image/png'}],apple:[{url:'/brand/v3/favicon-180.png',sizes:'180x180'}]},title:'ProgCode — записки о программировании',description:'D, PHP, Bitrix и JavaScript: разборы механизмов, рабочие рецепты и разговоры с разработчиками.'};
export default function RootLayout({children}){return <html lang="ru" suppressHydrationWarning><head><ThemeInit/></head><body><Metrika/><a className="skip-link" href="#main">К содержанию</a><SiteHeader/>{children}<SiteFooter/></body></html>}
+1 -2
View File
@@ -1,2 +1 @@
import Link from 'next/link';
export default function Missing(){return <main id="main" className="missing"><p className="kicker">ОШИБКА 404</p><div className="missing-code" aria-hidden="true">&#123; ? &#125;</div><h1>Такой страницы нет.</h1><p>Возможно, в адресе опечатка или ссылка больше не существует.<br/>Попробуйте найти нужную тему в журнале.</p><Link className="button" href="/#journal">Перейти к поиску →</Link><Link href="/resources/">Открыть справочники</Link></main>}
export {default} from '../fsd/pages/not-found';
+1 -5
View File
@@ -1,5 +1 @@
import Link from 'next/link';
import Catalog from './Catalog';
import Shortlinks from './Shortlinks';
import {getArticles,getArticleSummaries,formatDate} from '../lib/articles';
export default function Home(){const all=getArticles(),lead=all.find(a=>a.slug==='новый-движок-ctfe'),recipes=all.filter(a=>a.categories.includes('Bitrix')||a.categories.includes('PHP')).slice(0,4);return <main id="main"><Shortlinks/><section className="intro"><div><p className="kicker">ЗАПИСКИ ПРОГРАММИСТА · 2017–2019</p><h1>Разобраться.<br/><em>Написать.</em> Проверить.</h1></div><p className="intro-deck">Что происходит во время компиляции? <br/>Как связаны товар и предложение? <br/>Здесь — механизмы, примеры и опыт разработки.</p></section><section className="front-grid" aria-label="С чего начать"><Link className="lead-story" href={'/articles/'+encodeURIComponent(lead.slug)+'/'}><div className="story-meta"><span>ВНУТРИ ЯЗЫКА D</span><span>01 / РАЗБОР</span></div><h2>Код, который работает<br/>до запуска программы</h2><p>Как CTFE выполняет функции на этапе компиляции и зачем D понадобился новый движок.</p><div className="lead-visual"><img src="/visuals/v2/ctfe-overview.svg" alt="Компилятор вычисляет square(3) для enum и получает n = 9 ещё до запуска программы"/></div><span className="text-link">Разобрать CTFE <b>↗</b></span></Link><div className="recipe-column"><div className="section-title"><p className="kicker">ПРАКТИКА</p><h2>Рецепты без лишнего</h2></div>{recipes.map((article,i)=><Link className="recipe" key={article.slug} href={'/articles/'+encodeURIComponent(article.slug)+'/'}><span className="recipe-number">0{i+1}</span><div><span className="tiny-topic">{article.categories.join(' / ')}</span><h3>{article.title}</h3></div><b aria-hidden="true">↗</b></Link>)}</div></section><section className="reading-routes" aria-label="Маршруты чтения"><p className="kicker">ВЫБЕРИТЕ ЗАДАЧУ</p><div><Link href="/category/dlang/"><span>01</span><strong>Понять язык D</strong><small>CTFE, память, диапазоны и интерфейсы →</small></Link><Link href="/category/bitix/"><span>02</span><strong>Собрать интеграцию Bitrix</strong><small>Товар, предложение, символьный код →</small></Link><Link href="/articles/ошибка-php-ssl-certificate-error-unable-to-get-local-issuer-certificate/"><span>03</span><strong>Разобраться с TLS</strong><small>Проверка сертификата без обхода защиты →</small></Link></div></section><Catalog articles={getArticleSummaries()}/><section className="utility-promo"><div><p className="kicker">НА РАБОЧЕМ СТОЛЕ</p><h2>Сначала проверьте JSON.</h2><p>Форматирование, поиск синтаксических ошибок и компактная запись — прямо в браузере.</p></div><Link className="button" href="/tools/">Открыть инструмент ↗</Link></section></main>}
export {default} from '../fsd/pages/home';
+2
View File
@@ -0,0 +1,2 @@
export const metadata={title:'Приватность и аналитика — ProgCode'};
export {default} from '../../fsd/pages/privacy';
+1 -2
View File
@@ -1,3 +1,2 @@
export const metadata={title:'Справочники разработчика — ProgCode'};
const sources=[['D','Язык, стандартная библиотека и инструменты',[['Спецификация D','https://dlang.org/spec/spec.html','Синтаксис, семантика и правила языка.'],['Стандартная библиотека Phobos','https://dlang.org/phobos/index.html','Контракты функций, модули и примеры.'],['DUB','https://dub.pm/','Сборка проектов и управление зависимостями.']]],['PHP','Функции и интеграции',[['Справочник PHP','https://www.php.net/manual/ru/','Функции, расширения и примеры использования.'],['API Bitrix','https://dev.1c-bitrix.ru/api_help/','Описание API и ограничений конкретных методов.']]],['Web','Сборка и безопасность',[['webpack: ProvidePlugin','https://webpack.js.org/plugins/provide-plugin/','Как автоматически подключать модуль для свободного идентификатора.'],['MDN: JSON.parse','https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse','Синтаксис JSON, ошибки разбора и точность чисел.'],['curl: проверка TLS','https://curl.se/docs/sslcerts.html','Цепочка доверия и безопасная диагностика сертификатов.']]]];
export default function Resources(){return <main id="main" className="simple-page"><p className="kicker">ДЕРЖАТЬ ПОД РУКОЙ</p><h1>Сначала —<br/>первоисточник.</h1><p className="large-text">Справочники по темам журнала: для проверки версии API, поведения функции и границ примера.</p><div className="resource-groups">{sources.map(([topic,title,links])=><section key={topic}><p className="kicker">{topic}</p><h2>{title}</h2>{links.map(([name,href,text])=><a key={href} href={href}><h3>{name}<span>↗</span></h3><p>{text}</p></a>)}</section>)}</div></main>}
export {default} from '../../fsd/pages/resources';
+2
View File
@@ -0,0 +1,2 @@
export const metadata={title:'Источники и редактура — ProgCode'};
export {default} from '../../fsd/pages/sources';
+2 -3
View File
@@ -1,3 +1,2 @@
"use client";
import {useState} from 'react';
export default function Tools(){const [text,setText]=useState('{"project":"ProgCode","ready":true}'),[result,setResult]=useState(''),[state,setState]=useState('empty'),[copy,setCopy]=useState('');function run(compact){setCopy('');try{setResult(JSON.stringify(JSON.parse(text),null,compact?0:2));setState('success');}catch(e){setResult(e.message);setState('error');}}async function copyResult(){try{await navigator.clipboard.writeText(result);setCopy('Скопировано');}catch{setCopy('Не удалось скопировать. Выделите текст результата вручную.');}}return <main id="main" className="tool-page"><div className="tool-heading"><p className="kicker">ИНСТРУМЕНТ РАЗРАБОТЧИКА</p><h1>Привести JSON <br/>в порядок.</h1><p>Проверьте синтаксис, расставьте отступы или уберите пробелы.<br/>Текст обрабатывается локально в вашем браузере.</p></div><div className="workbench"><section><label htmlFor="json">01 / Исходный JSON</label><textarea id="json" value={text} maxLength={1000000} spellCheck={false} onChange={e=>setText(e.target.value)} aria-describedby="json-limit"/><p id="json-limit" className="field-note">До 1 МБ текста. Исходный текст не отправляется на сервер.</p><div className="tool-actions"><button className="button" onClick={()=>run(false)}>Форматировать</button><button onClick={()=>run(true)}>Сжать</button><button onClick={()=>{setText('');setResult('');setState('empty');setCopy('');}}>Очистить</button></div></section><section className={'result-panel '+state}><div className="result-heading"><span>02 / Результат</span>{state==='success'&&<button onClick={copyResult}>Копировать</button>}</div><div role="status" aria-live="polite"><p className="result-label">{state==='error'?'Ошибка синтаксиса':state==='success'?'JSON корректен':'Ожидает проверки'}</p><pre tabIndex={0}>{result||'Результат появится после проверки.'}</pre></div><p role="status" className="copy-feedback">{copy}</p></section></div><div className="tool-notes"><h2>Синтаксис — только первый шаг.</h2><p>Ключи и строки требуют двойных кавычек. Комментарии и завершающие запятые не поддерживаются. Проверка не подтверждает соответствие схеме API. Большие целые числа могут терять точность в JavaScript: такие идентификаторы лучше хранить строками.</p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse">Правила JSON.parse в MDN ↗</a></div></main>}
export const metadata={title:'JSON-инструмент — ProgCode'};
export {default} from '../../fsd/pages/json-tool';
+2
View File
@@ -0,0 +1,2 @@
export const metadata={title:'Компоненты ProgCode — UI kit'};
export {default} from '../../fsd/pages/ui-kit';