feat: универсальный шаблон проектов контура Raisa
- base_templates/: шаблоны платформы fastapi, streamlit, airflow без изменений - contour/: платформа, подтверждённые версии, грабли, профили 4 типов приложений - project-kit/: SDD (S/M/L, delta/spec/plan, constitution, DoR/DoD) + grill, критик тестов, UX gate, handoff; один канон AGENTS.md для Cursor и Claude Code - scripts/init_project.sh: сборка нового проекта или подключение kit к существующему - docs/decisions/0001: что перенесено из elite_vibecoding и dmukp и почему Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139EkK4ShEj52pM9Z5UCwM1
This commit is contained in:
40
base_templates/fastapi/web/src/App.tsx
Normal file
40
base_templates/fastapi/web/src/App.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Config } from './conf/config';
|
||||
import { Card } from 'react-daisyui';
|
||||
|
||||
const App = () => {
|
||||
const [apiResponse, setApiResponse] = useState<{
|
||||
date_with_time: string,
|
||||
text: string
|
||||
}|null>(null);
|
||||
|
||||
// Загрузка данных с сервера
|
||||
useEffect(() => {
|
||||
|
||||
fetch(`${Config.API_URL}/api`, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: 'GET'
|
||||
})
|
||||
.then(async (response) => {
|
||||
setApiResponse(await response.json())
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('Ошибка при получении данных с api:', error);
|
||||
alert("Ошибка при получении данных с api");
|
||||
})
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className='flex items-center justify-center absolute inset-0'>
|
||||
<Card className="flex flex-col gap-2 border-[2px] items-center justify-center border-primary rounded-md p-6" style={{ width: '50vw', height: '200px' }}>
|
||||
<h1>Шаблон приложения Fast API</h1>
|
||||
<p>Время: {(apiResponse?.date_with_time) ? new Date(apiResponse?.date_with_time).toISOString() : "Нет данных по времени"}, Текст: {apiResponse?.text}</p>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default App;
|
||||
6
base_templates/fastapi/web/src/conf/config.ts
Normal file
6
base_templates/fastapi/web/src/conf/config.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
//@ts-ignore
|
||||
const environment = process.env;
|
||||
|
||||
export class Config {
|
||||
static API_URL: string = environment.REACT_APP_API_URL ?? environment.REACT_APP_ROOT_PATH ?? '';
|
||||
}
|
||||
1
base_templates/fastapi/web/src/env.d.ts
vendored
Normal file
1
base_templates/fastapi/web/src/env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="@rsbuild/core/types" />
|
||||
17
base_templates/fastapi/web/src/index.css
Normal file
17
base_templates/fastapi/web/src/index.css
Normal file
@@ -0,0 +1,17 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
||||
sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||
monospace;
|
||||
}
|
||||
14
base_templates/fastapi/web/src/index.tsx
Normal file
14
base_templates/fastapi/web/src/index.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
|
||||
const rootEl = document.getElementById('root');
|
||||
if (rootEl) {
|
||||
const root = ReactDOM.createRoot(rootEl);
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user