Skip to content

Commit 55cf006

Browse files
committed
feat: init
0 parents  commit 55cf006

File tree

19 files changed

+4481
-0
lines changed

19 files changed

+4481
-0
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: main-ci
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths-ignore:
7+
- 'README.md'
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node
18+
uses: actions/setup-node@v4
19+
20+
- name: Install dependencies
21+
run: |
22+
node -v
23+
npm -v
24+
npm ci --no-fund
25+
26+
- name: Check Prettier
27+
run: npm run check-format

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.env
2+
**/tailwind-output.css
3+
.vercel
4+
**/.vitepress/cache
5+
**/.vitepress/dist
6+
7+
**/.vscode
8+
node_modules
9+
auto-imports.d.ts
10+
components.d.ts
11+
12+
#mac
13+
.DS_Store

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
22

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "es5",
8+
"bracketSpacing": true,
9+
"arrowParens": "always",
10+
"endOfLine": "lf",
11+
"proseWrap": "always",
12+
"plugins": ["prettier-plugin-tailwindcss"]
13+
}

.vitepress/config.mts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import { transformerTwoslash } from '@shikijs/vitepress-twoslash';
2+
import tailwindcss from '@tailwindcss/vite';
3+
import { defineConfig } from 'vitepress';
4+
5+
// https://vitepress.dev/reference/site-config
6+
export default defineConfig({
7+
title: 'iExec documentation',
8+
description:
9+
'Build decentralized applications that combine ownership, privacy, and monetization.',
10+
cleanUrls: true,
11+
lastUpdated: true,
12+
ignoreDeadLinks: true,
13+
vite: {
14+
plugins: [tailwindcss()],
15+
},
16+
markdown: {
17+
codeTransformers: [transformerTwoslash()],
18+
},
19+
20+
head: [
21+
['link', { rel: 'icon', href: '/Logo-RLC-Yellow.png' }],
22+
[
23+
'link',
24+
{
25+
rel: 'stylesheet',
26+
href: 'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap',
27+
},
28+
],
29+
[
30+
'script',
31+
{},
32+
`
33+
window.axeptioSettings = {
34+
clientId: "6413111857e4d2a6342cd5c6",
35+
cookiesVersion: "iexec-en",
36+
};
37+
38+
(function(d, s) {
39+
var t = d.getElementsByTagName(s)[0], e = d.createElement(s);
40+
e.async = true; e.src = "//static.axept.io/sdk.js";
41+
t.parentNode.insertBefore(e, t);
42+
})(document, "script");
43+
`,
44+
],
45+
// Mava widget
46+
[
47+
'script',
48+
{
49+
defer: '',
50+
src: 'https://widget.mava.app',
51+
'widget-version': 'v2',
52+
id: 'MavaWebChat',
53+
'enable-sdk': 'false',
54+
'data-token':
55+
'8e4e10aad5750451e8726768e8c639dae54f461beeb176f5ebd687371c9390f2',
56+
},
57+
],
58+
// Hotjar Tracking Script
59+
[
60+
'script',
61+
{},
62+
`
63+
(function(h,o,t,j,a,r){
64+
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
65+
h._hjSettings={hjid:5303222,hjsv:6};
66+
a=o.getElementsByTagName('head')[0];
67+
r=o.createElement('script');r.async=1;
68+
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
69+
a.appendChild(r);
70+
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
71+
`,
72+
],
73+
],
74+
75+
themeConfig: {
76+
// https://vitepress.dev/reference/default-theme-config
77+
nav: [
78+
{ text: 'Home', link: '/' },
79+
{
80+
text: 'Markdown Examples',
81+
link: '/markdown-examples',
82+
},
83+
],
84+
outline: {
85+
level: [2, 3],
86+
},
87+
88+
sidebar: [
89+
{
90+
text: 'Home',
91+
link: '/index',
92+
},
93+
{
94+
text: 'Markdown Examples',
95+
link: '/markdown-examples',
96+
},
97+
],
98+
99+
search: {
100+
provider: 'local',
101+
},
102+
103+
socialLinks: [
104+
{ icon: 'github', link: 'https://github.com/iExecBlockchainComputing' },
105+
{ icon: 'x', link: 'https://twitter.com/iEx_ec' },
106+
{ icon: 'discord', link: 'https://discord.com/invite/pbt9m98wnU' },
107+
],
108+
109+
editLink: {
110+
pattern:
111+
'https://github.com/iExecBlockchainComputing/documentation/blob/main/:path',
112+
text: 'Suggest changes to this page',
113+
},
114+
115+
logo: {
116+
light: '/Logo-RLC-Yellow.png',
117+
dark: '/Logo-RLC-Yellow.png',
118+
alt: 'iExec logo',
119+
},
120+
},
121+
});

.vitepress/theme/AskIaButton.vue

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
<template>
2+
<div
3+
class="relative mb-4 flex flex-col items-center text-white"
4+
ref="dropdownRef"
5+
>
6+
<!-- Split button: main button + dropdown trigger -->
7+
<div
8+
class="flex h-9 cursor-pointer rounded-full bg-[#202123] text-sm font-medium shadow-md"
9+
>
10+
<!-- Main button - launches ChatGPT directly -->
11+
<a
12+
class="flex items-center rounded-l-full px-3 duration-200 hover:bg-[#2d2f31]"
13+
:href="chatGPTLink"
14+
target="_blank"
15+
rel="noopener"
16+
>
17+
<img
18+
src="/assets/icons/chatgpt.svg"
19+
alt="ChatGPT"
20+
class="mr-2 h-6 w-6"
21+
/>
22+
Ask in ChatGPT
23+
</a>
24+
25+
<!-- Dropdown trigger button -->
26+
<button
27+
class="flex w-6 items-center justify-center rounded-r-full border-l border-white/10 p-0 duration-200 hover:bg-[#2d2f31]!"
28+
@click.stop="toggleDropdown"
29+
aria-label="More options"
30+
>
31+
<Icon
32+
:class="{ 'rotate-180': isDropdownOpen }"
33+
class="transition-transform duration-200"
34+
icon="ep:arrow-down"
35+
height="12"
36+
width="12"
37+
/>
38+
</button>
39+
</div>
40+
41+
<!-- Dropdown menu -->
42+
<div
43+
class="absolute top-full z-[1000] mt-2 min-w-[280px] rounded-xl border border-[#333] bg-[#1f1f1f] shadow-2xl"
44+
v-show="isDropdownOpen"
45+
>
46+
<a
47+
class="flex w-full items-center gap-3 rounded-xl px-4 py-3 text-left text-[#e0e0e0] transition-all duration-200 hover:bg-[#2a2a2a] hover:text-white focus:outline-none active:bg-[#333] active:text-white"
48+
:href="chatGPTLink"
49+
target="_blank"
50+
rel="noopener"
51+
@click="closeDropdown"
52+
>
53+
<div class="flex h-8 w-8 flex-shrink-0 items-center justify-center">
54+
<img
55+
src="/assets/icons/chatgpt.svg"
56+
alt="ChatGPT"
57+
class="h-auto max-w-[80%]"
58+
/>
59+
</div>
60+
<div class="flex flex-1 flex-col gap-0.5">
61+
<div class="text-sm font-medium">Open in ChatGPT</div>
62+
<div class="text-xs leading-tight text-[#999]">
63+
Ask questions about this page
64+
</div>
65+
</div>
66+
<Icon
67+
class="flex-shrink-0 text-[#666] transition-colors duration-200 group-hover:text-[#999]"
68+
icon="ep:arrow-right"
69+
height="16"
70+
width="16"
71+
/>
72+
</a>
73+
74+
<a
75+
class="flex w-full items-center gap-3 rounded-xl px-4 py-3 text-left text-[#e0e0e0] transition-all duration-200 hover:bg-[#2a2a2a] hover:text-white focus:outline-none active:bg-[#333] active:text-white"
76+
:href="claudeLink"
77+
target="_blank"
78+
rel="noopener"
79+
@click="closeDropdown"
80+
>
81+
<div class="flex h-8 w-8 flex-shrink-0 items-center justify-center">
82+
<img
83+
src="/assets/icons/anthropic.svg"
84+
alt="Anthropic"
85+
class="h-auto max-w-[80%]"
86+
/>
87+
</div>
88+
<div class="flex flex-1 flex-col gap-0.5">
89+
<div class="text-sm font-medium">Open in Claude</div>
90+
<div class="text-xs leading-tight text-[#999]">
91+
Ask questions about this page
92+
</div>
93+
</div>
94+
<Icon
95+
class="flex-shrink-0 text-[#666] transition-colors duration-200 group-hover:text-[#999]"
96+
icon="ep:arrow-right"
97+
height="16"
98+
width="16"
99+
/>
100+
</a>
101+
102+
<button
103+
class="flex w-full items-center gap-3 rounded-xl px-4! py-3! text-left text-[#e0e0e0] transition-all duration-200 hover:bg-[#2a2a2a]! focus:outline-none active:bg-[#333]! disabled:cursor-not-allowed disabled:opacity-50"
104+
@click="copyPageContent"
105+
:disabled="isCopying"
106+
>
107+
<div class="flex h-8 w-8 flex-shrink-0 items-center justify-center">
108+
<Icon
109+
class="h-auto max-w-[80%]"
110+
icon="ep:copy-document"
111+
height="20"
112+
width="20"
113+
/>
114+
</div>
115+
<div class="flex flex-1 flex-col gap-0.5">
116+
<div class="text-sm font-medium">
117+
{{ isCopying ? 'Copied!' : 'Copy page' }}
118+
</div>
119+
<div class="text-xs leading-tight text-[#999]">
120+
Copy page as Markdown for LLMs
121+
</div>
122+
</div>
123+
</button>
124+
</div>
125+
</div>
126+
</template>
127+
128+
<script setup>
129+
import { ref, computed, onMounted, onUnmounted } from 'vue';
130+
import { useRoute } from 'vitepress';
131+
import TurndownService from 'turndown';
132+
import { Icon } from '@iconify/vue';
133+
134+
const route = useRoute();
135+
const dropdownRef = ref(null);
136+
const isDropdownOpen = ref(false);
137+
const isCopying = ref(false);
138+
139+
// Initialize handleClickOutside ref
140+
const handleClickOutsideRef = ref(null);
141+
142+
const chatGPTLink = computed(() => {
143+
const fullUrl = `https://tools.docs.iex.ec${route.path}`;
144+
const prompt = `Please research and analyze this page: ${fullUrl} so I can ask you questions about it. Once you have read it, prompt me with any questions I have. Do not post content from the page in your response. Any of my follow up questions must reference the site I gave you.`;
145+
return `https://chatgpt.com/?hints=search&q=${encodeURIComponent(prompt)}`;
146+
});
147+
148+
const claudeLink = computed(() => {
149+
const fullUrl = `https://tools.docs.iex.ec${route.path}`;
150+
const prompt = `Please research and analyze this page: ${fullUrl} so I can ask you questions about it. Once you have read it, prompt me with any questions I have. Do not post content from the page in your response. Any of my follow up questions must reference the site I gave you.`;
151+
return `https://claude.ai/new?q=${encodeURIComponent(prompt)}`;
152+
});
153+
154+
const toggleDropdown = () => {
155+
isDropdownOpen.value = !isDropdownOpen.value;
156+
};
157+
158+
const closeDropdown = () => {
159+
isDropdownOpen.value = false;
160+
};
161+
162+
const copyPageContent = async () => {
163+
isCopying.value = true;
164+
165+
const turndownService = new TurndownService();
166+
const mainContent = document.querySelector('.vp-doc');
167+
const markdown = turndownService.turndown(mainContent);
168+
169+
await navigator.clipboard.writeText(markdown);
170+
171+
await new Promise((resolve) => setTimeout(resolve, 800));
172+
173+
isCopying.value = false;
174+
};
175+
176+
const handleClickOutside = (event) => {
177+
if (dropdownRef.value && !dropdownRef.value.contains(event.target)) {
178+
closeDropdown();
179+
}
180+
};
181+
182+
onMounted(() => {
183+
handleClickOutsideRef.value = handleClickOutside;
184+
document.addEventListener('click', handleClickOutsideRef.value);
185+
});
186+
187+
onUnmounted(() => {
188+
document.removeEventListener('click', handleClickOutsideRef.value);
189+
});
190+
</script>

.vitepress/theme/Layout.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script setup>
2+
import DefaultTheme from 'vitepress/theme';
3+
import AskIaButton from './AskIaButton.vue';
4+
5+
const { Layout } = DefaultTheme;
6+
</script>
7+
8+
<template>
9+
<Layout>
10+
<template #aside-outline-before>
11+
<AskIaButton />
12+
</template>
13+
</Layout>
14+
</template>

0 commit comments

Comments
 (0)