Open Root-FTW opened 1 year ago
No momento não tenho, é uma boa ideia mesmo!
I have an update loja.tsx if you wanna make section like that
const Loja = (tipo: any) => {
const [loja, setLoja] = useState<{ [key: string]: any[] }>({});
const loja_tipo = tipo.tipo
const getLoja = async () => {
try {
const response = await apiFetch.get("/combined?language=en")
const data = response.data;
const daily_entries = tipo_filter(data, loja_tipo);
const items_all = daily_entries.filter(items_filter);
// Organize the items by section
const sectionedItems = organizeItemsBySection(items_all);
setLoja(sectionedItems)
} catch (error) {
console.log(error)
}
}
useEffect(() => {
getLoja();
}, [])
function items_filter(props: any) {
if (props.bundle == null) {
return props;
}
}
function sortItemsBySectionName(items: any[]) {
return items.sort((a, b) => {
if (a.section.name < b.section.name) return -1;
if (a.section.name > b.section.name) return 1;
return 0;
});
}
function organizeItemsBySection(items: any[]) {
const sections: { [key: string]: any[] } = {};
items.forEach(item => {
const sectionName = item.section.name;
if (!sections[sectionName]) {
sections[sectionName] = [];
}
sections[sectionName].push(item);
});
return sections;
}
function tipo_filter(props: any, tipo: string){
if (tipo == "featured")
return props.data.featured.entries
if (tipo == "daily")
return props.data.daily.entries
}
I have an update loja.tsx if you wanna make section like that
const Loja = (tipo: any) => {
const [loja, setLoja] = useState<{ [key: string]: any[] }>({});
const loja_tipo = tipo.tipo const getLoja = async () => { try { const response = await apiFetch.get("/combined?language=en") const data = response.data; const daily_entries = tipo_filter(data, loja_tipo); const items_all = daily_entries.filter(items_filter); // Organize the items by section const sectionedItems = organizeItemsBySection(items_all); setLoja(sectionedItems) } catch (error) { console.log(error) } } useEffect(() => { getLoja(); }, []) function items_filter(props: any) { if (props.bundle == null) { return props; } } function sortItemsBySectionName(items: any[]) { return items.sort((a, b) => { if (a.section.name < b.section.name) return -1; if (a.section.name > b.section.name) return 1; return 0; }); } function organizeItemsBySection(items: any[]) { const sections: { [key: string]: any[] } = {}; items.forEach(item => { const sectionName = item.section.name; if (!sections[sectionName]) { sections[sectionName] = []; } sections[sectionName].push(item); }); return sections; } function tipo_filter(props: any, tipo: string){ if (tipo == "featured") return props.data.featured.entries if (tipo == "daily") return props.data.daily.entries }
I'm running this code in vercel and when I changed that part of the code I got this
No momento não tenho, é uma boa ideia mesmo!
sim, é um óptimo design, espero que o consigas alcançar no futuro <3
At the moment I don't, it's a really good idea!
yes, it's a great design, hope you can achieve it in the future <3
you need to change some part of loja,bundle,item,item_info too
That sounds more advanced, I'm not a programmer, I only know the basics haha.
I think I better wait for someone else to make that improvement :S
At the moment I don't, it's a really good idea!
yes, it's a great design, hope you can achieve it in the future <3
you need to change some part of loja,bundle,item,item_info too
Do you have a live example to see the result? I have not been able to do it.
Têm algum plano para fazer a distribuição de secções como este sítio?
https://fortnite.gg/shop
Seria óptimo se fosse parecido com o jogo.
(Apenas uma dica/recomendação para que pareça mais fixe)